Class J48WithNDCs
- java.lang.Object
-
- org.processmining.plugins.workshop.Yaguang.WekaDiscriminationTree.Classifier
-
- org.processmining.plugins.workshop.Yaguang.WekaDiscriminationTree.J48WithNDCs
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,AdditionalMeasureProducer,Drawable,Matchable,OptionHandler,Sourcable,Summarizable,WeightedInstancesHandler
public class J48WithNDCs extends Classifier implements OptionHandler, Drawable, Matchable, Sourcable, WeightedInstancesHandler, Summarizable, AdditionalMeasureProducer
Class for generating an unpruned or a pruned C4.5 decision tree. For more information, seeRoss Quinlan (1993). C4.5: Programs for Machine Learning, Morgan Kaufmann Publishers, San Mateo, CA.
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.- Version:
- $Revision: 1.2 $
- Author:
- Eibe Frank (eibe@cs.waikato.ac.nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static booleancsa_prunestatic intIGCstatic intIGCDivideIGSstatic intIGCMinusIGSstatic intIGCPlusIGSstatic doublem_epsilonstatic booleanm_relabelstatic intm_splitCriterionstatic booleans_prunestatic floatt_v_combstatic Tag[]TAGS_SPLITING-
Fields inherited from class org.processmining.plugins.workshop.Yaguang.WekaDiscriminationTree.Classifier
m_Debug, m_SaAbsent, m_SaRemove
-
Fields inherited from interface org.processmining.plugins.workshop.Yaguang.WekaDiscriminationTree.Drawable
BayesNet, NOT_DRAWABLE, TREE
-
-
Constructor Summary
Constructors Constructor Description J48WithNDCs()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringbinarySplitsTipText()Returns the tip text for this propertyvoidbuildClassifier(Instances instances)Generates the classifier.doubleclassifyInstance(Instance instance)Classifies an instance.voidcolorGraph(J48WithNDCs other)Color the classifier in comparison to another classifierdoublecomputeDisc(java.lang.Double[][] result)java.lang.StringconfidenceFactorTipText()Returns the tip text for this propertyjava.lang.Double[][]discriminationInfo(Instances instances)java.lang.Double[][]discriminationInfo(Instances instances, Instances newInstances)gives the information about the discrimination by classifier input : instances, the data set output : [0][0] number of favorable accepted by classifier [0][1] total number of favorable in data set [1][0] number of protected accepted by classifier [1][1] total number of protected in data setdouble[]distributionForInstance(Instance instance)Returns class probabilities for an instance.double[][]doDistributionForInstance(Instance instance)java.util.EnumerationenumerateMeasures()Returns an enumeration of the additional measure namesjava.lang.StringepsilonTipText()Returns the tip text for this propertybooleangetBinarySplits()Get the value of binarySplits.ClassifierTreegetClassifierTree()floatgetConfidenceFactor()Get the value of CF.doublegetepsilon()doublegetMeasure(java.lang.String additionalMeasureName)Returns the value of the named measureintgetMinNumObj()Get the value of minNumObj.intgetNDCtoDC()intgetNumFolds()Get the value of numFolds.java.lang.String[]getOptions()Gets the current settings of the Classifier.booleangetReducedErrorPruning()Get the value of reducedErrorPruning.booleangetrelabel()Get the value of Seed.booleangetSaveInstanceData()Check whether instance data is to be saved.intgetSeed()Get the value of Seed.SelectedTaggetsplitCriterion()Gets the splitting criterion used.booleangetSubtreeRaising()Get the value of subtreeRaising.booleangetUnpruned()Get the value of unpruned.booleangetUseLaplace()Get the value of useLaplace.java.lang.StringglobalInfo()Returns a string describing classifierjava.lang.Stringgraph()Returns graph describing the tree.intgraphType()Returns the type of graph this classifier represents.java.util.Map<java.lang.Double,java.lang.Double[]>infoErrorSensitive(Instances instances)java.util.Map<java.lang.Double,java.lang.Double[]>infoErrorSensitive(Instances instances, Instances newInstances)java.util.EnumerationlistOptions()Returns an enumeration describing the available options.static voidmain(java.lang.String[] argv)Main method for testing this classdoublemeasureNumLeaves()Returns the number of leavesdoublemeasureNumRules()Returns the number of rules (same as number of leaves)doublemeasureTreeSize()Returns the size of the treejava.lang.StringminNumObjTipText()Returns the tip text for this propertyjava.lang.StringnumFoldsTipText()Returns the tip text for this propertyjava.lang.Stringprefix()Returns tree in prefix order.java.lang.StringreducedErrorPruningTipText()Returns the tip text for this propertyjava.lang.StringrelabelTipText()Returns the tip text for this propertyjava.lang.StringsaveInstanceDataTipText()Returns the tip text for this propertyjava.lang.StringseedTipText()Returns the tip text for this propertyvoidsetBinarySplits(boolean v)Set the value of binarySplits.voidsetConfidenceFactor(float v)Set the value of CF.voidsetepsilon(double a)voidsetMinNumObj(int v)Set the value of minNumObj.voidsetNDCtoDC(int i)voidsetNumFolds(int v)Set the value of numFolds.voidsetOptions(java.lang.String[] options)Parses a given list of options.voidsetReducedErrorPruning(boolean v)Set the value of reducedErrorPruning.voidsetrelabel(boolean r)voidsetSaveInstanceData(boolean v)Set whether instance data is to be saved.voidsetSeed(int newSeed)Set the value of Seed.voidsetsplitCriterion(SelectedTag newMethod)Sets the splitting criterion used.voidsetSubtreeRaising(boolean v)Set the value of subtreeRaising.voidsetUnpruned(boolean v)Set the value of unpruned.voidsetUseLaplace(boolean newuseLaplace)Set the value of useLaplace.java.lang.StringsplitCriterionTipText()Returns the tip text for this propertyjava.lang.StringsubtreeRaisingTipText()Returns the tip text for this propertyjava.lang.StringtoSource(java.lang.String className)Returns tree as an if-then statement.java.lang.StringtoString()Returns a description of the classifier.java.lang.StringtoSummaryString()Returns a superconcise version of the modeljava.lang.StringunprunedTipText()Returns the tip text for this propertyjava.lang.StringuseLaplaceTipText()Returns the tip text for this property-
Methods inherited from class org.processmining.plugins.workshop.Yaguang.WekaDiscriminationTree.Classifier
debugTipText, forName, getDebug, getSaAbsent, makeCopies, makeCopy, saAbsentTipText, setDebug, setSaAbsent
-
-
-
-
Field Detail
-
t_v_comb
public static float t_v_comb
-
m_epsilon
public static double m_epsilon
-
csa_prune
public static boolean csa_prune
-
m_relabel
public static boolean m_relabel
-
s_prune
public static boolean s_prune
-
m_splitCriterion
public static int m_splitCriterion
-
IGC
public static final int IGC
- See Also:
- Constant Field Values
-
IGCPlusIGS
public static final int IGCPlusIGS
- See Also:
- Constant Field Values
-
IGCMinusIGS
public static final int IGCMinusIGS
- See Also:
- Constant Field Values
-
IGCDivideIGS
public static final int IGCDivideIGS
- See Also:
- Constant Field Values
-
TAGS_SPLITING
public static final Tag[] TAGS_SPLITING
-
-
Method Detail
-
doDistributionForInstance
public final double[][] doDistributionForInstance(Instance instance) throws java.lang.Exception
- Overrides:
doDistributionForInstancein classClassifier- Throws:
java.lang.Exception
-
getNDCtoDC
public int getNDCtoDC()
-
setNDCtoDC
public void setNDCtoDC(int i)
-
globalInfo
public java.lang.String globalInfo()
Returns a string describing classifier- Returns:
- a description suitable for displaying in the explorer/experimenter gui
-
buildClassifier
public void buildClassifier(Instances instances) throws java.lang.Exception
Generates the classifier.- Specified by:
buildClassifierin classClassifier- Parameters:
instances- set of instances serving as training data- Throws:
java.lang.Exception- if classifier can't be built successfully
-
infoErrorSensitive
public java.util.Map<java.lang.Double,java.lang.Double[]> infoErrorSensitive(Instances instances, Instances newInstances) throws java.lang.Exception
- Throws:
java.lang.Exception
-
infoErrorSensitive
public java.util.Map<java.lang.Double,java.lang.Double[]> infoErrorSensitive(Instances instances) throws java.lang.Exception
- Throws:
java.lang.Exception
-
discriminationInfo
public java.lang.Double[][] discriminationInfo(Instances instances, Instances newInstances) throws java.lang.Exception
gives the information about the discrimination by classifier input : instances, the data set output : [0][0] number of favorable accepted by classifier [0][1] total number of favorable in data set [1][0] number of protected accepted by classifier [1][1] total number of protected in data set- Throws:
java.lang.Exception
-
computeDisc
public double computeDisc(java.lang.Double[][] result)
-
discriminationInfo
public java.lang.Double[][] discriminationInfo(Instances instances) throws java.lang.Exception
- Throws:
java.lang.Exception
-
classifyInstance
public double classifyInstance(Instance instance) throws java.lang.Exception
Classifies an instance.- Overrides:
classifyInstancein classClassifier- Parameters:
instance- the instance to be classified- Returns:
- the predicted most likely class for the instance or Instance.missingValue() if no prediction is made
- Throws:
java.lang.Exception- if instance can't be classified successfully
-
distributionForInstance
public final double[] distributionForInstance(Instance instance) throws java.lang.Exception
Returns class probabilities for an instance.- Overrides:
distributionForInstancein classClassifier- Parameters:
instance- the instance to be classified- Returns:
- an array containing the estimated membership probabilities of the test instance in each class or the numeric prediction
- Throws:
java.lang.Exception- if distribution can't be computed successfully
-
graphType
public int graphType()
Returns the type of graph this classifier represents.
-
getClassifierTree
public ClassifierTree getClassifierTree()
-
graph
public java.lang.String graph() throws java.lang.ExceptionReturns graph describing the tree.
-
colorGraph
public void colorGraph(J48WithNDCs other) throws java.lang.Exception
Color the classifier in comparison to another classifier- Throws:
java.lang.Exception- if graph can't be computed
-
prefix
public java.lang.String prefix() throws java.lang.ExceptionReturns tree in prefix order.
-
toSource
public java.lang.String toSource(java.lang.String className) throws java.lang.ExceptionReturns tree as an if-then statement.
-
listOptions
public java.util.Enumeration 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.- Specified by:
listOptionsin interfaceOptionHandler- Overrides:
listOptionsin classClassifier- Returns:
- an enumeration of all the available options.
-
setOptions
public void setOptions(java.lang.String[] options) throws java.lang.ExceptionParses a given list of options.- Specified by:
setOptionsin interfaceOptionHandler- Overrides:
setOptionsin classClassifier- Parameters:
options- the list of options as an array of strings- Throws:
java.lang.Exception- if an option is not supported
-
getOptions
public java.lang.String[] getOptions()
Gets the current settings of the Classifier.- Specified by:
getOptionsin interfaceOptionHandler- Overrides:
getOptionsin classClassifier- Returns:
- an array of strings suitable for passing to setOptions
-
seedTipText
public java.lang.String seedTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
getSeed
public int getSeed()
Get the value of Seed.- Returns:
- Value of Seed.
-
relabelTipText
public java.lang.String relabelTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
getrelabel
public boolean getrelabel()
Get the value of Seed.- Returns:
- Value of Seed.
-
setrelabel
public void setrelabel(boolean r)
-
splitCriterionTipText
public java.lang.String splitCriterionTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
getsplitCriterion
public SelectedTag getsplitCriterion()
Gets the splitting criterion used. Will be one of IGC, IGC+IGS, IGC-IGS or IGC/IGS- Returns:
- the splitting criterion used.
-
setsplitCriterion
public void setsplitCriterion(SelectedTag newMethod)
Sets the splitting criterion used. Will be one of IGC, IGC+IGS, IGC-IGS or IGC/IGS- Parameters:
splitting- criterion method to use
-
epsilonTipText
public java.lang.String epsilonTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
getepsilon
public double getepsilon()
-
setepsilon
public void setepsilon(double a)
-
setSeed
public void setSeed(int newSeed)
Set the value of Seed.- Parameters:
newSeed- Value to assign to Seed.
-
useLaplaceTipText
public java.lang.String useLaplaceTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
getUseLaplace
public boolean getUseLaplace()
Get the value of useLaplace.- Returns:
- Value of useLaplace.
-
setUseLaplace
public void setUseLaplace(boolean newuseLaplace)
Set the value of useLaplace.- Parameters:
newuseLaplace- Value to assign to useLaplace.
-
toString
public java.lang.String toString()
Returns a description of the classifier.- Overrides:
toStringin classjava.lang.Object
-
toSummaryString
public java.lang.String toSummaryString()
Returns a superconcise version of the model- Specified by:
toSummaryStringin interfaceSummarizable- Returns:
- the object summarized as a string
-
measureTreeSize
public double measureTreeSize()
Returns the size of the tree- Returns:
- the size of the tree
-
measureNumLeaves
public double measureNumLeaves()
Returns the number of leaves- Returns:
- the number of leaves
-
measureNumRules
public double measureNumRules()
Returns the number of rules (same as number of leaves)- Returns:
- the number of rules
-
enumerateMeasures
public java.util.Enumeration enumerateMeasures()
Returns an enumeration of the additional measure names- Specified by:
enumerateMeasuresin interfaceAdditionalMeasureProducer- Returns:
- an enumeration of the measure names
-
getMeasure
public double getMeasure(java.lang.String additionalMeasureName)
Returns the value of the named measure- Specified by:
getMeasurein interfaceAdditionalMeasureProducer- Parameters:
measureName- the name of the measure to query for its value- Returns:
- the value of the named measure
- Throws:
java.lang.IllegalArgumentException- if the named measure is not supported
-
unprunedTipText
public java.lang.String unprunedTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
getUnpruned
public boolean getUnpruned()
Get the value of unpruned.- Returns:
- Value of unpruned.
-
setUnpruned
public void setUnpruned(boolean v)
Set the value of unpruned. Turns reduced-error pruning off if set.- Parameters:
v- Value to assign to unpruned.
-
confidenceFactorTipText
public java.lang.String confidenceFactorTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
getConfidenceFactor
public float getConfidenceFactor()
Get the value of CF.- Returns:
- Value of CF.
-
setConfidenceFactor
public void setConfidenceFactor(float v)
Set the value of CF.- Parameters:
v- Value to assign to CF.
-
minNumObjTipText
public java.lang.String minNumObjTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
getMinNumObj
public int getMinNumObj()
Get the value of minNumObj.- Returns:
- Value of minNumObj.
-
setMinNumObj
public void setMinNumObj(int v)
Set the value of minNumObj.- Parameters:
v- Value to assign to minNumObj.
-
reducedErrorPruningTipText
public java.lang.String reducedErrorPruningTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
getReducedErrorPruning
public boolean getReducedErrorPruning()
Get the value of reducedErrorPruning.- Returns:
- Value of reducedErrorPruning.
-
setReducedErrorPruning
public void setReducedErrorPruning(boolean v)
Set the value of reducedErrorPruning. Turns unpruned trees off if set.- Parameters:
v- Value to assign to reducedErrorPruning.
-
numFoldsTipText
public java.lang.String numFoldsTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
getNumFolds
public int getNumFolds()
Get the value of numFolds.- Returns:
- Value of numFolds.
-
setNumFolds
public void setNumFolds(int v)
Set the value of numFolds.- Parameters:
v- Value to assign to numFolds.
-
binarySplitsTipText
public java.lang.String binarySplitsTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
getBinarySplits
public boolean getBinarySplits()
Get the value of binarySplits.- Returns:
- Value of binarySplits.
-
setBinarySplits
public void setBinarySplits(boolean v)
Set the value of binarySplits.- Parameters:
v- Value to assign to binarySplits.
-
subtreeRaisingTipText
public java.lang.String subtreeRaisingTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
getSubtreeRaising
public boolean getSubtreeRaising()
Get the value of subtreeRaising.- Returns:
- Value of subtreeRaising.
-
setSubtreeRaising
public void setSubtreeRaising(boolean v)
Set the value of subtreeRaising.- Parameters:
v- Value to assign to subtreeRaising.
-
saveInstanceDataTipText
public java.lang.String saveInstanceDataTipText()
Returns the tip text for this property- Returns:
- 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.- Returns:
- true if instance data is saved
-
setSaveInstanceData
public void setSaveInstanceData(boolean v)
Set whether instance data is to be saved.- Parameters:
v- true if instance data is to be saved
-
main
public static void main(java.lang.String[] argv)
Main method for testing this class- Parameters:
String- options
-
-