Package weka.classifiers.trees.j48
Class NBTreeSplit
java.lang.Object
weka.classifiers.trees.j48.ClassifierSplitModel
weka.classifiers.trees.j48.NBTreeSplit
- All Implemented Interfaces:
Serializable,Cloneable,RevisionHandler
Class implementing a NBTree split on an attribute.
- Version:
- $Revision: 10531 $
- Author:
- Mark Hall (mhall@cs.waikato.ac.nz)
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionNBTreeSplit(int attIndex, int minNoObj, double sumOfWeights) Initializes the split model. -
Method Summary
Modifier and TypeMethodDescriptionfinal intattIndex()Returns index of attribute for which split was generated.voidbuildClassifier(Instances trainInstances) Creates a NBTree-type split on the given data.doubleReturn the probability for a class valuedoubleReturn the errors made by the naive bayes models arising from this split.Return the global naive bayes model for this nodeReturns the revision string.final StringPrints left side of condition..final StringPrints the condition satisfied by instances in a subset.voidsetGlobalModel(NBTreeNoSplit global) Set the global naive bayes model for this nodefinal StringsourceExpression(int index, Instances data) Returns a string containing java source code equivalent to the test made at this node.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, codingCost, distribution, dumpLabel, dumpModel, numSubsets, resetDistribution, setDistribution, sourceClass, split
-
Constructor Details
-
NBTreeSplit
public NBTreeSplit(int attIndex, int minNoObj, double sumOfWeights) Initializes the split model.
-
-
Method Details
-
buildClassifier
Creates a NBTree-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. -
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
-
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
-
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'
-
rightSide
Prints the condition satisfied by instances in a subset.- Specified by:
rightSidein classClassifierSplitModel- Parameters:
index- of subsetdata- training set.
-
leftSide
Prints left side of condition..- Specified by:
leftSidein classClassifierSplitModel- Parameters:
data- training set.
-
classProb
Return the probability for a class value- Overrides:
classProbin classClassifierSplitModel- Parameters:
classIndex- the index of the class valueinstance- the instance to generate a probability fortheSubset- the subset to consider- Returns:
- a probability
- Throws:
Exception- if an error occurs
-
getGlobalModel
Return the global naive bayes model for this node- Returns:
- a
NBTreeNoSplitvalue
-
setGlobalModel
Set the global naive bayes model for this node- Parameters:
global- aNBTreeNoSplitvalue
-
getErrors
public double getErrors()Return the errors made by the naive bayes models arising from this split.- Returns:
- a
doublevalue
-
getRevision
Returns the revision string.- Returns:
- the revision
-