public class LinearRegression extends Classifier implements OptionHandler, WeightedInstancesHandler
-D Produce debugging output. (default no debugging output)
-S <number of selection method> Set the attribute selection method to use. 1 = None, 2 = Greedy. (default 0 = M5' method)
-C Do not try to eliminate colinear attributes.
-R <double> Set ridge parameter (default 1.0e-8).
| Modifier and Type | Field and Description |
|---|---|
static int |
SELECTION_GREEDY
Attribute selection method: Greedy method
|
static int |
SELECTION_M5
Attribute selection method: M5 method
|
static int |
SELECTION_NONE
Attribute selection method: No attribute selection
|
static Tag[] |
TAGS_SELECTION
Attribute selection methods
|
| Constructor and Description |
|---|
LinearRegression () |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
attributeSelectionMethodTipText ()
Returns the tip text for this property
|
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.
|
double[] |
coefficients ()
Returns the coefficients for this linear model.
|
java.lang.String |
debugTipText ()
Returns the tip text for this property
|
java.lang.String |
eliminateColinearAttributesTipText ()
Returns the tip text for this property
|
SelectedTag |
getAttributeSelectionMethod ()
Gets the method used to select attributes for use in the
linear regression.
|
Capabilities |
getCapabilities ()
Returns default capabilities of the classifier.
|
boolean |
getDebug ()
Controls whether debugging output will be printed
|
boolean |
getEliminateColinearAttributes ()
Get the value of EliminateColinearAttributes.
|
java.lang.String[] |
getOptions ()
Gets the current settings of the classifier.
|
java.lang.String |
getRevision ()
Returns the revision string.
|
double |
getRidge ()
Get the value of Ridge.
|
java.lang.String |
globalInfo ()
Returns a string describing this 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
|
java.lang.String |
ridgeTipText ()
Returns the tip text for this property
|
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 |
setEliminateColinearAttributes (boolean newEliminateColinearAttributes)
Set the value of EliminateColinearAttributes.
|
void |
setOptions (java.lang.String[] options)
Parses a given list of options.
|
void |
setRidge (double newRidge)
Set the value of Ridge.
|
java.lang.String |
toString ()
Outputs the linear regression model as a string.
|
void |
turnChecksOff ()
Turns off checks for missing values, etc.
|
void |
turnChecksOn ()
Turns on checks for missing values, etc.
|
distributionForInstance, forName, makeCopies, makeCopy equals, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic static final int SELECTION_M5
public static final int SELECTION_NONE
public static final int SELECTION_GREEDY
public static final Tag[] TAGS_SELECTION
public LinearRegression()
public void turnChecksOff()
public void turnChecksOn()
public java.lang.String globalInfo()
public Capabilities getCapabilities()
getCapabilities in interface CapabilitiesHandler getCapabilities in class Classifier Capabilities 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.Objectpublic java.util.Enumeration listOptions()
listOptions in interface OptionHandler listOptions in class Classifier public void setOptions(java.lang.String[] options) throws java.lang.Exception
-D Produce debugging output. (default no debugging output)
-S <number of selection method> Set the attribute selection method to use. 1 = None, 2 = Greedy. (default 0 = M5' method)
-C Do not try to eliminate colinear attributes.
-R <double> Set ridge parameter (default 1.0e-8).
setOptions in interface OptionHandler setOptions in class Classifier options - the list of options as an array of stringsjava.lang.Exception - if an option is not supportedpublic double[] coefficients()
public java.lang.String[] getOptions()
getOptions in interface OptionHandler getOptions in class Classifier public java.lang.String ridgeTipText()
public double getRidge()
public void setRidge(double newRidge)
newRidge - Value to assign to Ridge.public java.lang.String eliminateColinearAttributesTipText()
public boolean getEliminateColinearAttributes()
public void setEliminateColinearAttributes(boolean newEliminateColinearAttributes)
newEliminateColinearAttributes - Value to assign to EliminateColinearAttributes.public int numParameters()
public java.lang.String attributeSelectionMethodTipText()
public void setAttributeSelectionMethod(SelectedTag method)
method - the attribute selection method to use.public SelectedTag getAttributeSelectionMethod()
public java.lang.String debugTipText()
debugTipText in class Classifier public void setDebug(boolean debug)
setDebug in class Classifier debug - true if debugging output should be printedpublic boolean getDebug()
getDebug in class Classifier public java.lang.String getRevision()
getRevision in interface RevisionHandler getRevision in class Classifier public static void main(java.lang.String[] argv)
argv - the options