Package weka.classifiers.trees

# Class LADTree

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

All Implemented Interfaces:
  `Serializable`, `Cloneable`, `AdditionalMeasureProducer`, `CapabilitiesHandler`, `Drawable`, `OptionHandler`, `RevisionHandler`, `TechnicalInformationHandler`

public class LADTree extends Classifier implements Drawable, AdditionalMeasureProducer, TechnicalInformationHandler
Class for generating a multi-class alternating decision tree using the LogitBoost strategy. For more info, see
Geoffrey Holmes, Bernhard Pfahringer, Richard Kirkby, Eibe Frank, Mark Hall: Multiclass alternating decision trees. In: ECML, 161-172, 2001.

BibTeX:

     @inproceedings{Holmes2001,
        author = {Geoffrey Holmes and Bernhard Pfahringer and Richard Kirkby and Eibe Frank and Mark Hall},
        booktitle = {ECML},
        pages = {161-172},
        publisher = {Springer},
        title = {Multiclass alternating decision trees},
        year = {2001}
     }

Valid options are:

     -B <number of boosting iterations>
      Number of boosting iterations.
      (Default = 10)

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

Version:
  $Revision: 10279 $
Author:
  Richard Kirkby
See Also:
  - Serialized Form

## Field Summary

### Fields inherited from interface weka.core.Drawable

`BayesNet, Newick, NOT_DRAWABLE, TREE`

## Constructor Summary

Constructors
Constructor
Description
`LADTree()`

## Method Summary

