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
-
Method Summary
Modifier and TypeMethodDescriptionfinal void
buildClassifier
(Instances instances) Build the no-split nodedouble
Return the probability for a class valuestatic double
crossValidate
(NaiveBayesUpdateable fullModel, Instances trainingSet, Random r) Utility method for fast 5-fold cross validation of a naive bayes modelReturn the discretizer used at this nodedouble
Return the errors made by the naive bayes model at this nodeGet the naive bayes model at this nodeReturns the revision string.final String
Does nothing because no condition has to be satisfied.final String
Does nothing because no condition has to be satisfied.final String
sourceExpression
(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 int
whichSubset
(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:
buildClassifier
in classClassifierSplitModel
- Parameters:
instances
- anInstances
value- 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
Discretize
value
-
getNaiveBayesModel
Get the naive bayes model at this node- Returns:
- a
NaiveBayesUpdateable
value
-
whichSubset
Always returns 0 because only there is only one subset.- Specified by:
whichSubset
in classClassifierSplitModel
-
weights
Always returns null because there is only one subset.- Specified by:
weights
in classClassifierSplitModel
-
leftSide
Does nothing because no condition has to be satisfied.- Specified by:
leftSide
in classClassifierSplitModel
- Parameters:
instances
- the data.
-
rightSide
Does nothing because no condition has to be satisfied.- Specified by:
rightSide
in 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:
sourceExpression
in 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:
classProb
in 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
- aNaiveBayesUpdateable
valuetrainingSet
- anInstances
valuer
- aRandom
value- Returns:
- a
double
value - Throws:
Exception
- if an error occurs
-
getRevision
Returns the revision string.- Returns:
- the revision
-