类 RandomForest
java.lang.Object
weka.classifiers.Classifier
weka.classifiers.trees.RandomForest
- 所有已实现的接口:
Serializable
,Cloneable
,AdditionalMeasureProducer
,CapabilitiesHandler
,OptionHandler
,Randomizable
,RevisionHandler
,TechnicalInformationHandler
,WeightedInstancesHandler
public class RandomForest
extends Classifier
implements OptionHandler, Randomizable, WeightedInstancesHandler, AdditionalMeasureProducer, TechnicalInformationHandler
Class for constructing a forest of random trees.
For more information see:
Leo Breiman (2001). Random Forests. Machine Learning. 45(1):5-32. BibTeX:
For more information see:
Leo Breiman (2001). Random Forests. Machine Learning. 45(1):5-32. BibTeX:
@article{Breiman2001, author = {Leo Breiman}, journal = {Machine Learning}, number = {1}, pages = {5-32}, title = {Random Forests}, volume = {45}, year = {2001} }Valid options are:
-I <number of trees> Number of trees to build.
-K <number of features> Number of features to consider (<0 = int(log_2(#predictors)+1)).
-S Seed for random number generator. (default 1)
-depth <num> The maximum depth of the trees, 0 for unlimited. (default 0)
-D If set, classifier is run in debug mode and may output additional info to the console
- 版本:
- $Revision: 1.13 $
- 作者:
- Richard Kirkby (rkirkby@cs.waikato.ac.nz)
- 另请参阅:
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明void
buildClassifier
(Instances data) Builds a classifier for a set of instances.double[]
distributionForInstance
(Instance instance) Returns the class probability distribution for an instance.Returns an enumeration of the additional measure names.Returns default capabilities of the classifier.int
Get the maximum depth of trh tree, 0 for unlimited.double
getMeasure
(String additionalMeasureName) Returns the value of the named measure.int
Get the number of features used in random selection.int
Get the value of numTrees.String[]
Gets the current settings of the forest.Returns the revision string.int
getSeed()
Gets the seed for the random number generationsReturns 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.Returns a string describing classifierReturns an enumeration describing the available options.static void
Main method for this class.Returns the tip text for this propertydouble
Gets the out of bag error that was calculated as the classifier was built.Returns the tip text for this propertyReturns the tip text for this propertyReturns the tip text for this propertyvoid
setMaxDepth
(int value) Set the maximum depth of the tree, 0 for unlimited.void
setNumFeatures
(int newNumFeatures) Set the number of features to use in random selection.void
setNumTrees
(int newNumTrees) Set the value of numTrees.void
setOptions
(String[] options) Parses a given list of options.void
setSeed
(int seed) Set the seed for random number generation.toString()
Outputs a description of this classifier.从类继承的方法 weka.classifiers.Classifier
classifyInstance, debugTipText, forName, getDebug, makeCopies, makeCopy, setDebug
-
构造器详细资料
-
RandomForest
public RandomForest()
-
-
方法详细资料
-
globalInfo
Returns a string describing classifier- 返回:
- a description suitable for displaying in the explorer/experimenter gui
-
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.- 指定者:
getTechnicalInformation
在接口中TechnicalInformationHandler
- 返回:
- the technical information about this class
-
numTreesTipText
Returns the tip text for this property- 返回:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
getNumTrees
public int getNumTrees()Get the value of numTrees.- 返回:
- Value of numTrees.
-
setNumTrees
public void setNumTrees(int newNumTrees) Set the value of numTrees.- 参数:
newNumTrees
- Value to assign to numTrees.
-
numFeaturesTipText
Returns the tip text for this property- 返回:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
getNumFeatures
public int getNumFeatures()Get the number of features used in random selection.- 返回:
- Value of numFeatures.
-
setNumFeatures
public void setNumFeatures(int newNumFeatures) Set the number of features to use in random selection.- 参数:
newNumFeatures
- Value to assign to numFeatures.
-
seedTipText
Returns the tip text for this property- 返回:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setSeed
public void setSeed(int seed) Set the seed for random number generation.- 指定者:
setSeed
在接口中Randomizable
- 参数:
seed
- the seed
-
getSeed
public int getSeed()Gets the seed for the random number generations- 指定者:
getSeed
在接口中Randomizable
- 返回:
- the seed for the random number generation
-
maxDepthTipText
Returns the tip text for this property- 返回:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
getMaxDepth
public int getMaxDepth()Get the maximum depth of trh tree, 0 for unlimited.- 返回:
- the maximum depth.
-
setMaxDepth
public void setMaxDepth(int value) Set the maximum depth of the tree, 0 for unlimited.- 参数:
value
- the maximum depth.
-
measureOutOfBagError
public double measureOutOfBagError()Gets the out of bag error that was calculated as the classifier was built.- 返回:
- the out of bag error
-
enumerateMeasures
Returns an enumeration of the additional measure names.- 指定者:
enumerateMeasures
在接口中AdditionalMeasureProducer
- 返回:
- an enumeration of the measure names
-
getMeasure
Returns the value of the named measure.- 指定者:
getMeasure
在接口中AdditionalMeasureProducer
- 参数:
additionalMeasureName
- the name of the measure to query for its value- 返回:
- the value of the named measure
- 抛出:
IllegalArgumentException
- if the named measure is not supported
-
listOptions
Returns an enumeration describing the available options.- 指定者:
listOptions
在接口中OptionHandler
- 覆盖:
listOptions
在类中Classifier
- 返回:
- an enumeration of all the available options
-
getOptions
Gets the current settings of the forest.- 指定者:
getOptions
在接口中OptionHandler
- 覆盖:
getOptions
在类中Classifier
- 返回:
- an array of strings suitable for passing to setOptions()
-
setOptions
Parses a given list of options. Valid options are:-I <number of trees> Number of trees to build.
-K <number of features> Number of features to consider (<0 = int(log_2(#predictors)+1)).
-S Seed for random number generator. (default 1)
-depth <num> The maximum depth of the trees, 0 for unlimited. (default 0)
-D If set, classifier is run in debug mode and may output additional info to the console
- 指定者:
setOptions
在接口中OptionHandler
- 覆盖:
setOptions
在类中Classifier
- 参数:
options
- the list of options as an array of strings- 抛出:
Exception
- if an option is not supported
-
getCapabilities
Returns default capabilities of the classifier.- 指定者:
getCapabilities
在接口中CapabilitiesHandler
- 覆盖:
getCapabilities
在类中Classifier
- 返回:
- the capabilities of this classifier
- 另请参阅:
-
buildClassifier
Builds a classifier for a set of instances.- 指定者:
buildClassifier
在类中Classifier
- 参数:
data
- the instances to train the classifier with- 抛出:
Exception
- if something goes wrong
-
distributionForInstance
Returns the class probability distribution for an instance.- 覆盖:
distributionForInstance
在类中Classifier
- 参数:
instance
- the instance to be classified- 返回:
- the distribution the forest generates for the instance
- 抛出:
Exception
- if computation fails
-
toString
Outputs a description of this classifier. -
getRevision
Returns the revision string.- 指定者:
getRevision
在接口中RevisionHandler
- 覆盖:
getRevision
在类中Classifier
- 返回:
- the revision
-
main
Main method for this class.- 参数:
argv
- the options
-