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).
| Constructor and Description |
|---|
SimpleLinearRegression()
Default constructor.
|
SimpleLinearRegression(Instances data,
int attIndex,
double slope,
double intercept)
Construct a simple linear regression model based on the given info.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addModel(SimpleLinearRegression slr)
Takes the given simple linear regression model and adds it to this one.
|
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.
|
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 |
getSlope()
Returns the slope of the function.
|
String |
globalInfo()
Returns a string describing this classifier
|
Enumeration<Option> |
listOptions()
Returns an enumeration describing the available options.
|
static void |
main(String[] argv)
Main method for testing this class
|
String |
outputAdditionalStatsTipText()
Returns the tip text for this property.
|
void |
setOptions(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.
|
String |
toString()
Returns a description of this classifier as a string
|
debugTipText, distributionForInstance, doNotCheckCapabilitiesTipText, forName, getDebug, getDoNotCheckCapabilities, makeCopies, makeCopy, runClassifier, setDebug, setDoNotCheckCapabilitiespublic SimpleLinearRegression()
public SimpleLinearRegression(Instances data, int attIndex, double slope, double intercept)
public String globalInfo()
public Enumeration<Option> listOptions()
listOptions in interface OptionHandlerlistOptions in class AbstractClassifierpublic void setOptions(String[] options) throws 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 OptionHandlersetOptions in class AbstractClassifieroptions - the list of options as an array of stringsException - if an option is not supportedpublic String[] getOptions()
getOptions in interface OptionHandlergetOptions in class AbstractClassifierpublic String outputAdditionalStatsTipText()
public void setOutputAdditionalStats(boolean additional)
additional - true if additional stats are to be outputpublic boolean getOutputAdditionalStats()
public void addModel(SimpleLinearRegression slr) throws Exception
Exceptionpublic double classifyInstance(Instance inst) throws Exception
classifyInstance in interface ClassifierclassifyInstance in class AbstractClassifierinst - the instance to predict.Exception - if an error occurspublic Capabilities getCapabilities()
getCapabilities in interface ClassifiergetCapabilities in interface CapabilitiesHandlergetCapabilities in class AbstractClassifierCapabilitiespublic void buildClassifier(Instances insts) throws Exception
buildClassifier in interface Classifierinsts - the training data.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 String toString()
public String getRevision()
getRevision in interface RevisionHandlergetRevision in class AbstractClassifierpublic static void main(String[] argv)
argv - optionsCopyright © 2014 University of Waikato, Hamilton, NZ. All Rights Reserved.