|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--weka.classifiers.Classifier | +--weka.classifiers.LinearRegression
Class for using linear regression for prediction. Uses the Akaike criterion for model selection, and is able to deal with weighted instances.
Valid options are:
-D
Produce debugging output.
-S num
Set the attriute selection method to use. 1 = None, 2 = Greedy
(default 0 = M5' method)
Field Summary | |
static Tag[] |
TAGS_SELECTION
|
Constructor Summary | |
LinearRegression()
|
Method Summary | |
void |
buildClassifier(Instances data)
Builds a regression model for the given data. |
double |
classifyInstance(Instance instance)
Classifies the given instance using the linear regression function. |
SelectedTag |
getAttributeSelectionMethod()
Gets the method used to select attributes for use in the linear regression. |
boolean |
getDebug()
Controls whether debugging output will be printed |
java.lang.String[] |
getOptions()
Gets the current settings of the classifier. |
java.util.Enumeration |
listOptions()
Returns an enumeration describing the available options |
static void |
main(java.lang.String[] argv)
Generates a linear regression function predictor. |
int |
numParameters()
Get the number of coefficients used in the model |
void |
setAttributeSelectionMethod(SelectedTag method)
Sets the method used to select attributes for use in the linear regression. |
void |
setDebug(boolean debug)
Controls whether debugging output will be printed |
void |
setOptions(java.lang.String[] options)
Parses a given list of options. |
java.lang.String |
toString()
Outputs the linear regression model as a string. |
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 |
Field Detail |
public static final Tag[] TAGS_SELECTION
Constructor Detail |
public LinearRegression()
Method Detail |
public void buildClassifier(Instances data) throws java.lang.Exception
buildClassifier
in class Classifier
data
- the training data to be used for generating the
linear regression functionjava.lang.Exception
- if the classifier could not be built successfullypublic double classifyInstance(Instance instance) throws java.lang.Exception
classifyInstance
in class Classifier
instance
- the test instancejava.lang.Exception
- if classification can't be done successfullypublic java.lang.String toString()
toString
in class java.lang.Object
public java.util.Enumeration listOptions()
listOptions
in interface OptionHandler
public void setOptions(java.lang.String[] options) throws java.lang.Exception
-D
Produce debugging output.
-S num
Set the attriute selection method to use. 1 = None, 2 = Greedy
(default 0 = M5' method)
setOptions
in interface OptionHandler
options
- the list of options as an array of stringsjava.lang.Exception
- if an option is not supportedpublic java.lang.String[] getOptions()
getOptions
in interface OptionHandler
public int numParameters()
public void setAttributeSelectionMethod(SelectedTag method)
method
- the attribute selection method to use.public SelectedTag getAttributeSelectionMethod()
public void setDebug(boolean debug)
debug
- true if debugging output should be printedpublic boolean getDebug()
debug
- true if debugging output should be printedpublic static void main(java.lang.String[] argv)
String
- the options
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |