Package weka.classifiers.trees.j48
Class NBTreeNoSplit
java.lang.Object
weka.classifiers.trees.j48.ClassifierSplitModel
weka.classifiers.trees.j48.NBTreeNoSplit
- All Implemented Interfaces:
Serializable,Cloneable,RevisionHandler
Class implementing a "no-split"-split (leaf node) for naive bayes
trees.
- Version:
- $Revision: 10531 $
- Author:
- Mark Hall (mhall@cs.waikato.ac.nz)
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal voidbuildClassifier(Instances instances) Build the no-split nodedoubleReturn the probability for a class valuestatic doublecrossValidate(NaiveBayesUpdateable fullModel, Instances trainingSet, Random r) Utility method for fast 5-fold cross validation of a naive bayes modelReturn the discretizer used at this nodedoubleReturn the errors made by the naive bayes model at this nodeGet the naive bayes model at this nodeReturns the revision string.final StringDoes nothing because no condition has to be satisfied.final StringDoes nothing because no condition has to be satisfied.final StringsourceExpression(int index, Instances data) Returns a string containing java source code equivalent to the test made at this node.toString()Return a textual description of the nodefinal double[]Always returns null because there is only one subset.final intwhichSubset(Instance instance) Always returns 0 because only there is only one subset.Methods inherited from class weka.classifiers.trees.j48.ClassifierSplitModel
checkModel, classifyInstance, classProbLaplace, clone, codingCost, distribution, dumpLabel, dumpModel, numSubsets, resetDistribution, setDistribution, sourceClass, split
-
Constructor Details
-
NBTreeNoSplit
public NBTreeNoSplit()
-
-
Method Details
-
buildClassifier
Build the no-split node- Specified by:
buildClassifierin classClassifierSplitModel- Parameters:
instances- anInstancesvalue- Throws:
Exception- if an error occurs
-
getErrors
public double getErrors()Return the errors made by the naive bayes model at this node- Returns:
- the number of errors made
-
getDiscretizer
Return the discretizer used at this node- Returns:
- a
Discretizevalue
-
getNaiveBayesModel
Get the naive bayes model at this node- Returns:
- a
NaiveBayesUpdateablevalue
-
whichSubset
Always returns 0 because only there is only one subset.- Specified by:
whichSubsetin classClassifierSplitModel
-
weights
Always returns null because there is only one subset.- Specified by:
weightsin classClassifierSplitModel
-
leftSide
Does nothing because no condition has to be satisfied.- Specified by:
leftSidein classClassifierSplitModel- Parameters:
instances- the data.
-
rightSide
Does nothing because no condition has to be satisfied.- Specified by:
rightSidein 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'
-
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
-
toString
Return a textual description of the node -
crossValidate
public static double crossValidate(NaiveBayesUpdateable fullModel, Instances trainingSet, Random r) throws Exception Utility method for fast 5-fold cross validation of a naive bayes model- Parameters:
fullModel- aNaiveBayesUpdateablevaluetrainingSet- anInstancesvaluer- aRandomvalue- Returns:
- a
doublevalue - Throws:
Exception- if an error occurs
-
getRevision
Returns the revision string.- Returns:
- the revision
-