|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectweka.clusterers.Cobweb.CNode
Inner class handling node operations for Cobweb.
Serializable
Field Summary | |
private AttributeStats[] |
m_attStats
Within cluster attribute statistics |
private FastVector |
m_children
Children of this node |
protected Instances |
m_clusterInstances
Instances at this node |
private int |
m_clusterNum
Cluster number of this node |
private int |
m_numAttributes
Number of attributes |
private double |
m_totalInstances
Total instances at this node |
Constructor Summary | |
Cobweb.CNode(int numAttributes)
Creates an empty CNode instance. |
|
Cobweb.CNode(int numAttributes,
Instance leafInstance)
Creates a new leaf CNode instance. |
Method Summary | |
protected void |
addChildNode(Cobweb.CNode child)
Adds the supplied node as a child of this node. |
protected void |
addInstance(Instance newInstance)
Adds an instance to this cluster. |
private void |
assignClusterNums(int[] cl_num)
Recursively assigns numbers to the nodes in the tree. |
protected double |
categoryUtility()
Computes the utility of all children with respect to this node |
protected double |
categoryUtilityChild(Cobweb.CNode child)
Computes the utility of a single child with respect to this node |
private double |
cuScoreForBestTwoMerged(Cobweb.CNode merged,
Cobweb.CNode a,
Cobweb.CNode b,
Instance newInstance)
|
private double[] |
cuScoresForChildren(Instance newInstance)
Temporarily adds a new instance to each of this nodes children in turn and computes the category utility. |
protected java.lang.String |
dumpData()
Returns the instances at this node as a string. |
protected void |
dumpTree(int depth,
java.lang.StringBuffer text)
Recursively build a string representation of the Cobweb tree |
private Cobweb.CNode |
findHost(Instance newInstance,
boolean structureFrozen)
Finds a host for the new instance in this nodes children. |
protected double |
getProbability(int attIndex,
int valueIndex)
Returns the probability of a value of a nominal attribute in this node |
protected double |
getStandardDev(int attIndex)
Returns the standard deviation of a numeric attribute |
protected void |
graphTree(java.lang.StringBuffer text)
Recursively generate the graph string for the Cobweb tree. |
protected void |
updateStats(Instance updateInstance,
boolean delete)
Update attribute stats using the supplied instance. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private AttributeStats[] m_attStats
private int m_numAttributes
protected Instances m_clusterInstances
private FastVector m_children
private double m_totalInstances
private int m_clusterNum
Constructor Detail |
public Cobweb.CNode(int numAttributes)
CNode
instance.
numAttributes
- the number of attributes in the datapublic Cobweb.CNode(int numAttributes, Instance leafInstance)
CNode
instance.
numAttributes
- the number of attributes in the dataleafInstance
- the instance to store at this leafMethod Detail |
protected void addInstance(Instance newInstance) throws java.lang.Exception
newInstance
- the instance to add
java.lang.Exception
- if an error occursprivate double[] cuScoresForChildren(Instance newInstance) throws java.lang.Exception
newInstance
- the new instance to evaluate
java.lang.Exception
- if an error occursprivate double cuScoreForBestTwoMerged(Cobweb.CNode merged, Cobweb.CNode a, Cobweb.CNode b, Instance newInstance) throws java.lang.Exception
java.lang.Exception
private Cobweb.CNode findHost(Instance newInstance, boolean structureFrozen) throws java.lang.Exception
newInstance
- the instance to find a host forstructureFrozen
- true if the instance is not to be added to
the tree and instead the best potential host is to be returned
java.lang.Exception
- if an error occursprotected void addChildNode(Cobweb.CNode child)
child
- the child to addprotected double categoryUtility() throws java.lang.Exception
java.lang.Exception
protected double categoryUtilityChild(Cobweb.CNode child) throws java.lang.Exception
child
- the child for which to compute the utility
java.lang.Exception
- if something goes wrongprotected double getProbability(int attIndex, int valueIndex) throws java.lang.Exception
attIndex
- the index of the attributevalueIndex
- the index of the value of the attribute
java.lang.Exception
- if the requested attribute is not nominalprotected double getStandardDev(int attIndex) throws java.lang.Exception
attIndex
- the index of the attribute
java.lang.Exception
- if an error occursprotected void updateStats(Instance updateInstance, boolean delete)
updateInstance
- the instance for updatingdelete
- true if the values of the supplied instance are
to be removed from the statisticsprivate void assignClusterNums(int[] cl_num) throws java.lang.Exception
cl_num
- an int[]
value
java.lang.Exception
- if an error occursprotected void dumpTree(int depth, java.lang.StringBuffer text)
depth
- depth of this node in the treetext
- holds the string representationprotected java.lang.String dumpData() throws java.lang.Exception
String
value
java.lang.Exception
- if an error occursprotected void graphTree(java.lang.StringBuffer text) throws java.lang.Exception
text
- holds the graph string
java.lang.Exception
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |