public class TreeNode
extends java.lang.Object
implements java.io.Serializable
Constructor and Description |
---|
TreeNode(TreeNode parent,
java.util.ArrayList<weka.core.Instance> instances)
Creates node based on given collection of instances and parent node.
|
Modifier and Type | Method and Description |
---|---|
void |
calculateNodeScore(java.util.HashMap<weka.core.Instance,Bag> instanceBags,
boolean unbiasedEstimate,
int kBEPPConstant,
boolean bagCount,
double multiplier)
Calculates the node score based on the given arguments.
|
void |
deactivateRelatedInstances(java.util.HashMap<weka.core.Instance,Bag> instanceBags,
java.util.List<java.lang.String> deactivated)
Deactives all instances associated with bags that have at least one
instance in the current node.
|
boolean |
isLeafNode()
Is node a leaf?
|
boolean |
isPositiveLeaf()
Is node a positive leaf?
|
boolean |
isPureNegative(java.util.HashMap<weka.core.Instance,Bag> instanceBags)
Checks whether all the instances at the node are associated with positive
bags.
|
boolean |
isPurePositive(java.util.HashMap<weka.core.Instance,Bag> instanceBags)
Checks whether all the instances at the node are associated with negative
bags.
|
TreeNode |
left()
Returns the left child in the case of a binary split.
|
void |
makeLeafNode(boolean positiveLeaf)
Turns the node into a leaf node.
|
double |
nodeScore()
Returns the score for this node.
|
TreeNode[] |
nominals()
Returns the children in the case of a nominal-attribute split.
|
TreeNode |
parent()
Returns the parent.
|
void |
removeDeactivatedInstances(java.util.HashMap<weka.core.Instance,Bag> instanceBags)
Removes deactivated instances from the node.
|
java.lang.String |
render(int depth,
java.util.HashMap<weka.core.Instance,Bag> instanceBags)
Recursively renders this node and its branches as a tabbed out tree
|
TreeNode |
right()
Returns the right child in the case of a binary split.
|
void |
splitInstances(java.util.HashMap<weka.core.Instance,Bag> instanceBags,
AlgorithmConfiguration settings,
java.util.Random rand,
boolean debug)
Splits the instances on this node into the best possible child nodes,
according to the settings
|
boolean |
trimNegativeBranches()
Recursively removes all branches that do not contain a positive leaf.
|
public Split split
public TreeNode(TreeNode parent, java.util.ArrayList<weka.core.Instance> instances)
public double nodeScore()
public void removeDeactivatedInstances(java.util.HashMap<weka.core.Instance,Bag> instanceBags)
public void calculateNodeScore(java.util.HashMap<weka.core.Instance,Bag> instanceBags, boolean unbiasedEstimate, int kBEPPConstant, boolean bagCount, double multiplier)
public boolean isLeafNode()
public boolean isPositiveLeaf()
public boolean isPureNegative(java.util.HashMap<weka.core.Instance,Bag> instanceBags)
public boolean isPurePositive(java.util.HashMap<weka.core.Instance,Bag> instanceBags)
public void makeLeafNode(boolean positiveLeaf)
public TreeNode parent()
public TreeNode left()
public TreeNode right()
public TreeNode[] nominals()
public void deactivateRelatedInstances(java.util.HashMap<weka.core.Instance,Bag> instanceBags, java.util.List<java.lang.String> deactivated)
public void splitInstances(java.util.HashMap<weka.core.Instance,Bag> instanceBags, AlgorithmConfiguration settings, java.util.Random rand, boolean debug)
public java.lang.String render(int depth, java.util.HashMap<weka.core.Instance,Bag> instanceBags)
public boolean trimNegativeBranches()