Package weka.classifiers.trees
Class LADTree
- java.lang.Object
-
- weka.classifiers.Classifier
-
- weka.classifiers.trees.LADTree
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.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
All Methods Static Methods Instance Methods Concrete Methods 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()
java.util.Enumeration
enumerateMeasures()
Returns an enumeration of the additional measure names.Capabilities
getCapabilities()
Returns default capabilities of the classifier.double
getMeasure(java.lang.String additionalMeasureName)
Returns the value of the named measure.int
getNumOfBoostingIterations()
Gets the number of boosting iterations.java.lang.String[]
getOptions()
Gets the current settings of ADTree.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 classifierjava.lang.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.java.lang.String
legend()
Returns the legend of the tree, describing how results are to be interpreted.java.util.Enumeration
listOptions()
Returns an enumeration describing the available options.static void
main(java.lang.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)
java.lang.String
numOfBoostingIterationsTipText()
int
predictiveError(Instances test)
void
setNumOfBoostingIterations(int b)
Sets the number of boosting iterations.void
setOptions(java.lang.String[] options)
Parses a given list of options.java.lang.String
toString()
Returns a description of the classifier.-
Methods inherited from class weka.classifiers.Classifier
classifyInstance, debugTipText, forName, getDebug, makeCopies, makeCopy, setDebug
-
-
-
-
Method Detail
-
globalInfo
public java.lang.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 interfaceTechnicalInformationHandler
- Returns:
- the technical information about this class
-
initClassifier
public void initClassifier(Instances instances) throws java.lang.Exception
Sets up the tree ready to be trained.- Parameters:
instances
- the instances to train the tree with- Throws:
java.lang.Exception
- if training data is unsuitable
-
next
public void next(int iteration) throws java.lang.Exception
- Throws:
java.lang.Exception
-
done
public void done() throws java.lang.Exception
- Throws:
java.lang.Exception
-
distributionForInstance
public double[] distributionForInstance(Instance instance)
Returns the class probability distribution for an instance.- Overrides:
distributionForInstance
in classClassifier
- Parameters:
instance
- the instance to be classified- Returns:
- the distribution the tree generates for the instance
-
toString
public java.lang.String toString()
Returns a description of the classifier.- Overrides:
toString
in classjava.lang.Object
- Returns:
- a string containing a description of the classifier
-
graph
public java.lang.String graph() throws java.lang.Exception
Returns graph describing the tree.
-
legend
public java.lang.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 java.lang.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 java.util.Enumeration listOptions()
Returns an enumeration describing the available options.- Specified by:
listOptions
in interfaceOptionHandler
- Overrides:
listOptions
in classClassifier
- Returns:
- an enumeration of all the available options
-
setOptions
public void setOptions(java.lang.String[] options) throws java.lang.Exception
Parses a given list of options. Valid options are:-B num
Set the number of boosting iterations (default 10)- Specified by:
setOptions
in interfaceOptionHandler
- Overrides:
setOptions
in classClassifier
- Parameters:
options
- the list of options as an array of strings- Throws:
java.lang.Exception
- if an option is not supported
-
getOptions
public java.lang.String[] getOptions()
Gets the current settings of ADTree.- Specified by:
getOptions
in interfaceOptionHandler
- Overrides:
getOptions
in classClassifier
- 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 java.util.Enumeration enumerateMeasures()
Returns an enumeration of the additional measure names.- Specified by:
enumerateMeasures
in interfaceAdditionalMeasureProducer
- Returns:
- an enumeration of the measure names
-
getMeasure
public double getMeasure(java.lang.String additionalMeasureName)
Returns the value of the named measure.- Specified by:
getMeasure
in interfaceAdditionalMeasureProducer
- Parameters:
measureName
- the name of the measure to query for its value- Returns:
- the value of the named measure
- Throws:
java.lang.IllegalArgumentException
- if the named measure is not supported
-
buildClassifier
public void buildClassifier(Instances instances) throws java.lang.Exception
Builds a classifier for a set of instances.- Specified by:
buildClassifier
in classClassifier
- Parameters:
instances
- the instances to train the classifier with- Throws:
java.lang.Exception
- if something goes wrong
-
predictiveError
public int predictiveError(Instances test)
-
merge
public void merge(LADTree mergeWith) throws java.lang.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:
java.lang.Exception
- if merge could not be performed
-
graphType
public int graphType()
Returns the type of graph this classifier represents.
-
getRevision
public java.lang.String getRevision()
Returns the revision string.- Specified by:
getRevision
in interfaceRevisionHandler
- Overrides:
getRevision
in classClassifier
- Returns:
- the revision
-
getCapabilities
public Capabilities getCapabilities()
Returns default capabilities of the classifier.- Specified by:
getCapabilities
in interfaceCapabilitiesHandler
- Overrides:
getCapabilities
in classClassifier
- Returns:
- the capabilities of this classifier
- See Also:
Capabilities
-
main
public static void main(java.lang.String[] argv)
Main method for testing this class.- Parameters:
argv
- the options
-
-