Package weka.classifiers.trees.ht
Class HNode
java.lang.Object
weka.classifiers.trees.ht.HNode
- All Implemented Interfaces:
Serializable
Abstract base class for nodes in a Hoeffding tree
- Author:
- Richard Kirkby (rkirkby@cs.waikato.ac.nz), Mark Hall (mhall{[at]}pentaho{[dot]}com)
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionClass distribution at this node -
Constructor Summary
ConstructorDescriptionHNode()
Construct a new HNodeHNode
(Map<String, WeightMass> classDistrib) Construct a new HNode with the supplied class distribution -
Method Summary
Modifier and TypeMethodDescriptionboolean
Returns true if the class distribution is puredouble[]
getDistribution
(Instance inst, Attribute classAtt) Return a class probability distribution computed from the frequency counts at this nodevoid
graphTree
(StringBuffer text) int
installNodeNums
(int nodeNum) boolean
isLeaf()
Returns true if this is a leafleafForInstance
(Instance inst, SplitNode parent, String parentBranch) Return the leaf that the supplied instance ends up atint
The size of the class distributiontoString
(boolean printLeaf) Print a textual description of the treedouble
Return the total weight of instances seen at this nodevoid
updateDistribution
(Instance inst) Update the class frequency distribution with the supplied instanceabstract void
updateNode
(Instance inst) Update the node with the supplied instance
-
Field Details
-
m_classDistribution
Class distribution at this node
-
-
Constructor Details
-
HNode
public HNode()Construct a new HNode -
HNode
Construct a new HNode with the supplied class distribution- Parameters:
classDistrib
-
-
-
Method Details
-
isLeaf
public boolean isLeaf()Returns true if this is a leaf- Returns:
-
numEntriesInClassDistribution
public int numEntriesInClassDistribution()The size of the class distribution- Returns:
- the number of entries in the class distribution
-
classDistributionIsPure
public boolean classDistributionIsPure()Returns true if the class distribution is pure- Returns:
- true if the class distribution is pure
-
updateDistribution
Update the class frequency distribution with the supplied instance- Parameters:
inst
- the instance to update with
-
getDistribution
Return a class probability distribution computed from the frequency counts at this node- Parameters:
inst
- the instance to get a prediction forclassAtt
- the class attribute- Returns:
- a class probability distribution
- Throws:
Exception
- if a problem occurs
-
installNodeNums
public int installNodeNums(int nodeNum) -
graphTree
-
toString
Print a textual description of the tree- Parameters:
printLeaf
- true if leaf models (NB, NB adaptive) should be output- Returns:
- a textual description of the tree
-
totalWeight
public double totalWeight()Return the total weight of instances seen at this node- Returns:
- the total weight of instances seen at this node
-
leafForInstance
Return the leaf that the supplied instance ends up at- Parameters:
inst
- the instance to find the leaf forparent
- the parent nodeparentBranch
- the parent branch- Returns:
- the leaf that the supplied instance ends up at
-
updateNode
Update the node with the supplied instance- Parameters:
inst
- the instance to update with- Throws:
Exception
- if a problem occurs
-