类 RandomTree

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

public class RandomTree extends Classifier implements OptionHandler, WeightedInstancesHandler, Randomizable, Drawable
Class for constructing a tree that considers K randomly chosen attributes at each node. Performs no pruning. Also has an option to allow estimation of class probabilities based on a hold-out set (backfitting).

Valid options are:

 -K <number of attributes>
  Number of attributes to randomly investigate. (default 0)
  (<0 = int(log_2(#predictors)+1)).
 
 -M <minimum number of instances>
  Set minimum number of instances per leaf.
 
 -S <num>
  Seed for random number generator.
  (default 1)
 
 -depth <num>
  The maximum depth of the tree, 0 for unlimited.
  (default 0)
 
 -N <num>
  Number of folds for backfitting (default 0, no backfitting).
 
 -U
  Allow unclassified instances.
 
 -D
  If set, classifier is run in debug mode and
  may output additional info to the console
 
版本:
$Revision: 10993 $
作者:
Eibe Frank (eibe@cs.waikato.ac.nz), Richard Kirkby (rkirkby@cs.waikato.ac.nz)
另请参阅:
  • 构造器详细资料

    • RandomTree

      public RandomTree()
  • 方法详细资料

    • globalInfo

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

      public String minNumTipText()
      Returns the tip text for this property
      返回:
      tip text for this property suitable for displaying in the explorer/experimenter gui
    • getMinNum

      public double getMinNum()
      Get the value of MinNum.
      返回:
      Value of MinNum.
    • setMinNum

      public void setMinNum(double newMinNum)
      Set the value of MinNum.
      参数:
      newMinNum - Value to assign to MinNum.
    • KValueTipText

      public String KValueTipText()
      Returns the tip text for this property
      返回:
      tip text for this property suitable for displaying in the explorer/experimenter gui
    • getKValue

      public int getKValue()
      Get the value of K.
      返回:
      Value of K.
    • setKValue

      public void setKValue(int k)
      Set the value of K.
      参数:
      k - Value to assign to K.
    • 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.
    • numFoldsTipText

      public String numFoldsTipText()
      Returns the tip text for this property
      返回:
      tip text for this property suitable for displaying in the explorer/experimenter gui
    • getNumFolds

      public int getNumFolds()
      Get the value of NumFolds.
      返回:
      Value of NumFolds.
    • setNumFolds

      public void setNumFolds(int newNumFolds)
      Set the value of NumFolds.
      参数:
      newNumFolds - Value to assign to NumFolds.
    • allowUnclassifiedInstancesTipText

      public String allowUnclassifiedInstancesTipText()
      Returns the tip text for this property
      返回:
      tip text for this property suitable for displaying in the explorer/experimenter gui
    • getAllowUnclassifiedInstances

      public boolean getAllowUnclassifiedInstances()
      Get the value of NumFolds.
      返回:
      Value of NumFolds.
    • setAllowUnclassifiedInstances

      public void setAllowUnclassifiedInstances(boolean newAllowUnclassifiedInstances)
      Set the value of AllowUnclassifiedInstances.
      参数:
      newAllowUnclassifiedInstances - Value to assign to AllowUnclassifiedInstances.
    • setMaxDepth

      public void setMaxDepth(int value)
      Set the maximum depth of the tree, 0 for unlimited.
      参数:
      value - the maximum depth.
    • listOptions

      public Enumeration listOptions()
      Lists the command-line options for this classifier.
      指定者:
      listOptions 在接口中 OptionHandler
      覆盖:
      listOptions 在类中 Classifier
      返回:
      an enumeration over all possible options
    • getOptions

      public String[] getOptions()
      Gets options from this classifier.
      指定者:
      getOptions 在接口中 OptionHandler
      覆盖:
      getOptions 在类中 Classifier
      返回:
      the options for the current setup
    • setOptions

      public void setOptions(String[] options) throws Exception
      Parses a given list of options.

      Valid options are:

       -K <number of attributes>
        Number of attributes to randomly investigate
        (<0 = int(log_2(#attributes)+1)).
       
       -M <minimum number of instances>
        Set minimum number of instances per leaf.
       
       -S <num>
        Seed for random number generator.
        (default 1)
       
       -depth <num>
        The maximum depth of the tree, 0 for unlimited.
        (default 0)
       
       -N <num>
        Number of folds for backfitting (default 0, no backfitting).
       
       -U
        Allow unclassified instances.
       
       -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 classifier.
      指定者:
      buildClassifier 在类中 Classifier
      参数:
      data - the data to train with
      抛出:
      Exception - if something goes wrong or the data doesn't fit
    • distributionForInstance

      public double[] distributionForInstance(Instance instance) throws Exception
      Computes class distribution of an instance using the tree.
      覆盖:
      distributionForInstance 在类中 Classifier
      参数:
      instance - the instance to compute the distribution for
      返回:
      the computed class probabilities
      抛出:
      Exception - if computation fails
    • toString

      public String toString()
      Outputs the decision tree.
      覆盖:
      toString 在类中 Object
      返回:
      a string representation of the classifier
    • graph

      public String graph() throws Exception
      Returns graph describing the tree.
      指定者:
      graph 在接口中 Drawable
      返回:
      the graph describing the tree
      抛出:
      Exception - if graph can't be computed
    • graphType

      public int graphType()
      Returns the type of graph this classifier represents.
      指定者:
      graphType 在接口中 Drawable
      返回:
      Drawable.TREE
    • generatePartition

      public void generatePartition(Instances data) throws Exception
      Builds the classifier to generate a partition.
      抛出:
      Exception
    • getMembershipValues

      public double[] getMembershipValues(Instance instance) throws Exception
      Computes array that indicates node membership. Array locations are allocated based on breadth-first exploration of the tree.
      抛出:
      Exception
    • numElements

      public int numElements() throws Exception
      Returns the number of elements in the partition.
      抛出:
      Exception
    • main

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