类 ClassifierTree

java.lang.Object
weka.classifiers.trees.j48.ClassifierTree
所有已实现的接口:
Serializable, CapabilitiesHandler, Drawable, RevisionHandler
直接已知子类:
C45PruneableClassifierTree, C45PruneableClassifierTreeG, NBTreeClassifierTree, PruneableClassifierTree

public class ClassifierTree extends Object implements Drawable, Serializable, CapabilitiesHandler, RevisionHandler
Class for handling a tree structure used for classification.
版本:
$Revision: 10256 $
作者:
Eibe Frank (eibe@cs.waikato.ac.nz)
另请参阅:
  • 构造器详细资料

    • ClassifierTree

      public ClassifierTree(ModelSelection toSelectLocModel)
      Constructor.
  • 方法详细资料

    • getCapabilities

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

      public void buildClassifier(Instances data) throws Exception
      Method for building a classifier tree.
      参数:
      data - the data to build the tree from
      抛出:
      Exception - if something goes wrong
    • buildTree

      public void buildTree(Instances data, boolean keepData) throws Exception
      Builds the tree structure.
      参数:
      data - the data for which the tree structure is to be generated.
      keepData - is training data to be kept?
      抛出:
      Exception - if something goes wrong
    • buildTree

      public void buildTree(Instances train, Instances test, boolean keepData) throws Exception
      Builds the tree structure with hold out set
      参数:
      train - the data for which the tree structure is to be generated.
      test - the test data for potential pruning
      keepData - is training Data to be kept?
      抛出:
      Exception - if something goes wrong
    • classifyInstance

      public double classifyInstance(Instance instance) throws Exception
      Classifies an instance.
      参数:
      instance - the instance to classify
      返回:
      the classification
      抛出:
      Exception - if something goes wrong
    • cleanup

      public final void cleanup(Instances justHeaderInfo)
      Cleanup in order to save memory.
      参数:
      justHeaderInfo -
    • distributionForInstance

      public final double[] distributionForInstance(Instance instance, boolean useLaplace) throws Exception
      Returns class probabilities for a weighted instance.
      参数:
      instance - the instance to get the distribution for
      useLaplace - whether to use laplace or not
      返回:
      the distribution
      抛出:
      Exception - if something goes wrong
    • assignIDs

      public int assignIDs(int lastID)
      Assigns a uniqe id to every node in the tree.
      参数:
      lastID - the last ID that was assign
      返回:
      the new current ID
    • graphType

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

      public String graph() throws Exception
      Returns graph describing the tree.
      指定者:
      graph 在接口中 Drawable
      返回:
      the tree as graph
      抛出:
      Exception - if something goes wrong
    • prefix

      public String prefix() throws Exception
      Returns tree in prefix order.
      返回:
      the prefix order
      抛出:
      Exception - if something goes wrong
    • toSource

      public StringBuffer[] toSource(String className) throws Exception
      Returns source code for the tree as an if-then statement. The class is assigned to variable "p", and assumes the tested instance is named "i". The results are returned as two stringbuffers: a section of code for assignment of the class, and a section of code containing support code (eg: other support methods).
      参数:
      className - the classname that this static classifier has
      返回:
      an array containing two stringbuffers, the first string containing assignment code, and the second containing source for support code.
      抛出:
      Exception - if something goes wrong
    • numLeaves

      public int numLeaves()
      Returns number of leaves in tree structure.
      返回:
      the number of leaves
    • numNodes

      public int numNodes()
      Returns number of nodes in tree structure.
      返回:
      the number of nodes
    • toString

      public String toString()
      Prints tree structure.
      覆盖:
      toString 在类中 Object
      返回:
      the tree structure
    • getRevision

      public String getRevision()
      Returns the revision string.
      指定者:
      getRevision 在接口中 RevisionHandler
      返回:
      the revision