weka.classifiers.functions
Class UnivariateLinearRegression
java.lang.Object
weka.classifiers.Classifier
weka.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
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
UnivariateLinearRegression
public UnivariateLinearRegression()
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