TwoWayNominalSplit (original) (raw)
java.lang.Object
- weka.classifiers.trees.adtree.Splitter
- weka.classifiers.trees.adtree.TwoWayNominalSplit
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, RevisionHandler
public class TwoWayNominalSplit
extends Splitter
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.6Revision: 1.6 Revision:1.6
Author:
Richard Kirkby (rkirkby@cs.waikato.ac.nz)
See Also:
Serialized Form
Field Summary
* ### Fields inherited from class weka.classifiers.trees.adtree.[Splitter](../../../../weka/classifiers/trees/adtree/Splitter.html "class in weka.classifiers.trees.adtree") `[orderAdded](../../../../weka/classifiers/trees/adtree/Splitter.html#orderAdded)`
Constructor Summary
Constructors
Constructor and Description TwoWayNominalSplit(int _attIndex, int _trueSplitValue) Creates a new two-way nominal splitter. Method Summary
All Methods Instance Methods Concrete Methods
Modifier and Type Method and Description java.lang.String attributeString(Instances dataset) Gets the string describing the attributes the split depends on. int branchInstanceGoesDown(Instance inst) Gets the index of the branch that an instance applies to. java.lang.Object clone() Clones this node. java.lang.String comparisonString(int branchNum,Instances dataset) Gets the string describing the comparision the split depends on for a particular branch. boolean equalTo(Splitter compare) Tests whether two splitters are equivalent. PredictionNode getChildForBranch(int branchNum) Gets the child for a branch of the split. int getNumOfBranches() Gets the number of branches of the split. java.lang.String getRevision() Returns the revision string. ReferenceInstances instancesDownBranch(int branch,Instances instances) Gets the subset of instances that apply to a particluar branch of the split. void setChildForBranch(int branchNum,PredictionNode childPredictor) Sets the child for a branch of the split. * ### Methods inherited from class java.lang.Object `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
Constructor Detail
* #### 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 Detail
* #### getNumOfBranches public int getNumOfBranches() Gets the number of branches of the split. Specified by: `[getNumOfBranches](../../../../weka/classifiers/trees/adtree/Splitter.html#getNumOfBranches--)` in class `[Splitter](../../../../weka/classifiers/trees/adtree/Splitter.html "class in weka.classifiers.trees.adtree")` Returns: the number of branches (always = 2) * #### branchInstanceGoesDown public int branchInstanceGoesDown([Instance](../../../../weka/core/Instance.html "class in weka.core") inst) Gets the index of the branch that an instance applies to. Returns -1 if no branches apply. Specified by: `[branchInstanceGoesDown](../../../../weka/classifiers/trees/adtree/Splitter.html#branchInstanceGoesDown-weka.core.Instance-)` in class `[Splitter](../../../../weka/classifiers/trees/adtree/Splitter.html "class in weka.classifiers.trees.adtree")` Parameters: `inst` \- the instance Returns: the branch index * #### instancesDownBranch public [ReferenceInstances](../../../../weka/classifiers/trees/adtree/ReferenceInstances.html "class in weka.classifiers.trees.adtree") instancesDownBranch(int branch, [Instances](../../../../weka/core/Instances.html "class in weka.core") instances) 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: `[instancesDownBranch](../../../../weka/classifiers/trees/adtree/Splitter.html#instancesDownBranch-int-weka.core.Instances-)` in class `[Splitter](../../../../weka/classifiers/trees/adtree/Splitter.html "class in weka.classifiers.trees.adtree")` Parameters: `branch` \- the index of the branch `instances` \- the instances from which to find the subset Returns: the set of instances that apply * #### attributeString public java.lang.String attributeString([Instances](../../../../weka/core/Instances.html "class in weka.core") dataset) Gets the string describing the attributes the split depends on. i.e. the left hand side of the description of the split. Specified by: `[attributeString](../../../../weka/classifiers/trees/adtree/Splitter.html#attributeString-weka.core.Instances-)` in class `[Splitter](../../../../weka/classifiers/trees/adtree/Splitter.html "class in weka.classifiers.trees.adtree")` Parameters: `dataset` \- the dataset that the split is based on Returns: a string describing the attributes * #### comparisonString public java.lang.String comparisonString(int branchNum, [Instances](../../../../weka/core/Instances.html "class in weka.core") dataset) 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: `[comparisonString](../../../../weka/classifiers/trees/adtree/Splitter.html#comparisonString-int-weka.core.Instances-)` in class `[Splitter](../../../../weka/classifiers/trees/adtree/Splitter.html "class in weka.classifiers.trees.adtree")` Parameters: `branchNum` \- the branch of the split `dataset` \- the dataset that the split is based on Returns: a string describing the comparison * #### equalTo public boolean equalTo([Splitter](../../../../weka/classifiers/trees/adtree/Splitter.html "class in weka.classifiers.trees.adtree") compare) Tests whether two splitters are equivalent. Specified by: `[equalTo](../../../../weka/classifiers/trees/adtree/Splitter.html#equalTo-weka.classifiers.trees.adtree.Splitter-)` in class `[Splitter](../../../../weka/classifiers/trees/adtree/Splitter.html "class in weka.classifiers.trees.adtree")` Parameters: `compare` \- the splitter to compare with Returns: whether or not they match * #### setChildForBranch public void setChildForBranch(int branchNum, [PredictionNode](../../../../weka/classifiers/trees/adtree/PredictionNode.html "class in weka.classifiers.trees.adtree") childPredictor) Sets the child for a branch of the split. Specified by: `[setChildForBranch](../../../../weka/classifiers/trees/adtree/Splitter.html#setChildForBranch-int-weka.classifiers.trees.adtree.PredictionNode-)` in class `[Splitter](../../../../weka/classifiers/trees/adtree/Splitter.html "class in weka.classifiers.trees.adtree")` Parameters: `branchNum` \- the branch to set the child for `childPredictor` \- the new child * #### getChildForBranch public [PredictionNode](../../../../weka/classifiers/trees/adtree/PredictionNode.html "class in weka.classifiers.trees.adtree") getChildForBranch(int branchNum) Gets the child for a branch of the split. Specified by: `[getChildForBranch](../../../../weka/classifiers/trees/adtree/Splitter.html#getChildForBranch-int-)` in class `[Splitter](../../../../weka/classifiers/trees/adtree/Splitter.html "class in weka.classifiers.trees.adtree")` Parameters: `branchNum` \- the branch to get the child for Returns: the child * #### clone public java.lang.Object clone() Clones this node. Performs a deep copy, recursing through the tree. Specified by: `[clone](../../../../weka/classifiers/trees/adtree/Splitter.html#clone--)` in class `[Splitter](../../../../weka/classifiers/trees/adtree/Splitter.html "class in weka.classifiers.trees.adtree")` Returns: a clone * #### getRevision public java.lang.String getRevision() Returns the revision string. Returns: the revision