public class CHAIDClassifierTree
extends weka.classifiers.trees.j48.C45PruneableClassifierTree
Modifier and Type | Field and Description |
---|---|
private static long |
serialVersionUID
for serialization
|
m_CF, m_cleanup, m_collapseTheTree, m_pruneTheTree, m_subtreeRaising
Constructor and Description |
---|
CHAIDClassifierTree(CHAIDModelSelection toSelectLocModel,
boolean pruneTree,
float cf,
boolean raiseTree,
boolean cleanup,
boolean collapseTree)
Constructor for tree structure based on CHAID algorithm.
|
Modifier and Type | Method and Description |
---|---|
void |
buildClassifier(weka.core.Instances data)
Method for building a classifier tree based on CHAID algorithm.
|
void |
buildTree(weka.core.Instances data,
boolean keepData)
Builds the tree structure.
|
double |
classifyInstance(weka.core.Instance instance)
Classifies an instance.
|
double[] |
distributionForInstance(weka.core.Instance instance,
boolean useLaplace)
Returns class probabilities for a weighted instance.
|
weka.core.Capabilities |
getCapabilities()
Returns default capabilities of the classifier tree.
|
protected CHAIDClassifierTree |
getNewTree(weka.core.Instances data)
Returns a newly created tree.
|
protected CHAIDClassifierTree |
getNewTree(weka.core.Instances train,
weka.core.Instances test)
Returns a newly created tree.
|
private double |
getProbs(int classIndex,
weka.core.Instance instance)
Help method for computing class probabilities of a given instance but
without weight since CHAID does not modify the weight of an instance
during the classification.
|
private double |
getProbsLaplace(int classIndex,
weka.core.Instance instance)
Help method for computing class probabilities of a given instance but
without weight since CHAID does not modify the weight of an instance
during the classification.
|
java.lang.String |
getRevision()
Returns the revision string.
|
private CHAIDClassifierTree |
son(int index)
Method just exists to make program easier to read.
|
java.lang.StringBuffer[] |
toSource(java.lang.String className)
Returns source code for the tree as an if-then statement.
|
java.lang.String |
toStringOrdinalAttributesList()
Return the list of attributes treated as ordinal
|
private static final long serialVersionUID
public CHAIDClassifierTree(CHAIDModelSelection toSelectLocModel, boolean pruneTree, float cf, boolean raiseTree, boolean cleanup, boolean collapseTree) throws java.lang.Exception
toSelectLocModel
- selection method for local splitting modelpruneTree
- true if the tree is to be prunedcf
- the confidence factor for pruningraiseTree
- true if subtree raising is to be performedcleanup
- true to cleanup after build the treecollapseTree
- true if the tree is to be collapsedjava.lang.Exception
- if something goes wrongpublic weka.core.Capabilities getCapabilities()
getCapabilities
in interface weka.core.CapabilitiesHandler
getCapabilities
in class weka.classifiers.trees.j48.ClassifierTree
Capabilities
public void buildClassifier(weka.core.Instances data) throws java.lang.Exception
buildClassifier
in class weka.classifiers.trees.j48.C45PruneableClassifierTree
data
- the data for building the treejava.lang.Exception
- if something goes wrongpublic void buildTree(weka.core.Instances data, boolean keepData) throws java.lang.Exception
buildTree
in class weka.classifiers.trees.j48.ClassifierTree
data
- the data for which the tree structure is to be generated.keepData
- is training data to be kept?java.lang.Exception
- if something goes wrongprotected CHAIDClassifierTree getNewTree(weka.core.Instances data) throws java.lang.Exception
getNewTree
in class weka.classifiers.trees.j48.C45PruneableClassifierTree
data
- the training datajava.lang.Exception
- if something goes wrongprotected CHAIDClassifierTree getNewTree(weka.core.Instances train, weka.core.Instances test) throws java.lang.Exception
getNewTree
in class weka.classifiers.trees.j48.ClassifierTree
train
- the training datatest
- the pruning data.java.lang.Exception
- if something goes wrongpublic double classifyInstance(weka.core.Instance instance) throws java.lang.Exception
classifyInstance
in class weka.classifiers.trees.j48.ClassifierTree
instance
- the instance to classifyjava.lang.Exception
- if something goes wrongpublic final double[] distributionForInstance(weka.core.Instance instance, boolean useLaplace) throws java.lang.Exception
distributionForInstance
in class weka.classifiers.trees.j48.ClassifierTree
instance
- the instance to get the distribution foruseLaplace
- whether to use laplace or notjava.lang.Exception
- if something goes wrongprivate double getProbsLaplace(int classIndex, weka.core.Instance instance) throws java.lang.Exception
classIndex
- the class indexinstance
- the instance to compute the probabilities forweight
- the weight to usejava.lang.Exception
- if something goes wrongprivate double getProbs(int classIndex, weka.core.Instance instance) throws java.lang.Exception
classIndex
- the class indexinstance
- the instance to compute the probabilities forjava.lang.Exception
- if something goes wrongprivate CHAIDClassifierTree son(int index)
public java.lang.String toStringOrdinalAttributesList()
public java.lang.StringBuffer[] toSource(java.lang.String className) throws java.lang.Exception
toSource
in class weka.classifiers.trees.j48.ClassifierTree
className
- the classname that this static classifier hasjava.lang.Exception
- if something goes wrongpublic java.lang.String getRevision()
getRevision
in interface weka.core.RevisionHandler
getRevision
in class weka.classifiers.trees.j48.C45PruneableClassifierTree