|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--weka.classifiers.Classifier | +--weka.classifiers.trees.ADTree
Class for generating an alternating decision tree. The basic algorithm is based on:
Freund, Y., Mason, L.: The alternating decision tree learning algorithm. Proceeding of the Sixteenth International Conference on Machine Learning, Bled, Slovenia, (1999) 124-133.
This version currently only supports two-class problems. The number of boosting iterations needs to be manually tuned to suit the dataset and the desired complexity/accuracy tradeoff. Induction of the trees has been optimized, and heuristic search methods have been introduced to speed learning.Valid options are:
-B num
Set the number of boosting iterations
(default 10)
-E num
Set the nodes to expand: -3(all), -2(weight), -1(z_pure), >=0 seed for random walk
(default -3)
-D
Save the instance data with the model
Field Summary | |
static int |
SEARCHPATH_ALL
The search modes |
static int |
SEARCHPATH_HEAVIEST
|
static int |
SEARCHPATH_RANDOM
|
static int |
SEARCHPATH_ZPURE
|
static Tag[] |
TAGS_SEARCHPATH
|
Fields inherited from interface weka.core.Drawable |
BayesNet, NOT_DRAWABLE, TREE |
Constructor Summary | |
ADTree()
|
Method Summary | |
void |
boost()
Performs a single boosting iteration, using two-class optimized method. |
void |
buildClassifier(Instances instances)
Builds a classifier for a set of instances. |
java.lang.Object |
clone()
Creates a clone that is identical to the current tree, but is independent. |
double[] |
distributionForInstance(Instance instance)
Returns the class probability distribution for an instance. |
void |
done()
Frees memory that is no longer needed for a final model - will no longer be able to increment the classifier after calling this. |
java.util.Enumeration |
enumerateMeasures()
Returns an enumeration of the additional measure names. |
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. |
int |
getRandomSeed()
Gets random seed for a random walk. |
boolean |
getSaveInstanceData()
Gets whether the tree is to save instance data. |
SelectedTag |
getSearchPath()
Gets the method of searching the tree for a new insertion. |
java.lang.String |
globalInfo()
Returns a string describing classifier |
java.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, using two-class optimized method. |
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 |
measureExamplesProcessed()
Returns the number of examples "counted". |
double |
measureNodesExpanded()
Returns the number of nodes expanded. |
double |
measureNumLeaves()
Calls measure function for leaf size - the number of prediction nodes. |
double |
measureNumPredictionLeaves()
Calls measure function for prediction leaf size - the number of prediction nodes without children. |
double |
measureTreeSize()
Calls measure function for tree size - the total number of nodes. |
void |
merge(ADTree mergeWith)
Merges two trees together. |
void |
next(int iteration)
Performs one iteration. |
int |
nextSplitAddedOrder()
Returns the next number in the order that splitter nodes have been added to the tree, and records that a new splitter has been added. |
java.lang.String |
numOfBoostingIterationsTipText()
|
java.lang.String |
randomSeedTipText()
|
java.lang.String |
saveInstanceDataTipText()
|
java.lang.String |
searchPathTipText()
|
void |
setNumOfBoostingIterations(int b)
Sets the number of boosting iterations. |
void |
setOptions(java.lang.String[] options)
Parses a given list of options. |
void |
setRandomSeed(int seed)
Sets random seed for a random walk. |
void |
setSaveInstanceData(boolean v)
Sets whether the tree is to save instance data. |
void |
setSearchPath(SelectedTag newMethod)
Sets the method of searching the tree for a new insertion. |
java.lang.String |
toString()
Returns a description of the classifier. |
Methods inherited from class weka.classifiers.Classifier |
classifyInstance, debugTipText, forName, getDebug, makeCopies, setDebug |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int SEARCHPATH_ALL
public static final int SEARCHPATH_HEAVIEST
public static final int SEARCHPATH_ZPURE
public static final int SEARCHPATH_RANDOM
public static final Tag[] TAGS_SEARCHPATH
Constructor Detail |
public ADTree()
Method Detail |
public java.lang.String globalInfo()
public void initClassifier(Instances instances) throws java.lang.Exception
initClassifier
in interface IterativeClassifier
instances
- the instances to train the tree with
java.lang.Exception
- if training data is unsuitablepublic void next(int iteration) throws java.lang.Exception
next
in interface IterativeClassifier
iteration
- the index of the current iteration (0-based)
java.lang.Exception
- if this iteration failspublic void boost() throws java.lang.Exception
java.lang.Exception
- if try to boost without setting up tree first or there are no
instances to train withpublic double[] distributionForInstance(Instance instance)
distributionForInstance
in class Classifier
instance
- the instance to be classified
public java.lang.String toString()
toString
in class java.lang.Object
public int graphType()
graphType
in interface Drawable
public java.lang.String graph() throws java.lang.Exception
graph
in interface Drawable
java.lang.Exception
- if something goes wrongpublic java.lang.String legend()
public java.lang.String numOfBoostingIterationsTipText()
public int getNumOfBoostingIterations()
public void setNumOfBoostingIterations(int b)
b
- the number of boosting iterations to usepublic java.lang.String searchPathTipText()
public SelectedTag getSearchPath()
public void setSearchPath(SelectedTag newMethod)
newMethod
- the new tree searching modepublic java.lang.String randomSeedTipText()
public int getRandomSeed()
public void setRandomSeed(int seed)
public java.lang.String saveInstanceDataTipText()
public boolean getSaveInstanceData()
public void setSaveInstanceData(boolean v)
public java.util.Enumeration listOptions()
listOptions
in interface OptionHandler
listOptions
in class Classifier
public void setOptions(java.lang.String[] options) throws java.lang.Exception
-B num
Set the number of boosting iterations
(default 10)
-E num
Set the nodes to expand: -3(all), -2(weight), -1(z_pure), >=0 seed for random walk
(default -3)
-D
Save the instance data with the model
setOptions
in interface OptionHandler
setOptions
in class Classifier
options
- the list of options as an array of strings
java.lang.Exception
- if an option is not supportedpublic java.lang.String[] getOptions()
getOptions
in interface OptionHandler
getOptions
in class Classifier
public double measureTreeSize()
public double measureNumLeaves()
public double measureNumPredictionLeaves()
public double measureNodesExpanded()
public double measureExamplesProcessed()
public java.util.Enumeration enumerateMeasures()
enumerateMeasures
in interface AdditionalMeasureProducer
public double getMeasure(java.lang.String additionalMeasureName)
getMeasure
in interface AdditionalMeasureProducer
additionalMeasureName
- the name of the measure to query for its value
java.lang.IllegalArgumentException
- if the named measure is not supportedpublic int nextSplitAddedOrder()
public void buildClassifier(Instances instances) throws java.lang.Exception
buildClassifier
in class Classifier
instances
- the instances to train the classifier with
java.lang.Exception
- if something goes wrongpublic void done()
done
in interface IterativeClassifier
public java.lang.Object clone()
clone
in interface IterativeClassifier
clone
in class java.lang.Object
public void merge(ADTree mergeWith) throws java.lang.Exception
mergeWith
- the tree to merge with
java.lang.Exception
- if merge could not be performedpublic static void main(java.lang.String[] argv)
argv
- the options
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright (c) 2003 David Lindsay, Computer Learning Research Centre, Dept. Computer Science, Royal Holloway, University of London