weka.classifiers.trees.lmt

## Class SimpleLinearRegression

- java.lang.Object
- - weka.classifiers.trees.lmt.SimpleLinearRegression

- All Implemented Interfaces:
    java.io.Serializable

      public class SimpleLinearRegression
      extends java.lang.Object
      implements java.io.Serializable

  Stripped down version of SimpleLinearRegression. Assumes that there are no missing class values.
  Version:
    $Revision: 10169 $
  Author:
    Eibe Frank (eibe@cs.waikato.ac.nz)
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `SimpleLinearRegression()` Default constructor.
    `SimpleLinearRegression(int attIndex, double slope, double intercept)` Construct a simple linear regression model based on the given info.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addModel(SimpleLinearRegression slr)` Takes the given simple linear regression model and adds it to this one.
    `void` | `buildClassifier(Instances insts)` Builds a simple linear regression model given the supplied training data.
    `double` | `classifyInstance(Instance inst)` Generate a prediction for the supplied instance.
    `boolean` | `foundUsefulAttribute()` Returns true if a usable attribute was found.
    `int` | `getAttributeIndex()` Returns the index of the attribute used in the regression.
    `double` | `getIntercept()` Returns the intercept of the function.
    `double` | `getSlope()` Returns the slope of the function.

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### SimpleLinearRegression

          public SimpleLinearRegression()

      Default constructor.

    - #### SimpleLinearRegression

          public SimpleLinearRegression(int attIndex,
                                double slope,
                                double intercept)

      Construct a simple linear regression model based on the given info.

  - ### Method Detail

    - #### addModel

          public void addModel(SimpleLinearRegression slr)
                        throws java.lang.Exception

      Takes the given simple linear regression model and adds it to this one. Does nothing if the given model is based on a different attribute. Assumes the given model has been initialized.
      Throws:
        `java.lang.Exception`

    - #### classifyInstance

          public double classifyInstance(Instance inst)

      Generate a prediction for the supplied instance.
      Parameters:
        `inst` - the instance to predict.
      Returns:
        the prediction

    - #### buildClassifier

          public void buildClassifier(Instances insts)

      Builds a simple linear regression model given the supplied training data.
      Parameters:
        `insts` - the training data.

    - #### foundUsefulAttribute

          public boolean foundUsefulAttribute()

      Returns true if a usable attribute was found.
      Returns:
        true if a usable attribute was found.

    - #### getAttributeIndex

          public int getAttributeIndex()

      Returns the index of the attribute used in the regression.
      Returns:
        the index of the attribute.

    - #### getSlope

          public double getSlope()

      Returns the slope of the function.
      Returns:
        the slope.

    - #### getIntercept

          public double getIntercept()

      Returns the intercept of the function.
      Returns:
        the intercept.