类 RandomForest

java.lang.Object
weka.classifiers.Classifier
weka.classifiers.trees.RandomForest
所有已实现的接口:
Serializable, Cloneable, AdditionalMeasureProducer, CapabilitiesHandler, OptionHandler, Randomizable, RevisionHandler, TechnicalInformationHandler, WeightedInstancesHandler

Class for constructing a forest of random trees.

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)
另请参阅:
  • 构造器详细资料

    • RandomForest

      public RandomForest()
  • 方法详细资料

    • globalInfo

      public String globalInfo()
      Returns a string describing classifier
      返回:
      a description suitable for displaying in the explorer/experimenter gui
    • getTechnicalInformation

      public 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.
      指定者:
      getTechnicalInformation 在接口中 TechnicalInformationHandler
      返回:
      the technical information about this class
    • numTreesTipText

      public String 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

      public String 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

      public String 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

      public String 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

      public Enumeration enumerateMeasures()
      Returns an enumeration of the additional measure names.
      指定者:
      enumerateMeasures 在接口中 AdditionalMeasureProducer
      返回:
      an enumeration of the measure names
    • getMeasure

      public double getMeasure(String additionalMeasureName)
      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

      public Enumeration listOptions()
      Returns an enumeration describing the available options.
      指定者:
      listOptions 在接口中 OptionHandler
      覆盖:
      listOptions 在类中 Classifier
      返回:
      an enumeration of all the available options
    • getOptions

      public String[] getOptions()
      Gets the current settings of the forest.
      指定者:
      getOptions 在接口中 OptionHandler
      覆盖:
      getOptions 在类中 Classifier
      返回:
      an array of strings suitable for passing to setOptions()
    • setOptions

      public void setOptions(String[] options) throws Exception
      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

      public Capabilities getCapabilities()
      Returns default capabilities of the classifier.
      指定者:
      getCapabilities 在接口中 CapabilitiesHandler
      覆盖:
      getCapabilities 在类中 Classifier
      返回:
      the capabilities of this classifier
      另请参阅:
    • buildClassifier

      public void buildClassifier(Instances data) throws Exception
      Builds a classifier for a set of instances.
      指定者:
      buildClassifier 在类中 Classifier
      参数:
      data - the instances to train the classifier with
      抛出:
      Exception - if something goes wrong
    • distributionForInstance

      public double[] distributionForInstance(Instance instance) throws Exception
      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

      public String toString()
      Outputs a description of this classifier.
      覆盖:
      toString 在类中 Object
      返回:
      a string containing a description of the classifier
    • getRevision

      public String getRevision()
      Returns the revision string.
      指定者:
      getRevision 在接口中 RevisionHandler
      覆盖:
      getRevision 在类中 Classifier
      返回:
      the revision
    • main

      public static void main(String[] argv)
      Main method for this class.
      参数:
      argv - the options