weka.classifiers.j48
Class PruneableClassifierTree

java.lang.Object
  |
  +--weka.classifiers.j48.ClassifierTree
        |
        +--weka.classifiers.j48.PruneableClassifierTree
All Implemented Interfaces:
Drawable, java.io.Serializable

public class PruneableClassifierTree
extends ClassifierTree

Class for handling a tree structure that can be pruned using a pruning set.

Author:
Eibe Frank (eibe@cs.waikato.ac.nz)
See Also:
Serialized Form

Fields inherited from class weka.classifiers.j48.ClassifierTree
m_id, m_isEmpty, m_isLeaf, m_localModel, m_sons, m_test, m_toSelectModel, m_train
 
Constructor Summary
PruneableClassifierTree(ModelSelection toSelectLocModel, boolean pruneTree, int num, boolean cleanup)
          Constructor for pruneable tree structure.
 
Method Summary
 void buildClassifier(Instances data)
          Method for building a pruneable classifier tree.
protected  ClassifierTree getNewTree(Instances train, Instances test)
          Returns a newly created tree.
 void prune()
          Prunes a tree.
 
Methods inherited from class weka.classifiers.j48.ClassifierTree
assignIDs, buildTree, buildTree, classifyInstance, cleanup, distributionForInstance, getNewTree, graph, nextID, numLeaves, numNodes, prefix, resetID, toSource, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PruneableClassifierTree

public PruneableClassifierTree(ModelSelection toSelectLocModel,
                               boolean pruneTree,
                               int num,
                               boolean cleanup)
                        throws java.lang.Exception
Constructor for pruneable tree structure. Stores reference to associated training data at each node.
Parameters:
toSelectLocModel - selection method for local splitting model
pruneTree - true if the tree is to be pruned
num - number of subsets of equal size
Throws:
java.lang.Exception - if something goes wrong
Method Detail

buildClassifier

public void buildClassifier(Instances data)
                     throws java.lang.Exception
Method for building a pruneable classifier tree.
Overrides:
buildClassifier in class ClassifierTree
Throws:
java.lang.Exception - if tree can't be built successfully

prune

public void prune()
           throws java.lang.Exception
Prunes a tree.
Throws:
java.lang.Exception - if tree can't be pruned successfully

getNewTree

protected ClassifierTree getNewTree(Instances train,
                                    Instances test)
                             throws java.lang.Exception
Returns a newly created tree.
Overrides:
getNewTree in class ClassifierTree
Parameters:
data - and selection method for local models.