weka.classifiers.functions
Class UnivariateLinearRegression

java.lang.Object
  extended byweka.classifiers.Classifier
      extended byweka.classifiers.functions.UnivariateLinearRegression
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable, WeightedInstancesHandler

public class UnivariateLinearRegression
extends Classifier
implements WeightedInstancesHandler

Class for learning a univariate linear regression model. Picks the attribute that results in the lowest squared error. Missing values are not allowed. Can only deal with numeric attributes.

See Also:
Serialized Form

Constructor Summary
UnivariateLinearRegression()
           
 
Method Summary
 void buildClassifier(Instances insts)
          Generates a classifier.
 double classifyInstance(Instance inst)
          Classifies a given instance.
static void main(java.lang.String[] argv)
          Main method for testing this class
 java.lang.String toString()
           
 
Methods inherited from class weka.classifiers.Classifier
forName, makeCopies
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UnivariateLinearRegression

public UnivariateLinearRegression()
Method Detail

classifyInstance

public double classifyInstance(Instance inst)
                        throws java.lang.Exception
Description copied from class: Classifier
Classifies a given instance.

Specified by:
classifyInstance in class Classifier
Parameters:
inst - the instance to be classified
Returns:
index of the predicted class as a double if the class is nominal, otherwise the predicted value
Throws:
java.lang.Exception - if instance could not be classified successfully

buildClassifier

public void buildClassifier(Instances insts)
                     throws java.lang.Exception
Description copied from class: Classifier
Generates a classifier. Must initialize all fields of the classifier that are not being set via options (ie. multiple calls of buildClassifier must always lead to the same result). Must not change the dataset in any way.

Specified by:
buildClassifier in class Classifier
Parameters:
insts - set of instances serving as training data
Throws:
java.lang.Exception - if the classifier has not been generated successfully

toString

public java.lang.String toString()

main

public static void main(java.lang.String[] argv)
Main method for testing this class

Parameters:
argv - options