Package weka.classifiers.trees.adtree
Class TwoWayNominalSplit
java.lang.Object
weka.classifiers.trees.adtree.Splitter
weka.classifiers.trees.adtree.TwoWayNominalSplit
- All Implemented Interfaces:
Serializable,Cloneable,RevisionHandler
Class representing a two-way split on a nominal attribute, of the form:
either 'is some_value' or 'is not some_value'.
- Version:
- $Revision: 1.6 $
- Author:
- Richard Kirkby (rkirkby@cs.waikato.ac.nz)
- See Also:
-
Field Summary
Fields inherited from class weka.classifiers.trees.adtree.Splitter
orderAdded -
Constructor Summary
ConstructorsConstructorDescriptionTwoWayNominalSplit(int _attIndex, int _trueSplitValue) Creates a new two-way nominal splitter. -
Method Summary
Modifier and TypeMethodDescriptionattributeString(Instances dataset) Gets the string describing the attributes the split depends on.intGets the index of the branch that an instance applies to.clone()Clones this node.comparisonString(int branchNum, Instances dataset) Gets the string describing the comparision the split depends on for a particular branch.booleanTests whether two splitters are equivalent.getChildForBranch(int branchNum) Gets the child for a branch of the split.intGets the number of branches of the split.Returns the revision string.instancesDownBranch(int branch, Instances instances) Gets the subset of instances that apply to a particluar branch of the split.voidsetChildForBranch(int branchNum, PredictionNode childPredictor) Sets the child for a branch of the split.
-
Constructor Details
-
TwoWayNominalSplit
public TwoWayNominalSplit(int _attIndex, int _trueSplitValue) Creates a new two-way nominal splitter.- Parameters:
_attIndex- the index of the attribute this split depeneds on_trueSplitValue- the attribute value that the splitter splits on
-
-
Method Details
-
getNumOfBranches
public int getNumOfBranches()Gets the number of branches of the split.- Specified by:
getNumOfBranchesin classSplitter- Returns:
- the number of branches (always = 2)
-
branchInstanceGoesDown
Gets the index of the branch that an instance applies to. Returns -1 if no branches apply.- Specified by:
branchInstanceGoesDownin classSplitter- Parameters:
inst- the instance- Returns:
- the branch index
-
instancesDownBranch
Gets the subset of instances that apply to a particluar branch of the split. If the branch index is -1, the subset will consist of those instances that don't apply to any branch.- Specified by:
instancesDownBranchin classSplitter- Parameters:
branch- the index of the branchinstances- the instances from which to find the subset- Returns:
- the set of instances that apply
-
attributeString
Gets the string describing the attributes the split depends on. i.e. the left hand side of the description of the split.- Specified by:
attributeStringin classSplitter- Parameters:
dataset- the dataset that the split is based on- Returns:
- a string describing the attributes
-
comparisonString
Gets the string describing the comparision the split depends on for a particular branch. i.e. the right hand side of the description of the split.- Specified by:
comparisonStringin classSplitter- Parameters:
branchNum- the branch of the splitdataset- the dataset that the split is based on- Returns:
- a string describing the comparison
-
equalTo
Tests whether two splitters are equivalent. -
setChildForBranch
Sets the child for a branch of the split.- Specified by:
setChildForBranchin classSplitter- Parameters:
branchNum- the branch to set the child forchildPredictor- the new child
-
getChildForBranch
Gets the child for a branch of the split.- Specified by:
getChildForBranchin classSplitter- Parameters:
branchNum- the branch to get the child for- Returns:
- the child
-
clone
Clones this node. Performs a deep copy, recursing through the tree. -
getRevision
Returns the revision string.- Returns:
- the revision
-