public class SimpleLinearRegression extends AbstractClassifier implements WeightedInstancesHandler
-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).
BATCH_SIZE_DEFAULT, NUM_DECIMAL_PLACES_DEFAULT
Constructor and Description |
---|
SimpleLinearRegression() |
Modifier and Type | Method and Description |
---|---|
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.
|
Capabilities |
getCapabilities()
Returns default capabilities of the classifier.
|
double |
getIntercept()
Returns the intercept of the function.
|
java.lang.String[] |
getOptions()
Gets the current settings of the classifier.
|
boolean |
getOutputAdditionalStats()
Get whether to output additional statistics (such as std.
|
java.lang.String |
getRevision()
Returns the revision string.
|
double |
getSlope()
Returns the slope of the function.
|
java.lang.String |
globalInfo()
Returns a string describing this classifier
|
java.util.Enumeration<Option> |
listOptions()
Returns an enumeration describing the available options.
|
static void |
main(java.lang.String[] argv)
Main method for testing this class
|
java.lang.String |
outputAdditionalStatsTipText()
Returns the tip text for this property.
|
void |
setOptions(java.lang.String[] options)
Parses a given list of options.
|
void |
setOutputAdditionalStats(boolean additional)
Set whether to output additional statistics (such as std.
|
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
|
batchSizeTipText, debugTipText, distributionForInstance, distributionsForInstances, doNotCheckCapabilitiesTipText, forName, getBatchSize, getDebug, getDoNotCheckCapabilities, getNumDecimalPlaces, implementsMoreEfficientBatchPrediction, makeCopies, makeCopy, numDecimalPlacesTipText, postExecution, preExecution, run, runClassifier, setBatchSize, setDebug, setDoNotCheckCapabilities, setNumDecimalPlaces
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
makeCopy
public java.lang.String globalInfo()
public java.util.Enumeration<Option> listOptions()
listOptions
in interface OptionHandler
listOptions
in class AbstractClassifier
public void setOptions(java.lang.String[] options) throws java.lang.Exception
-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 stringsjava.lang.Exception
- if an option is not supportedpublic java.lang.String[] getOptions()
getOptions
in interface OptionHandler
getOptions
in class AbstractClassifier
public java.lang.String outputAdditionalStatsTipText()
public void setOutputAdditionalStats(boolean additional)
additional
- true if additional stats are to be outputpublic boolean getOutputAdditionalStats()
public double classifyInstance(Instance inst) throws java.lang.Exception
classifyInstance
in interface Classifier
classifyInstance
in class AbstractClassifier
inst
- the instance to predict.java.lang.Exception
- if an error occurspublic Capabilities getCapabilities()
getCapabilities
in interface Classifier
getCapabilities
in interface CapabilitiesHandler
getCapabilities
in class AbstractClassifier
Capabilities
public void buildClassifier(Instances insts) throws java.lang.Exception
buildClassifier
in interface 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 java.lang.String getRevision()
getRevision
in interface RevisionHandler
getRevision
in class AbstractClassifier
public static void main(java.lang.String[] argv)
argv
- options