Overview | Package | Class | Tree | Deprecated | Index | Help | Weka's home
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## weka.classifiers.trees
Class Id3

    java.lang.Object
      weka.classifiers.Classifier
          weka.classifiers.trees.Id3

All Implemented Interfaces:
  java.io.Serializable, java.lang.Cloneable, Sourcable, CapabilitiesHandler, OptionHandler, RevisionHandler, TechnicalInformationHandler

    public class Id3

extends Classifier
implements TechnicalInformationHandler, Sourcable

Class for constructing an unpruned decision tree based on the ID3 algorithm. Can only deal with nominal attributes. No missing values allowed. Empty leaves may result in unclassified instances. For more information see:
R. Quinlan (1986). Induction of decision trees. Machine Learning. 1(1):81-106.

BibTeX:

     @article{Quinlan1986,
        author = {R. Quinlan},
        journal = {Machine Learning},
        number = {1},
        pages = {81-106},
        title = {Induction of decision trees},
        volume = {1},
        year = {1986}
     }

Valid options are:

     -D
      If set, classifier is run in debug mode and
      may output additional info to the console

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

Constructor Summary
`Id3()`

Method Summary
`void` | `buildClassifier(Instances data)` Builds Id3 decision tree classifier.
`double` | `classifyInstance(Instance instance)` Classifies a given test instance using the decision tree.
`double[]` | `distributionForInstance(Instance instance)` Computes class distribution for instance using decision tree.
`Capabilities` | `getCapabilities()` Returns default capabilities of the classifier.
`java.lang.String` | `getRevision()` Returns the revision string.
`TechnicalInformation` | `getTechnicalInformation()` Returns an instance of a TechnicalInformation object, containing detailed information about the technical background of this class, e.g., paper reference or book this class is based on.
`java.lang.String` | `globalInfo()` Returns a string describing the classifier.
`static void` | `main(java.lang.String[] args)` Main method.
`java.lang.String` | `toSource(java.lang.String className)` Returns a string that describes the classifier as source.
`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, makeCopy, setDebug, setOptions`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### Id3

    public Id3()

Method Detail

### globalInfo

    public java.lang.String globalInfo()

  Returns a string describing the classifier.

  Returns:
    a description suitable for the GUI.

### getTechnicalInformation

    public TechnicalInformation getTechnicalInformation()

  Returns an instance of a TechnicalInformation object, containing detailed information about the technical background of this class, e.g., paper reference or book this class is based on.

  Specified by:
    `getTechnicalInformation` in interface `TechnicalInformationHandler`
  Returns:
    the technical information about this class

### getCapabilities

    public Capabilities getCapabilities()

  Returns default capabilities of the classifier.

  Specified by:
    `getCapabilities` in interface `CapabilitiesHandler`
  Overrides:
    `getCapabilities` in class `Classifier`
  Returns:
    the capabilities of this classifier
  See Also:
    `Capabilities`

### buildClassifier

    public void buildClassifier(Instances data)
                         throws java.lang.Exception

  Builds Id3 decision tree classifier.

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

### classifyInstance

    public double classifyInstance(Instance instance)
                            throws NoSupportForMissingValuesException

  Classifies a given test instance using the decision tree.

  Overrides:
    `classifyInstance` in class `Classifier`
  Parameters:
    `instance` - the instance to be classified
  Returns:
    the classification
  Throws:
    `NoSupportForMissingValuesException` - if instance has missing values

### distributionForInstance

    public double[] distributionForInstance(Instance instance)
                                     throws NoSupportForMissingValuesException

  Computes class distribution for instance using decision tree.

  Overrides:
    `distributionForInstance` in class `Classifier`
  Parameters:
    `instance` - the instance for which distribution is to be computed
  Returns:
    the class distribution for the given instance
  Throws:
    `NoSupportForMissingValuesException` - if instance has missing values

### 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

### toSource

    public java.lang.String toSource(java.lang.String className)
                              throws java.lang.Exception

  Returns a string that describes the classifier as source. The classifier will be contained in a class with the given name (there may be auxiliary classes), and will contain a method with the signature:

       public static double classify(Object[] i);

  where the array `i` contains elements that are either Double, String, with missing values represented as null. The generated code is public domain and comes with no warranty.
  Note: works only if class attribute is the last attribute in the dataset.

  Specified by:
    `toSource` in interface `Sourcable`
  Parameters:
    `className` - the name that should be given to the source class.
  Returns:
    the object source described by a string
  Throws:
    `java.lang.Exception` - if the source can't be computed

### getRevision

    public java.lang.String getRevision()

  Returns the revision string.

  Specified by:
    `getRevision` in interface `RevisionHandler`
  Overrides:
    `getRevision` in class `Classifier`
  Returns:
    the revision

### main

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

  Main method.

  Parameters:
    `args` - the options for the classifier

Overview | Package | Class | Tree | Deprecated | Index | Help | Weka's home
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD