Package weka.classifiers.trees
Class RandomRegressionForest
- java.lang.Object
-
- weka.classifiers.AbstractClassifier
-
- weka.classifiers.RandomizableClassifier
-
- weka.classifiers.trees.RandomRegressionForest
-
- All Implemented Interfaces:
Serializable,Cloneable,weka.classifiers.Classifier,weka.core.BatchPredictor,weka.core.CapabilitiesHandler,weka.core.CapabilitiesIgnorer,weka.core.CommandlineRunnable,weka.core.OptionHandler,weka.core.Randomizable,weka.core.RevisionHandler,weka.core.WeightedInstancesHandler
public class RandomRegressionForest extends weka.classifiers.RandomizableClassifier implements weka.core.WeightedInstancesHandlerRandomRegressionForest: subtract mean and pls, then grow completely random trees (leaf: min .. 2min).
plus local regression models (-S 1 -C), min >> numPLScomps
Valid options are:
-N <num> Number of trees. (default 100)
-M <num> Leaf threshold. (default 100)
-C <num> Number of PLS components. (default 20)
-S <num> Random number seed. (default 1)
-D If set, classifier is run in debug mode and may output additional info to the console
- Version:
- $Revision$
- Author:
- Bernhard Pfahringer (bernhard at cs dot waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classRandomRegressionForest.NodeTODO: description of class
-
Field Summary
Fields Modifier and Type Field Description protected weka.core.Instancesm_Datathe original headerprotected doublem_Meanthe meanprotected intm_Minthe minimum number of instances in subsetsprotected RandomRegressionForest.Node[]m_Nodethe generated nodesprotected intm_NumIterationsThe number of iterations.protected intm_PLSthe number of components to use in PLSprotected weka.filters.supervised.attribute.PLSFilterm_PLSFilterthe PLS filter used internally
-
Constructor Summary
Constructors Constructor Description RandomRegressionForest()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbuildClassifier(weka.core.Instances data)builds the classifierprotected weka.core.InstancescenterClass(weka.core.Instances data)Centers the class value in the data.doubleclassifyInstance(weka.core.Instance instance)Calculates the class membership probabilities for the given test instance.weka.core.CapabilitiesgetCapabilities()Returns default capabilities of the classifier.intgetMin()Gets the current leaf threshold.intgetNumIterations()Gets the number of iterationsString[]getOptions()Gets the current settings of the Classifier.intgetPLS()Gets the current number of PLS components to generate.StringgetRevision()StringglobalInfo()Returns a string describing this classifier.EnumerationlistOptions()Returns an enumeration describing the available options.static voidmain(String[] args)Main method for testing this class.StringminTipText()Returns the tip text for this propertyStringnumIterationsTipText()Returns the tip text for this propertyStringPLSTipText()Returns the tip text for this propertyvoidsetMin(int value)Sets the leaf threshold.voidsetNumIterations(int value)Sets the number of iterationsvoidsetOptions(String[] options)Parses a given list of options.voidsetPLS(int value)Sets the number of PLS components to generate.StringtoString()Returns description of the classifier.-
Methods inherited from class weka.classifiers.AbstractClassifier
batchSizeTipText, debugTipText, distributionForInstance, distributionsForInstances, doNotCheckCapabilitiesTipText, forName, getBatchSize, getDebug, getDoNotCheckCapabilities, getNumDecimalPlaces, implementsMoreEfficientBatchPrediction, makeCopies, makeCopy, numDecimalPlacesTipText, postExecution, preExecution, run, runClassifier, setBatchSize, setDebug, setDoNotCheckCapabilities, setNumDecimalPlaces
-
-
-
-
Field Detail
-
m_Node
protected RandomRegressionForest.Node[] m_Node
the generated nodes
-
m_NumIterations
protected int m_NumIterations
The number of iterations.
-
m_PLS
protected int m_PLS
the number of components to use in PLS
-
m_Min
protected int m_Min
the minimum number of instances in subsets
-
m_Data
protected weka.core.Instances m_Data
the original header
-
m_PLSFilter
protected weka.filters.supervised.attribute.PLSFilter m_PLSFilter
the PLS filter used internally
-
m_Mean
protected double m_Mean
the mean
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing this classifier.- Returns:
- a description of the classifier suitable for displaying in the explorer/experimenter gui
-
listOptions
public Enumeration listOptions()
Returns an enumeration describing the available options.- Specified by:
listOptionsin interfaceweka.core.OptionHandler- Overrides:
listOptionsin classweka.classifiers.RandomizableClassifier- Returns:
- an enumeration of all the available options.
-
setOptions
public void setOptions(String[] options) throws Exception
Parses a given list of options.
Valid options are:
-N <num> Number of trees. (default 100)
-M <num> Leaf threshold. (default 100)
-C <num> Number of PLS components. (default 20)
-S <num> Random number seed. (default 1)
-D If set, classifier is run in debug mode and may output additional info to the console
- Specified by:
setOptionsin interfaceweka.core.OptionHandler- Overrides:
setOptionsin classweka.classifiers.RandomizableClassifier- Parameters:
options- the list of options as an array of strings- Throws:
Exception- if an option is not supported
-
getOptions
public String[] getOptions()
Gets the current settings of the Classifier.- Specified by:
getOptionsin interfaceweka.core.OptionHandler- Overrides:
getOptionsin classweka.classifiers.RandomizableClassifier- Returns:
- an array of strings suitable for passing to setOptions
-
numIterationsTipText
public String numIterationsTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setNumIterations
public void setNumIterations(int value)
Sets the number of iterations- Parameters:
value- the number of iterations to use
-
getNumIterations
public int getNumIterations()
Gets the number of iterations- Returns:
- the maximum number of iterations
-
minTipText
public String minTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setMin
public void setMin(int value)
Sets the leaf threshold.- Parameters:
value- the new leaf threshold
-
getMin
public int getMin()
Gets the current leaf threshold.- Returns:
- the current leaf threshold
-
PLSTipText
public String PLSTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setPLS
public void setPLS(int value)
Sets the number of PLS components to generate.- Parameters:
value- the number of PLS components
-
getPLS
public int getPLS()
Gets the current number of PLS components to generate.- Returns:
- the current number of PLS components
-
centerClass
protected weka.core.Instances centerClass(weka.core.Instances data)
Centers the class value in the data.- Parameters:
data- the data to work on- Returns:
- the modified data
-
getCapabilities
public weka.core.Capabilities getCapabilities()
Returns default capabilities of the classifier.- Specified by:
getCapabilitiesin interfaceweka.core.CapabilitiesHandler- Specified by:
getCapabilitiesin interfaceweka.classifiers.Classifier- Overrides:
getCapabilitiesin classweka.classifiers.AbstractClassifier- Returns:
- the capabilities of this classifier
-
buildClassifier
public void buildClassifier(weka.core.Instances data) throws Exceptionbuilds the classifier- Specified by:
buildClassifierin interfaceweka.classifiers.Classifier- Parameters:
data- the training data to be used for generating the- Throws:
Exception- if the classifier could not be built successfully
-
classifyInstance
public double classifyInstance(weka.core.Instance instance) throws ExceptionCalculates the class membership probabilities for the given test instance.- Specified by:
classifyInstancein interfaceweka.classifiers.Classifier- Overrides:
classifyInstancein classweka.classifiers.AbstractClassifier- Parameters:
instance- the instance to be classified- Returns:
- preedicted class probability distribution
- Throws:
Exception- if distribution can't be computed successfully
-
toString
public String toString()
Returns description of the classifier.
-
main
public static void main(String[] args)
Main method for testing this class.- Parameters:
args- the options
-
getRevision
public String getRevision()
- Specified by:
getRevisionin interfaceweka.core.RevisionHandler- Overrides:
getRevisionin classweka.classifiers.AbstractClassifier
-
-