|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectweka.classifiers.AbstractClassifier
weka.classifiers.RandomizableClassifier
weka.classifiers.trees.SimpleCart
public class SimpleCart
Class implementing minimal cost-complexity pruning.
Note when dealing with missing values, use "fractional instances" method instead of surrogate split method.
For more information, see:
Leo Breiman, Jerome H. Friedman, Richard A. Olshen, Charles J. Stone (1984). Classification and Regression Trees. Wadsworth International Group, Belmont, California.
@book{Breiman1984, address = {Belmont, California}, author = {Leo Breiman and Jerome H. Friedman and Richard A. Olshen and Charles J. Stone}, publisher = {Wadsworth International Group}, title = {Classification and Regression Trees}, year = {1984} }Valid options are:
-S <num> Random number seed. (default 1)
-D If set, classifier is run in debug mode and may output additional info to the console
-M <min no> The minimal number of instances at the terminal nodes. (default 2)
-N <num folds> The number of folds used in the minimal cost-complexity pruning. (default 5)
-U Don't use the minimal cost-complexity pruning. (default yes).
-H Don't use the heuristic method for binary split. (default true).
-A Use 1 SE rule to make pruning decision. (default no).
-C Percentage of training data size (0-1]. (default 1).
Constructor Summary | |
---|---|
SimpleCart()
|
Method Summary | |
---|---|
void |
buildClassifier(weka.core.Instances data)
Build the classifier. |
void |
calculateAlphas()
Updates the alpha field for all nodes. |
double[] |
distributionForInstance(weka.core.Instance instance)
Computes class probabilities for instance using the decision tree. |
Enumeration |
enumerateMeasures()
Return an enumeration of the measure names. |
weka.core.Capabilities |
getCapabilities()
Returns default capabilities of the classifier. |
boolean |
getHeuristic()
Get if use heuristic search for nominal attributes in multi-class problems. |
double |
getMeasure(String additionalMeasureName)
Returns the value of the named measure. |
double |
getMinNumObj()
Get minimal number of instances at the terminal nodes. |
int |
getNumFoldsPruning()
Set number of folds in internal cross-validation. |
String[] |
getOptions()
Gets the current settings of the classifier. |
String |
getRevision()
Returns the revision string. |
double |
getSizePer()
Get training set size. |
weka.core.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. |
boolean |
getUseOneSE()
Get if use the 1SE rule to choose final model. |
boolean |
getUsePrune()
Get if use minimal cost-complexity pruning. |
String |
globalInfo()
Return a description suitable for displaying in the explorer/experimenter. |
String |
heuristicTipText()
Returns the tip text for this property |
Enumeration |
listOptions()
Returns an enumeration describing the available options. |
static void |
main(String[] args)
Main method. |
double |
measureTreeSize()
Return number of tree size. |
String |
minNumObjTipText()
Returns the tip text for this property |
void |
modelErrors()
Updates the numIncorrectModel field for all nodes when subtree (to be pruned) is rooted. |
String |
numFoldsPruningTipText()
Returns the tip text for this property |
int |
numInnerNodes()
Method to count the number of inner nodes in the tree. |
int |
numLeaves()
Compute number of leaf nodes. |
int |
numNodes()
Compute size of the tree. |
void |
prune(double alpha)
Prunes the original tree using the CART pruning scheme, given a cost-complexity parameter alpha. |
int |
prune(double[] alphas,
double[] errors,
weka.core.Instances test)
Method for performing one fold in the cross-validation of minimal cost-complexity pruning. |
void |
setHeuristic(boolean value)
Set if use heuristic search for nominal attributes in multi-class problems. |
void |
setMinNumObj(double value)
Set minimal number of instances at the terminal nodes. |
void |
setNumFoldsPruning(int value)
Set number of folds in internal cross-validation. |
void |
setOptions(String[] options)
Parses a given list of options. |
void |
setSizePer(double value)
Set training set size. |
void |
setUseOneSE(boolean value)
Set if use the 1SE rule to choose final model. |
void |
setUsePrune(boolean value)
Set if use minimal cost-complexity pruning. |
String |
sizePerTipText()
Returns the tip text for this property |
String |
toString()
Prints the decision tree using the protected toString method from below. |
void |
treeErrors()
Updates the numIncorrectTree field for all nodes. |
String |
useOneSETipText()
Returns the tip text for this property |
String |
usePruneTipText()
Return the tip text for this property |
Methods inherited from class weka.classifiers.RandomizableClassifier |
---|
getSeed, seedTipText, setSeed |
Methods inherited from class weka.classifiers.AbstractClassifier |
---|
classifyInstance, debugTipText, forName, getDebug, makeCopies, makeCopy, runClassifier, setDebug |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public SimpleCart()
Method Detail |
---|
public String globalInfo()
public weka.core.TechnicalInformation getTechnicalInformation()
getTechnicalInformation
in interface weka.core.TechnicalInformationHandler
public weka.core.Capabilities getCapabilities()
getCapabilities
in interface weka.classifiers.Classifier
getCapabilities
in interface weka.core.CapabilitiesHandler
getCapabilities
in class weka.classifiers.AbstractClassifier
public void buildClassifier(weka.core.Instances data) throws Exception
buildClassifier
in interface weka.classifiers.Classifier
data
- the training instances
Exception
- if something goes wrongpublic void prune(double alpha) throws Exception
alpha
- the cost-complexity parameter
Exception
- if something goes wrongpublic int prune(double[] alphas, double[] errors, weka.core.Instances test) throws Exception
alphas
- array to hold the generated alpha-valueserrors
- array to hold the corresponding error estimatestest
- test set of that fold (to obtain error estimates)
Exception
- if something goes wrongpublic void modelErrors() throws Exception
Exception
- if something goes wrongpublic void treeErrors() throws Exception
Exception
- if something goes wrongpublic void calculateAlphas() throws Exception
Exception
- if something goes wrongpublic double[] distributionForInstance(weka.core.Instance instance) throws Exception
distributionForInstance
in interface weka.classifiers.Classifier
distributionForInstance
in class weka.classifiers.AbstractClassifier
instance
- the instance for which class probabilities is to be computed
Exception
- if something goes wrongpublic String toString()
toString
in class Object
public int numNodes()
public int numInnerNodes()
public int numLeaves()
public Enumeration listOptions()
listOptions
in interface weka.core.OptionHandler
listOptions
in class weka.classifiers.RandomizableClassifier
public void setOptions(String[] options) throws Exception
-S <num> Random number seed. (default 1)
-D If set, classifier is run in debug mode and may output additional info to the console
-M <min no> The minimal number of instances at the terminal nodes. (default 2)
-N <num folds> The number of folds used in the minimal cost-complexity pruning. (default 5)
-U Don't use the minimal cost-complexity pruning. (default yes).
-H Don't use the heuristic method for binary split. (default true).
-A Use 1 SE rule to make pruning decision. (default no).
-C Percentage of training data size (0-1]. (default 1).
setOptions
in interface weka.core.OptionHandler
setOptions
in class weka.classifiers.RandomizableClassifier
options
- the list of options as an array of strings
Exception
- if an options is not supportedpublic String[] getOptions()
getOptions
in interface weka.core.OptionHandler
getOptions
in class weka.classifiers.RandomizableClassifier
public Enumeration enumerateMeasures()
enumerateMeasures
in interface weka.core.AdditionalMeasureProducer
public double measureTreeSize()
public double getMeasure(String additionalMeasureName)
getMeasure
in interface weka.core.AdditionalMeasureProducer
additionalMeasureName
- the name of the measure to query for its value
IllegalArgumentException
- if the named measure is not supportedpublic String minNumObjTipText()
public void setMinNumObj(double value)
value
- minimal number of instances at the terminal nodespublic double getMinNumObj()
public String numFoldsPruningTipText()
public void setNumFoldsPruning(int value)
value
- number of folds in internal cross-validation.public int getNumFoldsPruning()
public String usePruneTipText()
public void setUsePrune(boolean value)
value
- if use minimal cost-complexity pruningpublic boolean getUsePrune()
public String heuristicTipText()
public void setHeuristic(boolean value)
value
- if use heuristic search for nominal attributes in
multi-class problemspublic boolean getHeuristic()
public String useOneSETipText()
public void setUseOneSE(boolean value)
value
- if use the 1SE rule to choose final modelpublic boolean getUseOneSE()
public String sizePerTipText()
public void setSizePer(double value)
value
- training set sizepublic double getSizePer()
public String getRevision()
getRevision
in interface weka.core.RevisionHandler
getRevision
in class weka.classifiers.AbstractClassifier
public static void main(String[] args)
args
- the options for the classifier
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |