public abstract class HNode
extends java.lang.Object
implements java.io.Serializable
Modifier and Type | Field and Description |
---|---|
java.util.Map<java.lang.String,WeightMass> |
m_classDistribution
Class distribution at this node
|
Constructor and Description |
---|
HNode()
Construct a new HNode
|
HNode(java.util.Map<java.lang.String,WeightMass> classDistrib)
Construct a new HNode with the supplied class distribution
|
Modifier and Type | Method and Description |
---|---|
boolean |
classDistributionIsPure()
Returns true if the class distribution is pure
|
double[] |
getDistribution(Instance inst,
Attribute classAtt)
Return a class probability distribution computed from the frequency counts
at this node
|
void |
graphTree(java.lang.StringBuffer text) |
int |
installNodeNums(int nodeNum) |
boolean |
isLeaf()
Returns true if this is a leaf
|
LeafNode |
leafForInstance(Instance inst,
SplitNode parent,
java.lang.String parentBranch)
Return the leaf that the supplied instance ends up at
|
int |
numEntriesInClassDistribution()
The size of the class distribution
|
java.lang.String |
toString(boolean printLeaf)
Print a textual description of the tree
|
double |
totalWeight()
Return the total weight of instances seen at this node
|
void |
updateDistribution(Instance inst)
Update the class frequency distribution with the supplied instance
|
abstract void |
updateNode(Instance inst)
Update the node with the supplied instance
|
public java.util.Map<java.lang.String,WeightMass> m_classDistribution
public HNode()
public HNode(java.util.Map<java.lang.String,WeightMass> classDistrib)
classDistrib
- public boolean isLeaf()
public int numEntriesInClassDistribution()
public boolean classDistributionIsPure()
public void updateDistribution(Instance inst)
inst
- the instance to update withpublic double[] getDistribution(Instance inst, Attribute classAtt) throws java.lang.Exception
inst
- the instance to get a prediction forclassAtt
- the class attributejava.lang.Exception
- if a problem occurspublic int installNodeNums(int nodeNum)
public void graphTree(java.lang.StringBuffer text)
public java.lang.String toString(boolean printLeaf)
printLeaf
- true if leaf models (NB, NB adaptive) should be outputpublic double totalWeight()
public LeafNode leafForInstance(Instance inst, SplitNode parent, java.lang.String parentBranch)
inst
- the instance to find the leaf forparent
- the parent nodeparentBranch
- the parent branchpublic abstract void updateNode(Instance inst) throws java.lang.Exception
inst
- the instance to update withjava.lang.Exception
- if a problem occurs