|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectweka.classifiers.AbstractClassifier
weka.classifiers.trees.J48
public class J48
Class for generating a pruned or unpruned C4.5 decision tree. For more information, see
Ross Quinlan (1993). C4.5: Programs for Machine Learning. Morgan Kaufmann Publishers, San Mateo, CA.
@book{Quinlan1993,
address = {San Mateo, CA},
author = {Ross Quinlan},
publisher = {Morgan Kaufmann Publishers},
title = {C4.5: Programs for Machine Learning},
year = {1993}
}
Valid options are:
-U Use unpruned tree.
-O Do not collapse tree.
-C <pruning confidence> Set confidence threshold for pruning. (default 0.25)
-M <minimum number of instances> Set minimum number of instances per leaf. (default 2)
-R Use reduced error pruning.
-N <number of folds> Set number of folds for reduced error pruning. One fold is used as pruning set. (default 3)
-B Use binary splits only.
-S Don't perform subtree raising.
-L Do not clean up after the tree has been built.
-A Laplace smoothing for predicted probabilities.
-J Do not use MDL correction for info gain on numeric attributes.
-Q <seed> Seed for random data shuffling (default 1).
| Field Summary |
|---|
| Fields inherited from interface weka.core.Drawable |
|---|
BayesNet, Newick, NOT_DRAWABLE, TREE |
| Constructor Summary | |
|---|---|
J48()
|
|
| Method Summary | |
|---|---|
String |
binarySplitsTipText()
Returns the tip text for this property |
void |
buildClassifier(Instances instances)
Generates the classifier. |
double |
classifyInstance(Instance instance)
Classifies an instance. |
String |
collapseTreeTipText()
Returns the tip text for this property |
String |
confidenceFactorTipText()
Returns the tip text for this property |
double[] |
distributionForInstance(Instance instance)
Returns class probabilities for an instance. |
Enumeration |
enumerateMeasures()
Returns an enumeration of the additional measure names |
boolean |
getBinarySplits()
Get the value of binarySplits. |
Capabilities |
getCapabilities()
Returns default capabilities of the classifier. |
boolean |
getCollapseTree()
Get the value of collapseTree. |
float |
getConfidenceFactor()
Get the value of CF. |
double |
getMeasure(String additionalMeasureName)
Returns the value of the named measure |
int |
getMinNumObj()
Get the value of minNumObj. |
int |
getNumFolds()
Get the value of numFolds. |
String[] |
getOptions()
Gets the current settings of the Classifier. |
boolean |
getReducedErrorPruning()
Get the value of reducedErrorPruning. |
String |
getRevision()
Returns the revision string. |
boolean |
getSaveInstanceData()
Check whether instance data is to be saved. |
int |
getSeed()
Get the value of Seed. |
boolean |
getSubtreeRaising()
Get the value of subtreeRaising. |
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 |
getUnpruned()
Get the value of unpruned. |
boolean |
getUseLaplace()
Get the value of useLaplace. |
boolean |
getUseMDLcorrection()
Get the value of useMDLcorrection. |
String |
globalInfo()
Returns a string describing classifier |
String |
graph()
Returns graph describing the tree. |
int |
graphType()
Returns the type of graph this classifier represents. |
Enumeration |
listOptions()
Returns an enumeration describing the available options. |
static void |
main(String[] argv)
Main method for testing this class |
double |
measureNumLeaves()
Returns the number of leaves |
double |
measureNumRules()
Returns the number of rules (same as number of leaves) |
double |
measureTreeSize()
Returns the size of the tree |
String |
minNumObjTipText()
Returns the tip text for this property |
String |
numFoldsTipText()
Returns the tip text for this property |
String |
prefix()
Returns tree in prefix order. |
String |
reducedErrorPruningTipText()
Returns the tip text for this property |
String |
saveInstanceDataTipText()
Returns the tip text for this property |
String |
seedTipText()
Returns the tip text for this property |
void |
setBinarySplits(boolean v)
Set the value of binarySplits. |
void |
setCollapseTree(boolean v)
Set the value of collapseTree. |
void |
setConfidenceFactor(float v)
Set the value of CF. |
void |
setMinNumObj(int v)
Set the value of minNumObj. |
void |
setNumFolds(int v)
Set the value of numFolds. |
void |
setOptions(String[] options)
Parses a given list of options. |
void |
setReducedErrorPruning(boolean v)
Set the value of reducedErrorPruning. |
void |
setSaveInstanceData(boolean v)
Set whether instance data is to be saved. |
void |
setSeed(int newSeed)
Set the value of Seed. |
void |
setSubtreeRaising(boolean v)
Set the value of subtreeRaising. |
void |
setUnpruned(boolean v)
Set the value of unpruned. |
void |
setUseLaplace(boolean newuseLaplace)
Set the value of useLaplace. |
void |
setUseMDLcorrection(boolean newuseMDLcorrection)
Set the value of useMDLcorrection. |
String |
subtreeRaisingTipText()
Returns the tip text for this property |
String |
toSource(String className)
Returns tree as an if-then statement. |
String |
toString()
Returns a description of the classifier. |
String |
toSummaryString()
Returns a superconcise version of the model |
String |
unprunedTipText()
Returns the tip text for this property |
String |
useLaplaceTipText()
Returns the tip text for this property |
String |
useMDLcorrectionTipText()
Returns the tip text for this property |
| Methods inherited from class weka.classifiers.AbstractClassifier |
|---|
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 J48()
| Method Detail |
|---|
public String globalInfo()
public TechnicalInformation getTechnicalInformation()
getTechnicalInformation in interface TechnicalInformationHandlerpublic Capabilities getCapabilities()
getCapabilities in interface ClassifiergetCapabilities in interface CapabilitiesHandlergetCapabilities in class AbstractClassifierCapabilities
public void buildClassifier(Instances instances)
throws Exception
buildClassifier in interface Classifierinstances - the data to train the classifier with
Exception - if classifier can't be built successfully
public double classifyInstance(Instance instance)
throws Exception
classifyInstance in interface ClassifierclassifyInstance in class AbstractClassifierinstance - the instance to classify
Exception - if instance can't be classified successfully
public final double[] distributionForInstance(Instance instance)
throws Exception
distributionForInstance in interface ClassifierdistributionForInstance in class AbstractClassifierinstance - the instance to calculate the class probabilities for
Exception - if distribution can't be computed successfullypublic int graphType()
graphType in interface Drawable
public String graph()
throws Exception
graph in interface DrawableException - if graph can't be computed
public String prefix()
throws Exception
prefix in interface MatchableException - if something goes wrong
public String toSource(String className)
throws Exception
toSource in interface SourcableclassName - the name of the Java class
Exception - if something goes wrongpublic Enumeration listOptions()
-U
Use unpruned tree.
-C confidence
Set confidence threshold for pruning. (Default: 0.25)
-M number
Set minimum number of instances per leaf. (Default: 2)
-R
Use reduced error pruning. No subtree raising is performed.
-N number
Set number of folds for reduced error pruning. One fold is
used as the pruning set. (Default: 3)
-B
Use binary splits for nominal attributes.
-S
Don't perform subtree raising.
-L
Do not clean up after the tree has been built.
-A
If set, Laplace smoothing is used for predicted probabilites.
-Q
The seed for reduced-error pruning.
listOptions in interface OptionHandlerlistOptions in class AbstractClassifier
public void setOptions(String[] options)
throws Exception
-U Use unpruned tree.
-O Do not collapse tree.
-C <pruning confidence> Set confidence threshold for pruning. (default 0.25)
-M <minimum number of instances> Set minimum number of instances per leaf. (default 2)
-R Use reduced error pruning.
-N <number of folds> Set number of folds for reduced error pruning. One fold is used as pruning set. (default 3)
-B Use binary splits only.
-S Don't perform subtree raising.
-L Do not clean up after the tree has been built.
-A Laplace smoothing for predicted probabilities.
-J Do not use MDL correction for info gain on numeric attributes.
-Q <seed> Seed for random data shuffling (default 1).
setOptions in interface OptionHandlersetOptions in class AbstractClassifieroptions - the list of options as an array of strings
Exception - if an option is not supportedpublic String[] getOptions()
getOptions in interface OptionHandlergetOptions in class AbstractClassifierpublic String seedTipText()
public int getSeed()
public void setSeed(int newSeed)
newSeed - Value to assign to Seed.public String useLaplaceTipText()
public boolean getUseLaplace()
public void setUseLaplace(boolean newuseLaplace)
newuseLaplace - Value to assign to useLaplace.public String useMDLcorrectionTipText()
public boolean getUseMDLcorrection()
public void setUseMDLcorrection(boolean newuseMDLcorrection)
newuseMDLcorrection - Value to assign to useMDLcorrection.public String toString()
toString in class Objectpublic String toSummaryString()
toSummaryString in interface Summarizablepublic double measureTreeSize()
public double measureNumLeaves()
public double measureNumRules()
public Enumeration enumerateMeasures()
enumerateMeasures in interface AdditionalMeasureProducerpublic double getMeasure(String additionalMeasureName)
getMeasure in interface AdditionalMeasureProduceradditionalMeasureName - the name of the measure to query for its value
IllegalArgumentException - if the named measure is not supportedpublic String unprunedTipText()
public boolean getUnpruned()
public void setUnpruned(boolean v)
v - Value to assign to unpruned.public String collapseTreeTipText()
public boolean getCollapseTree()
public void setCollapseTree(boolean v)
v - Value to assign to collapseTree.public String confidenceFactorTipText()
public float getConfidenceFactor()
public void setConfidenceFactor(float v)
v - Value to assign to CF.public String minNumObjTipText()
public int getMinNumObj()
public void setMinNumObj(int v)
v - Value to assign to minNumObj.public String reducedErrorPruningTipText()
public boolean getReducedErrorPruning()
public void setReducedErrorPruning(boolean v)
v - Value to assign to reducedErrorPruning.public String numFoldsTipText()
public int getNumFolds()
public void setNumFolds(int v)
v - Value to assign to numFolds.public String binarySplitsTipText()
public boolean getBinarySplits()
public void setBinarySplits(boolean v)
v - Value to assign to binarySplits.public String subtreeRaisingTipText()
public boolean getSubtreeRaising()
public void setSubtreeRaising(boolean v)
v - Value to assign to subtreeRaising.public String saveInstanceDataTipText()
public boolean getSaveInstanceData()
public void setSaveInstanceData(boolean v)
v - true if instance data is to be savedpublic String getRevision()
getRevision in interface RevisionHandlergetRevision in class AbstractClassifierpublic static void main(String[] argv)
argv - the commandline options
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||