All Packages  Class Hierarchy  This Package  Previous  Next  Index  WEKA's home

Class weka.classifiers.j48.ClassifierTree

java.lang.Object
   |
   +----weka.classifiers.j48.ClassifierTree

public class ClassifierTree
extends Object
implements Drawable, Serializable
Class for handling a tree structure used for classification.

Version:
$Revision: 1.7 $
Author:
Eibe Frank (eibe@cs.waikato.ac.nz)

Constructor Index

 o ClassifierTree(ModelSelection)
Constructor.

Method Index

 o buildClassifier(Instances)
Method for building a classifier tree.
 o buildTree(Instances, boolean)
Builds the tree structure.
 o buildTree(Instances, Instances, boolean)
Builds the tree structure with hold out set
 o classifyInstance(Instance)
Classifies an instance.
 o cleanup(Instances)
Cleanup in order to save memory.
 o distributionForInstance(Instance)
Returns class probabilities for a weighted instance.
 o graph()
Returns graph describing the tree.
 o numLeaves()
Returns number of leaves in tree structure.
 o numNodes()
Returns number of nodes in tree structure.
 o prefix()
Returns tree in prefix order.
 o toSource(String)
Returns source code for the tree as an if-then statement.
 o toString()
Prints tree structure.

Constructors

 o ClassifierTree
 public ClassifierTree(ModelSelection toSelectLocModel)
Constructor.

Methods

 o buildClassifier
 public void buildClassifier(Instances data) throws Exception
Method for building a classifier tree.

Throws: Exception
if something goes wrong
 o buildTree
 public void buildTree(Instances data,
                       boolean keepData) throws Exception
Builds the tree structure.

Parameters:
data - the data for which the tree structure is to be generated.
keepData - is training data to be kept?
Throws: Exception
if something goes wrong
 o buildTree
 public void buildTree(Instances train,
                       Instances test,
                       boolean keepData) throws Exception
Builds the tree structure with hold out set

Parameters:
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?
Throws: Exception
if something goes wrong
 o classifyInstance
 public double classifyInstance(Instance instance) throws Exception
Classifies an instance.

Throws: Exception
if something goes wrong
 o cleanup
 public final void cleanup(Instances justHeaderInfo)
Cleanup in order to save memory.

 o distributionForInstance
 public final double[] distributionForInstance(Instance instance) throws Exception
Returns class probabilities for a weighted instance.

Throws: Exception
if something goes wrong
 o graph
 public String graph() throws Exception
Returns graph describing the tree.

Throws: Exception
if something goes wrong
 o prefix
 public String prefix() throws Exception
Returns tree in prefix order.

Throws: Exception
if something goes wrong
 o 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).

Parameters:
className - the classname that this static classifier has
Returns:
an array containing two stringbuffers, the first string containing assignment code, and the second containing source for support code.
Throws: Exception
if something goes wrong
 o numLeaves
 public int numLeaves()
Returns number of leaves in tree structure.

 o numNodes
 public int numNodes()
Returns number of nodes in tree structure.

 o toString
 public String toString()
Prints tree structure.

Overrides:
toString in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index  WEKA's home