public class NBTreeSplit extends ClassifierSplitModel
Constructor and Description |
---|
NBTreeSplit(int attIndex,
int minNoObj,
double sumOfWeights)
Initializes the split model.
|
Modifier and Type | Method and Description |
---|---|
int |
attIndex()
Returns index of attribute for which split was generated.
|
void |
buildClassifier(Instances trainInstances)
Creates a NBTree-type split on the given data.
|
double |
classProb(int classIndex,
Instance instance,
int theSubset)
Return the probability for a class value
|
double |
getErrors()
Return the errors made by the naive bayes models arising
from this split.
|
NBTreeNoSplit |
getGlobalModel()
Return the global naive bayes model for this node
|
java.lang.String |
getRevision()
Returns the revision string.
|
java.lang.String |
leftSide(Instances data)
Prints left side of condition..
|
java.lang.String |
rightSide(int index,
Instances data)
Prints the condition satisfied by instances in a subset.
|
void |
setGlobalModel(NBTreeNoSplit global)
Set the global naive bayes model for this node
|
java.lang.String |
sourceExpression(int index,
Instances data)
Returns a string containing java source code equivalent to the test
made at this node.
|
double[] |
weights(Instance instance)
Returns weights if instance is assigned to more than one subset.
|
int |
whichSubset(Instance instance)
Returns index of subset instance is assigned to.
|
checkModel, classifyInstance, classProbLaplace, clone, codingCost, distribution, dumpLabel, dumpModel, numSubsets, resetDistribution, sourceClass, split
public NBTreeSplit(int attIndex, int minNoObj, double sumOfWeights)
public void buildClassifier(Instances trainInstances) throws java.lang.Exception
buildClassifier
in class ClassifierSplitModel
java.lang.Exception
- if something goes wrongpublic final int attIndex()
public final int whichSubset(Instance instance) throws java.lang.Exception
whichSubset
in class ClassifierSplitModel
java.lang.Exception
- if something goes wrongpublic final double[] weights(Instance instance)
weights
in class ClassifierSplitModel
public final java.lang.String sourceExpression(int index, Instances data)
sourceExpression
in class ClassifierSplitModel
index
- index of the nominal value testeddata
- the data containing instance structure infopublic final java.lang.String rightSide(int index, Instances data)
rightSide
in class ClassifierSplitModel
index
- of subsetdata
- training set.public final java.lang.String leftSide(Instances data)
leftSide
in class ClassifierSplitModel
data
- training set.public double classProb(int classIndex, Instance instance, int theSubset) throws java.lang.Exception
classProb
in class ClassifierSplitModel
classIndex
- the index of the class valueinstance
- the instance to generate a probability fortheSubset
- the subset to considerjava.lang.Exception
- if an error occurspublic NBTreeNoSplit getGlobalModel()
NBTreeNoSplit
valuepublic void setGlobalModel(NBTreeNoSplit global)
global
- a NBTreeNoSplit
valuepublic double getErrors()
double
valuepublic java.lang.String getRevision()