public class ClassifierTree extends Object implements Drawable, Serializable, CapabilitiesHandler, RevisionHandler
BayesNet, Newick, NOT_DRAWABLE, TREE
Constructor and Description |
---|
ClassifierTree(ModelSelection toSelectLocModel)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
int |
assignIDs(int lastID)
Assigns a uniqe id to every node in the tree.
|
void |
buildClassifier(Instances data)
Method for building a classifier tree.
|
void |
buildTree(Instances data,
boolean keepData)
Builds the tree structure.
|
void |
buildTree(Instances train,
Instances test,
boolean keepData)
Builds the tree structure with hold out set
|
double |
classifyInstance(Instance instance)
Classifies an instance.
|
void |
cleanup(Instances justHeaderInfo)
Cleanup in order to save memory.
|
double[] |
distributionForInstance(Instance instance,
boolean useLaplace)
Returns class probabilities for a weighted instance.
|
Capabilities |
getCapabilities()
Returns default capabilities of the classifier tree.
|
String |
getRevision()
Returns the revision string.
|
String |
graph()
Returns graph describing the tree.
|
int |
graphType()
Returns the type of graph this classifier
represents.
|
int |
numLeaves()
Returns number of leaves in tree structure.
|
int |
numNodes()
Returns number of nodes in tree structure.
|
String |
prefix()
Returns tree in prefix order.
|
StringBuffer[] |
toSource(String className)
Returns source code for the tree as an if-then statement.
|
String |
toString()
Prints tree structure.
|
public ClassifierTree(ModelSelection toSelectLocModel)
public Capabilities getCapabilities()
getCapabilities
in interface CapabilitiesHandler
Capabilities
public void buildClassifier(Instances data) throws Exception
data
- the data to build the tree fromException
- if something goes wrongpublic void buildTree(Instances data, boolean keepData) throws Exception
data
- the data for which the tree structure is to be
generated.keepData
- is training data to be kept?Exception
- if something goes wrongpublic void buildTree(Instances train, Instances test, boolean keepData) throws Exception
train
- the data for which the tree structure is to be
generated.test
- the test data for potential pruningkeepData
- is training Data to be kept?Exception
- if something goes wrongpublic double classifyInstance(Instance instance) throws Exception
instance
- the instance to classifyException
- if something goes wrongpublic final void cleanup(Instances justHeaderInfo)
justHeaderInfo
- public final double[] distributionForInstance(Instance instance, boolean useLaplace) throws Exception
instance
- the instance to get the distribution foruseLaplace
- whether to use laplace or notException
- if something goes wrongpublic int assignIDs(int lastID)
lastID
- the last ID that was assignpublic int graphType()
public String prefix() throws Exception
Exception
- if something goes wrongpublic StringBuffer[] toSource(String className) throws Exception
className
- the classname that this static classifier hasException
- if something goes wrongpublic int numLeaves()
public int numNodes()
public String toString()
public String getRevision()
getRevision
in interface RevisionHandler
Copyright © 2012 University of Waikato, Hamilton, NZ. All Rights Reserved.