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.WeightedInstancesHandler
RandomRegressionForest: 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 class
RandomRegressionForest.Node
TODO: description of class
-
Field Summary
Fields Modifier and Type Field Description protected weka.core.Instances
m_Data
the original headerprotected double
m_Mean
the meanprotected int
m_Min
the minimum number of instances in subsetsprotected RandomRegressionForest.Node[]
m_Node
the generated nodesprotected int
m_NumIterations
The number of iterations.protected int
m_PLS
the number of components to use in PLSprotected weka.filters.supervised.attribute.PLSFilter
m_PLSFilter
the 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 void
buildClassifier(weka.core.Instances data)
builds the classifierprotected weka.core.Instances
centerClass(weka.core.Instances data)
Centers the class value in the data.double
classifyInstance(weka.core.Instance instance)
Calculates the class membership probabilities for the given test instance.weka.core.Capabilities
getCapabilities()
Returns default capabilities of the classifier.int
getMin()
Gets the current leaf threshold.int
getNumIterations()
Gets the number of iterationsString[]
getOptions()
Gets the current settings of the Classifier.int
getPLS()
Gets the current number of PLS components to generate.String
getRevision()
String
globalInfo()
Returns a string describing this classifier.Enumeration
listOptions()
Returns an enumeration describing the available options.static void
main(String[] args)
Main method for testing this class.String
minTipText()
Returns the tip text for this propertyString
numIterationsTipText()
Returns the tip text for this propertyString
PLSTipText()
Returns the tip text for this propertyvoid
setMin(int value)
Sets the leaf threshold.void
setNumIterations(int value)
Sets the number of iterationsvoid
setOptions(String[] options)
Parses a given list of options.void
setPLS(int value)
Sets the number of PLS components to generate.String
toString()
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:
listOptions
in interfaceweka.core.OptionHandler
- Overrides:
listOptions
in 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:
setOptions
in interfaceweka.core.OptionHandler
- Overrides:
setOptions
in 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:
getOptions
in interfaceweka.core.OptionHandler
- Overrides:
getOptions
in 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:
getCapabilities
in interfaceweka.core.CapabilitiesHandler
- Specified by:
getCapabilities
in interfaceweka.classifiers.Classifier
- Overrides:
getCapabilities
in classweka.classifiers.AbstractClassifier
- Returns:
- the capabilities of this classifier
-
buildClassifier
public void buildClassifier(weka.core.Instances data) throws Exception
builds the classifier- Specified by:
buildClassifier
in 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 Exception
Calculates the class membership probabilities for the given test instance.- Specified by:
classifyInstance
in interfaceweka.classifiers.Classifier
- Overrides:
classifyInstance
in 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:
getRevision
in interfaceweka.core.RevisionHandler
- Overrides:
getRevision
in classweka.classifiers.AbstractClassifier
-
-