weka.classifiers.trees
Class UserClassifier

java.lang.Object
  |
  +--weka.classifiers.Classifier
        |
        +--weka.classifiers.trees.UserClassifier
All Implemented Interfaces:
java.lang.Cloneable, Drawable, OptionHandler, java.io.Serializable, TreeDisplayListener, VisualizePanelListener

public class UserClassifier
extends Classifier
implements Drawable, TreeDisplayListener, VisualizePanelListener

Class for generating an user defined decision tree. For more info see

Ware M., Frank E., Holmes G., Hall M. and Witten I.H. (2000). interactive machine learning - letting users build classifiers, Working Paper 00/4, Department of Computer Science, University of Waikato; March. Also available online at http://www.cs.waikato.ac.nz/~ml/publications/2000/ 00MW-etal-Interactive-ML.ps.

Version:
$Revision: 1.15 $
Author:
Malcolm Ware (mfw4@cs.waikato.ac.nz)
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface weka.core.Drawable
BayesNet, NOT_DRAWABLE, TREE
 
Constructor Summary
UserClassifier()
          Constructor
 
Method Summary
 void buildClassifier(Instances i)
          Call this function to build a decision tree for the training data provided.
 double[] distributionForInstance(Instance i)
          Call this function to get a double array filled with the probability of how likely each class type is the class of the instance.
 java.lang.String globalInfo()
          This will return a string describing the classifier.
 java.lang.String graph()
          Returns a string that describes a graph representing the object.
 int graphType()
          Returns the type of graph this classifier represents.
static void main(java.lang.String[] argv)
          Main method for testing this class.
 java.lang.String toString()
           
 void userCommand(TreeDisplayEvent e)
          Receives user choices from the tree view, and then deals with these choices.
 void userDataEvent(VisualizePanelEvent e)
          This receives shapes from the data view.
 
Methods inherited from class weka.classifiers.Classifier
classifyInstance, debugTipText, forName, getDebug, getOptions, listOptions, makeCopies, setDebug, setOptions
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UserClassifier

public UserClassifier()
Constructor

Method Detail

main

public static void main(java.lang.String[] argv)
Main method for testing this class.

Parameters:
argv - should contain command line options (see setOptions)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
a string that represents this objects tree.

userCommand

public void userCommand(TreeDisplayEvent e)
Receives user choices from the tree view, and then deals with these choices.

Specified by:
userCommand in interface TreeDisplayListener
Parameters:
e - The choice.

userDataEvent

public void userDataEvent(VisualizePanelEvent e)
This receives shapes from the data view. It then enters these shapes into the decision tree structure.

Specified by:
userDataEvent in interface VisualizePanelListener
Parameters:
e - Contains the shapes, and other info.

graphType

public int graphType()
Returns the type of graph this classifier represents.

Specified by:
graphType in interface Drawable
Returns:
Drawable.TREE

graph

public java.lang.String graph()
                       throws java.lang.Exception
Description copied from interface: Drawable
Returns a string that describes a graph representing the object. The string should be in XMLBIF ver. 0.3 format if the graph is a BayesNet, otherwise it should be in dotty format.

Specified by:
graph in interface Drawable
Returns:
A string formatted with a dotty representation of the decision tree.
Throws:
java.lang.Exception - if String can't be built properly.

globalInfo

public java.lang.String globalInfo()
This will return a string describing the classifier.

Returns:
The string.

buildClassifier

public void buildClassifier(Instances i)
                     throws java.lang.Exception
Call this function to build a decision tree for the training data provided.

Specified by:
buildClassifier in class Classifier
Parameters:
i - The training data.
Throws:
java.lang.Exception - if can't build classification properly.

distributionForInstance

public double[] distributionForInstance(Instance i)
                                 throws java.lang.Exception
Call this function to get a double array filled with the probability of how likely each class type is the class of the instance.

Overrides:
distributionForInstance in class Classifier
Parameters:
i - The instance to classify.
Returns:
A double array filled with the probalities of each class type.
Throws:
java.lang.Exception - if can't classify instance.


Copyright (c) 2003 David Lindsay, Computer Learning Research Centre, Dept. Computer Science, Royal Holloway, University of London