Class DecisionNode

java.lang.Object
   |
   +----DecisionNode

public class DecisionNode
extends Object
This class provides the nodes for the decision tree.


Constructor Index

 o DecisionNode(StringBag)

Method Index

 o chooseCategory()
 o getCategories()
 o getDecisionLink(Example)
 o getNoLink()
 o getYesLink()
 o setFeature(String)
 o setNoLink(DecisionNode)
 o setPosition(int)
 o setYesLink(DecisionNode)
 o write()
This mothod writes out the nodes decision feature information if it is a non-leaf (internal) node.

Constructors

 o DecisionNode
 public DecisionNode(StringBag possibleCategories)
Parameters:
possibleCategories - the list of categories (includes duplicates) of all training examples consistent with the parents' decisions
Postcondition
The node has the list of categories consistent with parent (if any) decision. The node has no children or decision feature (yet).

Methods

 o getYesLink
 public DecisionNode getYesLink()
Returns:
the link to follow if the example has the node's feature
 o getNoLink
 public DecisionNode getNoLink()
Returns:
the link to follow if the example does not have the node's feature
 o setFeature
 public void setFeature(String featureValue)
Parameters:
featureValue - the value this node will use for its decision
 o setPosition
 public void setPosition(int positionOfFeature)
Parameters:
positionOfFeature - the position of the feature value in an example that this node will use for its decision
 o setYesLink
 public void setYesLink(DecisionNode link)
Parameters:
link - the link to follow if the example has the node's feature
 o setNoLink
 public void setNoLink(DecisionNode link)
Parameters:
link - the link to follow if the example does not have the node's feature
 o getDecisionLink
 public DecisionNode getDecisionLink(Example testExample)
Parameters:
testExample - the example to be classified
Precondition
This node has a decision feature
Returns:
the reference to the next node for continuing the classification
 o getCategories
 public StringBag getCategories()
Returns:
the collection of categories (includes duplicates) consistent with the parents' decisions
 o chooseCategory
 public String chooseCategory()
Returns:
a randomly chosen category for the collection of categories consistent with the parents' decisions
 o write
 public void write()
This mothod writes out the nodes decision feature information if it is a non-leaf (internal) node. If it is a leaf node, it writes out the node's categories