Package weka.classifiers.trees.j48
Class C45Split
java.lang.Object
weka.classifiers.trees.j48.ClassifierSplitModel
weka.classifiers.trees.j48.C45Split
- All Implemented Interfaces:
Serializable,Cloneable,RevisionHandler
Class implementing a C4.5-type split on an attribute.
- Version:
- $Revision: 14912 $
- Author:
- Eibe Frank (eibe@cs.waikato.ac.nz)
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionC45Split(int attIndex, int minNoObj, double sumOfWeights, boolean useMDLcorrection) Initializes the split model. -
Method Summary
Modifier and TypeMethodDescriptionfinal intattIndex()Returns index of attribute for which split was generated.voidbuildClassifier(Instances trainInstances) Creates a C4.5-type split on the given data.final doubleGets class probability for instance.final doubleReturns coding cost for split (used in rule learner).final doubleReturns (C4.5-type) gain ratio for the generated split.Returns the revision string.final doubleinfoGain()Returns (C4.5-type) information gain for the generated split.final StringPrints left side of condition..final double[][]minsAndMaxs(Instances data, double[][] minsAndMaxs, int index) Returns the minsAndMaxs of the index.th subset.voidresetDistribution(Instances data) Sets distribution associated with model.final StringPrints the condition satisfied by instances in a subset.final voidsetSplitPoint(Instances allInstances) Sets split point to greatest value in given data smaller or equal to old split point.final StringsourceExpression(int index, Instances data) Returns a string containing java source code equivalent to the test made at this node.doubleReturns the split point (numeric attribute only).final double[]Returns weights if instance is assigned to more than one subset.final intwhichSubset(Instance instance) Returns index of subset instance is assigned to.Methods inherited from class weka.classifiers.trees.j48.ClassifierSplitModel
checkModel, classifyInstance, classProbLaplace, clone, distribution, dumpLabel, dumpModel, numSubsets, setDistribution, sourceClass, split
-
Constructor Details
-
C45Split
public C45Split(int attIndex, int minNoObj, double sumOfWeights, boolean useMDLcorrection) Initializes the split model.
-
-
Method Details
-
buildClassifier
Creates a C4.5-type split on the given data. Assumes that none of the class values is missing.- Specified by:
buildClassifierin classClassifierSplitModel- Throws:
Exception- if something goes wrong
-
attIndex
public final int attIndex()Returns index of attribute for which split was generated. -
splitPoint
public double splitPoint()Returns the split point (numeric attribute only).- Returns:
- the split point used for a test on a numeric attribute
-
classProb
Gets class probability for instance.- Overrides:
classProbin classClassifierSplitModel- Throws:
Exception- if something goes wrong
-
codingCost
public final double codingCost()Returns coding cost for split (used in rule learner).- Overrides:
codingCostin classClassifierSplitModel
-
gainRatio
public final double gainRatio()Returns (C4.5-type) gain ratio for the generated split. -
infoGain
public final double infoGain()Returns (C4.5-type) information gain for the generated split. -
leftSide
Prints left side of condition..- Specified by:
leftSidein classClassifierSplitModel- Parameters:
data- training set.
-
rightSide
Prints the condition satisfied by instances in a subset.- Specified by:
rightSidein classClassifierSplitModel- Parameters:
index- of subsetdata- training set.
-
sourceExpression
Returns a string containing java source code equivalent to the test made at this node. The instance being tested is called "i".- Specified by:
sourceExpressionin classClassifierSplitModel- Parameters:
index- index of the nominal value testeddata- the data containing instance structure info- Returns:
- a value of type 'String'
-
setSplitPoint
Sets split point to greatest value in given data smaller or equal to old split point. (C4.5 does this for some strange reason). -
minsAndMaxs
Returns the minsAndMaxs of the index.th subset. -
resetDistribution
Sets distribution associated with model.- Overrides:
resetDistributionin classClassifierSplitModel- Throws:
Exception
-
weights
Returns weights if instance is assigned to more than one subset. Returns null if instance is only assigned to one subset.- Specified by:
weightsin classClassifierSplitModel
-
whichSubset
Returns index of subset instance is assigned to. Returns -1 if instance is assigned to more than one subset.- Specified by:
whichSubsetin classClassifierSplitModel- Throws:
Exception- if something goes wrong
-
getRevision
Returns the revision string.- Returns:
- the revision
-