net.sf.bddbddb.order
Class MyId3

java.lang.Object
  extended by weka.classifiers.Classifier
      extended by net.sf.bddbddb.order.MyId3
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, weka.core.OptionHandler

public class MyId3
extends weka.classifiers.Classifier

Class implementing an Id3 decision tree classifier. This version differs from the weka one in that it supports missing attributes.

Version:
$Revision: 531 $
Author:
Eibe Frank (eibe@cs.waikato.ac.nz), John Whaley
See Also:
Serialized Form

Field Summary
 
Fields inherited from class weka.classifiers.Classifier
m_Debug
 
Constructor Summary
MyId3()
           
 
Method Summary
 void buildClassifier(weka.core.Instances data)
          Builds Id3 decision tree classifier.
 double classifyInstance(weka.core.Instance instance)
          Classifies a given test instance using the decision tree.
 double[] distributionForInstance(weka.core.Instance instance)
          Computes class distribution for instance using decision tree.
 boolean getAttribCombos(weka.core.Instances i, double cv)
           
 java.util.List getAttribCombos(int nAttribs, double cv)
           
 java.lang.String globalInfo()
          Returns a string describing the classifier.
 void laplaceSmooth(double[] dist, double sum, int numClasses)
           
static void main(java.lang.String[] args)
          Main method.
 java.lang.String toString()
          Prints the decision tree using the private toString method from below.
 
Methods inherited from class weka.classifiers.Classifier
debugTipText, forName, getDebug, getOptions, listOptions, makeCopies, setDebug, setOptions
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MyId3

public MyId3()
Method Detail

getAttribCombos

public boolean getAttribCombos(weka.core.Instances i,
                               double cv)

getAttribCombos

public java.util.List getAttribCombos(int nAttribs,
                                      double cv)

globalInfo

public java.lang.String globalInfo()
Returns a string describing the classifier.

Returns:
a description suitable for the GUI.

buildClassifier

public void buildClassifier(weka.core.Instances data)
                     throws java.lang.Exception
Builds Id3 decision tree classifier.

Specified by:
buildClassifier in class weka.classifiers.Classifier
Parameters:
data - the training data
Throws:
java.lang.Exception - if classifier can't be built successfully

laplaceSmooth

public void laplaceSmooth(double[] dist,
                          double sum,
                          int numClasses)

classifyInstance

public double classifyInstance(weka.core.Instance instance)
Classifies a given test instance using the decision tree.

Overrides:
classifyInstance in class weka.classifiers.Classifier
Parameters:
instance - the instance to be classified
Returns:
the classification

distributionForInstance

public double[] distributionForInstance(weka.core.Instance instance)
                                 throws weka.core.NoSupportForMissingValuesException
Computes class distribution for instance using decision tree.

Overrides:
distributionForInstance in class weka.classifiers.Classifier
Parameters:
instance - the instance for which distribution is to be computed
Returns:
the class distribution for the given instance
Throws:
weka.core.NoSupportForMissingValuesException

toString

public java.lang.String toString()
Prints the decision tree using the private toString method from below.

Overrides:
toString in class java.lang.Object
Returns:
a textual description of the classifier

main

public static void main(java.lang.String[] args)
Main method.

Parameters:
args - the options for the classifier


Copyright © 2004-2008 Stanford SUIF Compiler Group. All Rights Reserved.