|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectweka.classifiers.Classifier
weka.classifiers.meta.AdditiveRegression
Meta classifier that enhances the performance of a regression base classifier. Each iteration fits a model to the residuals left by the classifier on the previous iteration. Prediction is accomplished by adding the predictions of each classifier. Smoothing is accomplished through varying the shrinkage (learning rate) parameter.
For more information see:
Friedman, J.H. (1999). Stochastic Gradient Boosting. Technical Report Stanford University. http://www-stat.stanford.edu/~jhf/ftp/stobst.ps.
Valid options from the command line are:
-W classifierstring
Classifierstring should contain the full class name of a classifier
followed by options to the classifier.
(required).
-S shrinkage rate
Smaller values help prevent overfitting and have a smoothing effect
(but increase learning time).
(default = 1.0, ie no shrinkage).
-M max models
Set the maximum number of models to generate. Values <= 0 indicate
no maximum, ie keep going until the reduction in error threshold is
reached.
(default = 10).
-D
Debugging output.
Field Summary | |
private FastVector |
m_additiveModels
The list of iteratively generated models. |
protected Classifier |
m_Classifier
Base classifier. |
private int |
m_classIndex
Class index. |
private boolean |
m_debug
Produce debugging output. |
protected int |
m_maxModels
Maximum number of models to produce. -1 indicates keep going until the error threshold is met. |
protected double |
m_shrinkage
Shrinkage (Learning rate). |
Fields inherited from class weka.classifiers.Classifier |
m_Debug |
Constructor Summary | |
AdditiveRegression()
Default constructor specifying DecisionStump as the classifier |
|
AdditiveRegression(Classifier classifier)
Constructor which takes base classifier as argument. |
Method Summary | |
void |
buildClassifier(Instances data)
Build the classifier on the supplied data |
java.lang.String |
classifierTipText()
Returns the tip text for this property |
double |
classifyInstance(Instance inst)
Classify an instance. |
java.lang.String |
debugTipText()
Returns the tip text for this property |
java.util.Enumeration |
enumerateMeasures()
Returns an enumeration of the additional measure names |
Classifier |
getClassifier()
Gets the classifier used. |
protected java.lang.String |
getClassifierSpec()
Gets the classifier specification string, which contains the class name of the classifier and any options to the classifier |
boolean |
getDebug()
Gets whether debugging has been turned on |
int |
getMaxModels()
Get the max number of models to generate |
double |
getMeasure(java.lang.String additionalMeasureName)
Returns the value of the named measure |
java.lang.String[] |
getOptions()
Gets the current settings of the Classifier. |
double |
getShrinkage()
Get the shrinkage rate. |
java.lang.String |
globalInfo()
Returns a string describing this attribute evaluator |
java.util.Enumeration |
listOptions()
Returns an enumeration describing the available options. |
static void |
main(java.lang.String[] argv)
Main method for testing this class. |
java.lang.String |
maxModelsTipText()
Returns the tip text for this property |
double |
measureNumIterations()
return the number of iterations (base classifiers) completed |
private Instances |
residualReplace(Instances data,
Classifier c,
boolean useShrinkage)
Replace the class values of the instances from the current iteration with residuals ater predicting with the supplied classifier. |
void |
setClassifier(Classifier classifier)
Sets the classifier |
void |
setDebug(boolean d)
Set whether debugging output is produced. |
void |
setMaxModels(int maxM)
Set the maximum number of models to generate |
void |
setOptions(java.lang.String[] options)
Parses a given list of options. |
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. |
Methods inherited from class weka.classifiers.Classifier |
distributionForInstance, forName, makeCopies |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected Classifier m_Classifier
private int m_classIndex
protected double m_shrinkage
private FastVector m_additiveModels
private boolean m_debug
protected int m_maxModels
Constructor Detail |
public AdditiveRegression()
public AdditiveRegression(Classifier classifier)
classifier
- the base classifier to useMethod Detail |
public java.lang.String globalInfo()
public java.util.Enumeration listOptions()
listOptions
in interface OptionHandler
listOptions
in class Classifier
public void setOptions(java.lang.String[] options) throws java.lang.Exception
-W classifierstring
Classifierstring should contain the full class name of a classifier
followed by options to the classifier.
(required).
-S shrinkage rate
Smaller values help prevent overfitting and have a smoothing effect
(but increase learning time).
(default = 1.0, ie. no shrinkage).
-D
Debugging output.
-M max models
Set the maximum number of models to generate. Values <= 0 indicate
no maximum, ie keep going until the reduction in error threshold is
reached.
(default = 10).
setOptions
in interface OptionHandler
setOptions
in class Classifier
options
- the list of options as an array of strings
java.lang.Exception
- if an option is not supportedpublic java.lang.String[] getOptions()
getOptions
in interface OptionHandler
getOptions
in class Classifier
public java.lang.String debugTipText()
debugTipText
in class Classifier
public void setDebug(boolean d)
setDebug
in class Classifier
d
- true if debugging output is to be producedpublic boolean getDebug()
getDebug
in class Classifier
public java.lang.String classifierTipText()
public void setClassifier(Classifier classifier)
classifier
- the classifier with all options set.public Classifier getClassifier()
protected java.lang.String getClassifierSpec()
public java.lang.String maxModelsTipText()
public void setMaxModels(int maxM)
maxM
- the maximum number of modelspublic int getMaxModels()
public java.lang.String shrinkageTipText()
public void setShrinkage(double l)
l
- the shrinkage rate.public double getShrinkage()
public void buildClassifier(Instances data) throws java.lang.Exception
buildClassifier
in class Classifier
data
- the training data
java.lang.Exception
- if the classifier could not be built successfullypublic double classifyInstance(Instance inst) throws java.lang.Exception
classifyInstance
in class Classifier
inst
- the instance to predict
java.lang.Exception
- if an error occursprivate Instances residualReplace(Instances data, Classifier c, boolean useShrinkage) throws java.lang.Exception
data
- the instances to predictc
- the classifier to useuseShrinkage
- whether shrinkage is to be applied to the model's output
java.lang.Exception
public java.util.Enumeration 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 value
java.lang.IllegalArgumentException
- if the named measure is not supportedpublic double measureNumIterations()
public java.lang.String toString()
public static void main(java.lang.String[] argv)
argv
- should contain the following arguments:
-t training file [-T test file] [-c class index]
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |