|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--weka.classifiers.Classifier | +--weka.classifiers.functions.SimpleLinearRegression
Class for learning a simple linear regression model. Picks the attribute that results in the lowest squared error. Missing values are not allowed. Can only deal with numeric attributes.
Constructor Summary | |
SimpleLinearRegression()
|
Method Summary | |
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. |
java.lang.String |
globalInfo()
Returns a string describing this classifier |
static void |
main(java.lang.String[] argv)
Main method for testing this class |
void |
setSuppressErrorMessage(boolean s)
Turn off the error message that is reported when no useful attribute is found. |
java.lang.String |
toString()
Returns a description of this classifier as a string |
Methods inherited from class weka.classifiers.Classifier |
debugTipText, distributionForInstance, forName, getDebug, getOptions, listOptions, makeCopies, setDebug, setOptions |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public SimpleLinearRegression()
Method Detail |
public java.lang.String globalInfo()
public double classifyInstance(Instance inst) throws java.lang.Exception
classifyInstance
in class Classifier
inst
- the instance to predict.
java.lang.Exception
- if an error occurspublic void buildClassifier(Instances insts) throws java.lang.Exception
buildClassifier
in class Classifier
insts
- the training data.
java.lang.Exception
- if an error occurspublic boolean foundUsefulAttribute()
public int getAttributeIndex()
public double getSlope()
public double getIntercept()
public void setSuppressErrorMessage(boolean s)
s
- if set to true turns off the error messagepublic java.lang.String toString()
toString
in class java.lang.Object
public static void main(java.lang.String[] argv)
argv
- options
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright (c) 2003 David Lindsay, Computer Learning Research Centre, Dept. Computer Science, Royal Holloway, University of London