类 J48
java.lang.Object
weka.classifiers.Classifier
weka.classifiers.trees.J48
- 所有已实现的接口:
Serializable
,Cloneable
,Sourcable
,AdditionalMeasureProducer
,CapabilitiesHandler
,Drawable
,Matchable
,OptionHandler
,RevisionHandler
,Summarizable
,TechnicalInformationHandler
,WeightedInstancesHandler
public class J48
extends Classifier
implements OptionHandler, Drawable, Matchable, Sourcable, WeightedInstancesHandler, Summarizable, AdditionalMeasureProducer, TechnicalInformationHandler
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. BibTeX:
Ross Quinlan (1993). C4.5: Programs for Machine Learning. Morgan Kaufmann Publishers, San Mateo, CA. BibTeX:
@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.
-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.
-Q <seed> Seed for random data shuffling (default 1).
- 版本:
- $Revision: 1.9 $
- 作者:
- Eibe Frank (eibe@cs.waikato.ac.nz)
- 另请参阅:
-
字段概要
从接口继承的字段 weka.core.Drawable
BayesNet, Newick, NOT_DRAWABLE, TREE
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明Returns the tip text for this propertyvoid
buildClassifier
(Instances instances) Generates the classifier.double
classifyInstance
(Instance instance) Classifies an instance.Returns the tip text for this propertyfinal double[]
distributionForInstance
(Instance instance) Returns class probabilities for an instance.Returns an enumeration of the additional measure namesboolean
Get the value of binarySplits.Returns default capabilities of the classifier.float
Get the value of CF.double
getMeasure
(String additionalMeasureName) Returns the value of the named measureint
Get the value of minNumObj.int
Get the value of numFolds.String[]
Gets the current settings of the Classifier.boolean
Get the value of reducedErrorPruning.Returns the revision string.boolean
Check whether instance data is to be saved.int
getSeed()
Get the value of Seed.boolean
Get the value of subtreeRaising.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
Get the value of unpruned.boolean
Get the value of useLaplace.Returns a string describing classifiergraph()
Returns graph describing the tree.int
Returns the type of graph this classifier represents.Returns an enumeration describing the available options.static void
Main method for testing this classdouble
Returns the number of leavesdouble
Returns the number of rules (same as number of leaves)double
Returns the size of the treeReturns the tip text for this propertyReturns the tip text for this propertyprefix()
Returns tree in prefix order.Returns the tip text for this propertyReturns the tip text for this propertyReturns the tip text for this propertyvoid
setBinarySplits
(boolean v) Set the value of binarySplits.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.Returns the tip text for this propertyReturns tree as an if-then statement.toString()
Returns a description of the classifier.Returns a superconcise version of the modelReturns the tip text for this propertyReturns the tip text for this property从类继承的方法 weka.classifiers.Classifier
debugTipText, forName, getDebug, makeCopies, makeCopy, setDebug
-
构造器详细资料
-
J48
public J48()
-
-
方法详细资料
-
globalInfo
Returns a string describing classifier- 返回:
- a description suitable for displaying in the explorer/experimenter gui
-
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.- 指定者:
getTechnicalInformation
在接口中TechnicalInformationHandler
- 返回:
- the technical information about this class
-
getCapabilities
Returns default capabilities of the classifier.- 指定者:
getCapabilities
在接口中CapabilitiesHandler
- 覆盖:
getCapabilities
在类中Classifier
- 返回:
- the capabilities of this classifier
- 另请参阅:
-
buildClassifier
Generates the classifier.- 指定者:
buildClassifier
在类中Classifier
- 参数:
instances
- the data to train the classifier with- 抛出:
Exception
- if classifier can't be built successfully
-
classifyInstance
Classifies an instance.- 覆盖:
classifyInstance
在类中Classifier
- 参数:
instance
- the instance to classify- 返回:
- the classification for the instance
- 抛出:
Exception
- if instance can't be classified successfully
-
distributionForInstance
Returns class probabilities for an instance.- 覆盖:
distributionForInstance
在类中Classifier
- 参数:
instance
- the instance to calculate the class probabilities for- 返回:
- the class probabilities
- 抛出:
Exception
- if distribution can't be computed successfully
-
graphType
public int graphType()Returns the type of graph this classifier represents. -
graph
Returns graph describing the tree. -
prefix
Returns tree in prefix order. -
toSource
Returns tree as an if-then statement. -
listOptions
Returns an enumeration describing the available options. Valid options are:-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
在接口中OptionHandler
- 覆盖:
listOptions
在类中Classifier
- 返回:
- an enumeration of all the available options.
-
setOptions
Parses a given list of options. Valid options are:-U Use unpruned 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.
-Q <seed> Seed for random data shuffling (default 1).
- 指定者:
setOptions
在接口中OptionHandler
- 覆盖:
setOptions
在类中Classifier
- 参数:
options
- the list of options as an array of strings- 抛出:
Exception
- if an option is not supported
-
getOptions
Gets the current settings of the Classifier.- 指定者:
getOptions
在接口中OptionHandler
- 覆盖:
getOptions
在类中Classifier
- 返回:
- an array of strings suitable for passing to setOptions
-
seedTipText
Returns the tip text for this property- 返回:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
getSeed
public int getSeed()Get the value of Seed.- 返回:
- Value of Seed.
-
setSeed
public void setSeed(int newSeed) Set the value of Seed.- 参数:
newSeed
- Value to assign to Seed.
-
useLaplaceTipText
Returns the tip text for this property- 返回:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
getUseLaplace
public boolean getUseLaplace()Get the value of useLaplace.- 返回:
- Value of useLaplace.
-
setUseLaplace
public void setUseLaplace(boolean newuseLaplace) Set the value of useLaplace.- 参数:
newuseLaplace
- Value to assign to useLaplace.
-
toString
Returns a description of the classifier. -
toSummaryString
Returns a superconcise version of the model- 指定者:
toSummaryString
在接口中Summarizable
- 返回:
- a summary of the model
-
measureTreeSize
public double measureTreeSize()Returns the size of the tree- 返回:
- the size of the tree
-
measureNumLeaves
public double measureNumLeaves()Returns the number of leaves- 返回:
- the number of leaves
-
measureNumRules
public double measureNumRules()Returns the number of rules (same as number of leaves)- 返回:
- the number of rules
-
enumerateMeasures
Returns an enumeration of the additional measure names- 指定者:
enumerateMeasures
在接口中AdditionalMeasureProducer
- 返回:
- an enumeration of the measure names
-
getMeasure
Returns the value of the named measure- 指定者:
getMeasure
在接口中AdditionalMeasureProducer
- 参数:
additionalMeasureName
- the name of the measure to query for its value- 返回:
- the value of the named measure
- 抛出:
IllegalArgumentException
- if the named measure is not supported
-
unprunedTipText
Returns the tip text for this property- 返回:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
getUnpruned
public boolean getUnpruned()Get the value of unpruned.- 返回:
- Value of unpruned.
-
setUnpruned
public void setUnpruned(boolean v) Set the value of unpruned. Turns reduced-error pruning off if set.- 参数:
v
- Value to assign to unpruned.
-
confidenceFactorTipText
Returns the tip text for this property- 返回:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
getConfidenceFactor
public float getConfidenceFactor()Get the value of CF.- 返回:
- Value of CF.
-
setConfidenceFactor
public void setConfidenceFactor(float v) Set the value of CF.- 参数:
v
- Value to assign to CF.
-
minNumObjTipText
Returns the tip text for this property- 返回:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
getMinNumObj
public int getMinNumObj()Get the value of minNumObj.- 返回:
- Value of minNumObj.
-
setMinNumObj
public void setMinNumObj(int v) Set the value of minNumObj.- 参数:
v
- Value to assign to minNumObj.
-
reducedErrorPruningTipText
Returns the tip text for this property- 返回:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
getReducedErrorPruning
public boolean getReducedErrorPruning()Get the value of reducedErrorPruning.- 返回:
- Value of reducedErrorPruning.
-
setReducedErrorPruning
public void setReducedErrorPruning(boolean v) Set the value of reducedErrorPruning. Turns unpruned trees off if set.- 参数:
v
- Value to assign to reducedErrorPruning.
-
numFoldsTipText
Returns the tip text for this property- 返回:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
getNumFolds
public int getNumFolds()Get the value of numFolds.- 返回:
- Value of numFolds.
-
setNumFolds
public void setNumFolds(int v) Set the value of numFolds.- 参数:
v
- Value to assign to numFolds.
-
binarySplitsTipText
Returns the tip text for this property- 返回:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
getBinarySplits
public boolean getBinarySplits()Get the value of binarySplits.- 返回:
- Value of binarySplits.
-
setBinarySplits
public void setBinarySplits(boolean v) Set the value of binarySplits.- 参数:
v
- Value to assign to binarySplits.
-
subtreeRaisingTipText
Returns the tip text for this property- 返回:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
getSubtreeRaising
public boolean getSubtreeRaising()Get the value of subtreeRaising.- 返回:
- Value of subtreeRaising.
-
setSubtreeRaising
public void setSubtreeRaising(boolean v) Set the value of subtreeRaising.- 参数:
v
- Value to assign to subtreeRaising.
-
saveInstanceDataTipText
Returns the tip text for this property- 返回:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
getSaveInstanceData
public boolean getSaveInstanceData()Check whether instance data is to be saved.- 返回:
- true if instance data is saved
-
setSaveInstanceData
public void setSaveInstanceData(boolean v) Set whether instance data is to be saved.- 参数:
v
- true if instance data is to be saved
-
getRevision
Returns the revision string.- 指定者:
getRevision
在接口中RevisionHandler
- 覆盖:
getRevision
在类中Classifier
- 返回:
- the revision
-
main
Main method for testing this class- 参数:
argv
- the commandline options
-