public class LinearRegression extends AbstractClassifier implements OptionHandler, WeightedInstancesHandler
-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).
-minimal Conserve memory, don't keep dataset header and means/stdevs. Model cannot be printed out if this option is enabled. (default: keep data)
-additional-stats Output additional statistics.
-output-debug-info If set, classifier is run in debug mode and may output additional info to the console
-do-not-check-capabilities If set, classifier capabilities are not checked before classifier is built (use with caution).
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
|
BATCH_SIZE_DEFAULT, NUM_DECIMAL_PLACES_DEFAULT
Constructor and Description |
---|
LinearRegression() |
Modifier and Type | Method and Description |
---|---|
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.
|
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 |
getEliminateColinearAttributes()
Get the value of EliminateColinearAttributes.
|
boolean |
getMinimal()
Returns whether to be more memory conservative or being able to output the
model as string.
|
String[] |
getOptions()
Gets the current settings of the classifier.
|
boolean |
getOutputAdditionalStats()
Get whether to output additional statistics (such as std.
|
String |
getRevision()
Returns the revision string.
|
double |
getRidge()
Get the value of Ridge.
|
String |
globalInfo()
Returns a string describing this classifier
|
Enumeration<Option> |
listOptions()
Returns an enumeration describing the available options.
|
static void |
main(String[] argv)
Generates a linear regression function predictor.
|
String |
minimalTipText()
Returns the tip text for this property.
|
int |
numParameters()
Get the number of coefficients used in the model
|
String |
outputAdditionalStatsTipText()
Returns the tip text for this property.
|
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 |
setEliminateColinearAttributes(boolean newEliminateColinearAttributes)
Set the value of EliminateColinearAttributes.
|
void |
setMinimal(boolean value)
Sets whether to be more memory conservative or being able to output the
model as string.
|
void |
setOptions(String[] options)
Parses a given list of options.
|
void |
setOutputAdditionalStats(boolean additional)
Set whether to output additional statistics (such as std.
|
void |
setRidge(double newRidge)
Set the value of Ridge.
|
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.
|
batchSizeTipText, debugTipText, distributionForInstance, distributionsForInstances, doNotCheckCapabilitiesTipText, forName, getBatchSize, getDebug, getDoNotCheckCapabilities, getNumDecimalPlaces, implementsMoreEfficientBatchPrediction, makeCopies, makeCopy, numDecimalPlacesTipText, postExecution, preExecution, run, runClassifier, setBatchSize, setDebug, setDoNotCheckCapabilities, setNumDecimalPlaces
public static final int SELECTION_M5
public static final int SELECTION_NONE
public static final int SELECTION_GREEDY
public static final Tag[] TAGS_SELECTION
public static void main(String[] argv)
argv
- the optionspublic String globalInfo()
public Capabilities getCapabilities()
getCapabilities
in interface Classifier
getCapabilities
in interface CapabilitiesHandler
getCapabilities
in class AbstractClassifier
Capabilities
public void buildClassifier(Instances data) throws Exception
buildClassifier
in interface Classifier
data
- the training data to be used for generating the linear
regression functionException
- if the classifier could not be built successfullypublic double classifyInstance(Instance instance) throws Exception
classifyInstance
in interface Classifier
classifyInstance
in class AbstractClassifier
instance
- the test instanceException
- if classification can't be done successfullypublic String toString()
public Enumeration<Option> listOptions()
listOptions
in interface OptionHandler
listOptions
in class AbstractClassifier
public double[] coefficients()
public String[] getOptions()
getOptions
in interface OptionHandler
getOptions
in class AbstractClassifier
public void setOptions(String[] options) throws Exception
-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).
-minimal Conserve memory, don't keep dataset header and means/stdevs. Model cannot be printed out if this option is enabled. (default: keep data)
-additional-stats Output additional statistics.
-output-debug-info If set, classifier is run in debug mode and may output additional info to the console
-do-not-check-capabilities If set, classifier capabilities are not checked before classifier is built (use with caution).
setOptions
in interface OptionHandler
setOptions
in class AbstractClassifier
options
- the list of options as an array of stringsException
- if an option is not supportedpublic String ridgeTipText()
public double getRidge()
public void setRidge(double newRidge)
newRidge
- Value to assign to Ridge.public String eliminateColinearAttributesTipText()
public boolean getEliminateColinearAttributes()
public void setEliminateColinearAttributes(boolean newEliminateColinearAttributes)
newEliminateColinearAttributes
- Value to assign to
EliminateColinearAttributes.public int numParameters()
public String attributeSelectionMethodTipText()
public SelectedTag getAttributeSelectionMethod()
public void setAttributeSelectionMethod(SelectedTag method)
method
- the attribute selection method to use.public String minimalTipText()
public boolean getMinimal()
public void setMinimal(boolean value)
value
- if true memory will be conservedpublic String outputAdditionalStatsTipText()
public boolean getOutputAdditionalStats()
public void setOutputAdditionalStats(boolean additional)
additional
- true if additional stats are to be outputpublic void turnChecksOff()
public void turnChecksOn()
public String getRevision()
getRevision
in interface RevisionHandler
getRevision
in class AbstractClassifier
Copyright © 2016 University of Waikato, Hamilton, NZ. All Rights Reserved.