public class AdditiveRegression extends IteratedSingleClassifierEnhancer implements OptionHandler, AdditionalMeasureProducer, WeightedInstancesHandler, TechnicalInformationHandler, IterativeClassifier
@techreport{Friedman1999, author = {J.H. Friedman}, institution = {Stanford University}, title = {Stochastic Gradient Boosting}, year = {1999}, PS = {http://www-stat.stanford.edu/\~jhf/ftp/stobst.ps} }Valid options are:
-S Specify shrinkage rate. (default = 1.0, ie. no shrinkage)
-I <num> Number of iterations. (default 10)
-A Minimize absolute error instead of squared error (assumes that base learner minimizes absolute error).-D If set, classifier is run in debug mode and may output additional info to the console-W Full name of base classifier. (default: weka.classifiers.trees.DecisionStump)Options specific to classifier weka.classifiers.trees.DecisionStump:-D If set, classifier is run in debug mode and may output additional info to the console
BATCH_SIZE_DEFAULT, NUM_DECIMAL_PLACES_DEFAULT
Constructor and Description |
---|
AdditiveRegression()
Default constructor specifying DecisionStump as the classifier
|
AdditiveRegression(Classifier classifier)
Constructor which takes base classifier as argument.
|
Modifier and Type | Method and Description |
---|---|
void |
buildClassifier(Instances data)
Method used to build the classifier.
|
double |
classifyInstance(Instance inst)
Classify an instance.
|
void |
done()
Clean up.
|
java.util.Enumeration<java.lang.String> |
enumerateMeasures()
Returns an enumeration of the additional measure names
|
Capabilities |
getCapabilities()
Returns default capabilities of the classifier.
|
double |
getMeasure(java.lang.String additionalMeasureName)
Returns the value of the named measure
|
boolean |
getMinimizeAbsoluteError()
Gets whether absolute error is to be minimized.
|
java.lang.String[] |
getOptions()
Gets the current settings of the Classifier.
|
boolean |
getResume()
Returns true if the model is to be finalized (or has been finalized) after
training.
|
java.lang.String |
getRevision()
Returns the revision string.
|
double |
getShrinkage()
Get the shrinkage rate.
|
TechnicalInformation |
getTechnicalInformation()
Returns an instance of a TechnicalInformation object, containing
detailed information about the technical background of this class,
e.g., paper reference or book this class is based on.
|
java.lang.String |
globalInfo()
Returns a string describing this attribute evaluator
|
void |
initializeClassifier(Instances data)
Initialize 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.
|
double |
measureNumIterations()
return the number of iterations (base classifiers) completed
|
java.lang.String |
minimizeAbsoluteErrorTipText()
Returns the tip text for this property
|
boolean |
next()
Perform another iteration.
|
java.lang.String |
resumeTipText()
Tool tip text for the resume property
|
void |
setMinimizeAbsoluteError(boolean f)
Sets whether absolute error is to be minimized.
|
void |
setOptions(java.lang.String[] options)
Parses a given list of options.
|
void |
setResume(boolean resume)
If called with argument true, then the next time done() is called the model is effectively
"frozen" and no further iterations can be performed
|
void |
setShrinkage(double l)
Set the shrinkage parameter
|
java.lang.String |
shrinkageTipText()
Returns the tip text for this property
|
java.lang.String |
toString()
Returns textual description of the classifier.
|
getNumIterations, numIterationsTipText, setNumIterations
classifierTipText, getClassifier, postExecution, preExecution, setClassifier
batchSizeTipText, debugTipText, distributionForInstance, distributionsForInstances, doNotCheckCapabilitiesTipText, forName, getBatchSize, getDebug, getDoNotCheckCapabilities, getNumDecimalPlaces, implementsMoreEfficientBatchPrediction, makeCopies, makeCopy, numDecimalPlacesTipText, run, runClassifier, setBatchSize, setDebug, setDoNotCheckCapabilities, setNumDecimalPlaces
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
makeCopy
distributionForInstance
public AdditiveRegression()
public AdditiveRegression(Classifier classifier)
classifier
- the base classifier to usepublic java.lang.String globalInfo()
public TechnicalInformation getTechnicalInformation()
getTechnicalInformation
in interface TechnicalInformationHandler
public java.util.Enumeration<Option> listOptions()
listOptions
in interface OptionHandler
listOptions
in class IteratedSingleClassifierEnhancer
public void setOptions(java.lang.String[] options) throws java.lang.Exception
-S Specify shrinkage rate. (default = 1.0, ie. no shrinkage)
-I <num> Number of iterations. (default 10)
-A Minimize absolute error instead of squared error (assumes that base learner minimizes absolute error).-D If set, classifier is run in debug mode and may output additional info to the console-W Full name of base classifier. (default: weka.classifiers.trees.DecisionStump)Options specific to classifier weka.classifiers.trees.DecisionStump:-D If set, classifier is run in debug mode and may output additional info to the console
setOptions
in interface OptionHandler
setOptions
in class IteratedSingleClassifierEnhancer
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 IteratedSingleClassifierEnhancer
public java.lang.String shrinkageTipText()
public void setShrinkage(double l)
l
- the shrinkage rate.public double getShrinkage()
public java.lang.String minimizeAbsoluteErrorTipText()
public void setMinimizeAbsoluteError(boolean f)
f
- true if absolute error is to be minimized.public boolean getMinimizeAbsoluteError()
public java.lang.String resumeTipText()
public void setResume(boolean resume)
setResume
in interface IterativeClassifier
resume
- true if the model is to be finalized after performing iterationspublic boolean getResume()
getResume
in interface IterativeClassifier
public Capabilities getCapabilities()
getCapabilities
in interface Classifier
getCapabilities
in interface CapabilitiesHandler
getCapabilities
in class SingleClassifierEnhancer
Capabilities
public void buildClassifier(Instances data) throws java.lang.Exception
buildClassifier
in interface Classifier
buildClassifier
in class IteratedSingleClassifierEnhancer
data
- the training data to be used for generating the
bagged classifier.java.lang.Exception
- if the classifier could not be built successfullypublic void initializeClassifier(Instances data) throws java.lang.Exception
initializeClassifier
in interface IterativeClassifier
data
- the training datajava.lang.Exception
- if the classifier could not be initialized successfullypublic boolean next() throws java.lang.Exception
next
in interface IterativeClassifier
java.lang.Exception
- if this iteration fails for unexpected reasonspublic void done()
done
in interface IterativeClassifier
public double classifyInstance(Instance inst) throws java.lang.Exception
classifyInstance
in interface Classifier
classifyInstance
in class AbstractClassifier
inst
- the instance to predictjava.lang.Exception
- if an error occurspublic java.util.Enumeration<java.lang.String> enumerateMeasures()
enumerateMeasures
in interface AdditionalMeasureProducer
public double getMeasure(java.lang.String additionalMeasureName)
getMeasure
in interface AdditionalMeasureProducer
additionalMeasureName
- the name of the measure to query for its valuejava.lang.IllegalArgumentException
- if the named measure is not supportedpublic double measureNumIterations()
public 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
- should contain the following arguments:
-t training file [-T test file] [-c class index]