Modifier and Type
Method
Description
`void`
`buildClassifier(Instances instances)`
Builds a classifier for a set of instances.
`double[]`
`distributionForInstance(Instance instance)`
Returns the class probability distribution for an instance.
`void`
`done()`
`Enumeration`
`enumerateMeasures()`
Returns an enumeration of the additional measure names.
`Capabilities`
`getCapabilities()`
Returns default capabilities of the classifier.
`double`
`getMeasure(String additionalMeasureName)`
Returns the value of the named measure.
`int`
`getNumOfBoostingIterations()`
Gets the number of boosting iterations.
`String[]`
`getOptions()`
Gets the current settings of ADTree.
`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.
`String`
`globalInfo()`
Returns a string describing classifier
`String`
`graph()`
Returns graph describing the tree.
`int`
`graphType()`
Returns the type of graph this classifier represents.
`void`
`initClassifier(Instances instances)`
Sets up the tree ready to be trained.
`String`
`legend()`
Returns the legend of the tree, describing how results are to be interpreted.
`Enumeration`
`listOptions()`
Returns an enumeration describing the available options.
`static void`
`main(String[] argv)`
Main method for testing this class.
`double`
`measureExamplesCounted()`
Returns the number of examples "counted".
`double`
`measureNodesExpanded()`
Returns the number of nodes expanded.
`double`
`measureNumLeaves()`
Calls measure function for leaf size.
`double`
`measureNumPredictionLeaves()`
Calls measure function for leaf size.
`double`
`measureTreeSize()`
Calls measure function for tree size.
`void`
`merge(LADTree mergeWith)`
Merges two trees together.
`void`
`next(int iteration)`
`String`
`numOfBoostingIterationsTipText()`
`int`
`predictiveError(Instances test)`
`void`
`setNumOfBoostingIterations(int b)`
Sets the number of boosting iterations.
`void`
`setOptions(String[] options)`
Parses a given list of options.
`String`
`toString()`
Returns a description of the classifier.

### Methods inherited from class weka.classifiers.Classifier

`classifyInstance, debugTipText, forName, getDebug, makeCopies, makeCopy, setDebug`

### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Constructor Details

### LADTree

public LADTree()

## Method Details

### globalInfo

public String globalInfo()
Returns a string describing classifier

Returns:
  a description suitable for displaying in the explorer/experimenter 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

### initClassifier

public void initClassifier(Instances instances) throws Exception
Sets up the tree ready to be trained.

Parameters:
  `instances` - the instances to train the tree with
Throws:
  `Exception` - if training data is unsuitable

### next

public void next(int iteration) throws Exception

Throws:
  `Exception`

### done

public void done() throws Exception

Throws:
  `Exception`

### distributionForInstance

public double[] distributionForInstance(Instance instance)
Returns the class probability distribution for an instance.

Overrides:
  `distributionForInstance` in class `Classifier`
Parameters:
  `instance` - the instance to be classified
Returns:
  the distribution the tree generates for the instance

### toString

public String toString()
Returns a description of the classifier.

Overrides:
  `toString` in class `Object`
Returns:
  a string containing a description of the classifier

### graph

public String graph() throws Exception
Returns graph describing the tree.

Specified by:
  `graph` in interface `Drawable`
Returns:
  the graph of the tree in dotty format
Throws:
  `Exception` - if something goes wrong

### legend

public String legend()
Returns the legend of the tree, describing how results are to be interpreted.

Returns:
  a string containing the legend of the classifier

### numOfBoostingIterationsTipText

public String numOfBoostingIterationsTipText()

Returns:
  tip text for this property suitable for displaying in the explorer/experimenter gui

### getNumOfBoostingIterations

public int getNumOfBoostingIterations()
Gets the number of boosting iterations.

Returns:
  the number of boosting iterations

### setNumOfBoostingIterations

public void setNumOfBoostingIterations(int b)
Sets the number of boosting iterations.

Parameters:
  `b` - the number of boosting iterations to use

### listOptions

public Enumeration listOptions()
Returns an enumeration describing the available options.

Specified by:
  `listOptions` in interface `OptionHandler`
Overrides:
  `listOptions` in class `Classifier`
Returns:
  an enumeration of all the available options

### setOptions

public void setOptions(String[] options) throws Exception
Parses a given list of options. Valid options are:

-B num
Set the number of boosting iterations (default 10)

Specified by:
  `setOptions` in interface `OptionHandler`
Overrides:
  `setOptions` in class `Classifier`
Parameters:
  `options` - the list of options as an array of strings
Throws:
  `Exception` - if an option is not supported

### getOptions

public String[] getOptions()
Gets the current settings of ADTree.

Specified by:
  `getOptions` in interface `OptionHandler`
Overrides:
  `getOptions` in class `Classifier`
Returns:
  an array of strings suitable for passing to setOptions()

### measureTreeSize

public double measureTreeSize()
Calls measure function for tree size.

Returns:
  the tree size

### measureNumLeaves

public double measureNumLeaves()
Calls measure function for leaf size.

Returns:
  the leaf size

### measureNumPredictionLeaves

public double measureNumPredictionLeaves()
Calls measure function for leaf size.

Returns:
  the leaf size

### measureNodesExpanded

public double measureNodesExpanded()
Returns the number of nodes expanded.

Returns:
  the number of nodes expanded during search

### measureExamplesCounted

public double measureExamplesCounted()
Returns the number of examples "counted".

Returns:
  the number of nodes processed during search

### enumerateMeasures

public Enumeration enumerateMeasures()
Returns an enumeration of the additional measure names.

Specified by:
  `enumerateMeasures` in interface `AdditionalMeasureProducer`
Returns:
  an enumeration of the measure names

### getMeasure

public double getMeasure(String additionalMeasureName)
Returns the value of the named measure.

Specified by:
  `getMeasure` in interface `AdditionalMeasureProducer`
Parameters:
  `additionalMeasureName` - the name of the measure to query for its value
  `measureName` - the name of the measure to query for its value
Returns:
  the value of the named measure
Throws:
  `IllegalArgumentException` - if the named measure is not supported

### buildClassifier

public void buildClassifier(Instances instances) throws Exception
Builds a classifier for a set of instances.

Specified by:
  `buildClassifier` in class `Classifier`
Parameters:
  `instances` - the instances to train the classifier with
Throws:
  `Exception` - if something goes wrong

### predictiveError

public int predictiveError(Instances test)

### merge

public void merge(LADTree mergeWith) throws Exception
Merges two trees together. Modifies the tree being acted on, leaving tree passed as a parameter untouched (cloned). Does not check to see whether training instances are compatible - strange things could occur if they are not.

Parameters:
  `mergeWith` - the tree to merge with
Throws:
  `Exception` - if merge could not be performed

### graphType

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

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

### getRevision

public String getRevision()
Returns the revision string.

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

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

### main

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

Parameters:
  `argv` - the options