All Packages  Class Hierarchy  This Package  Previous  Next  Index  WEKA's home

Class weka.classifiers.adtree.TwoWayNominalSplit

java.lang.Object
    |
    +----weka.classifiers.adtree.Splitter
            |
            +----weka.classifiers.adtree.TwoWayNominalSplit

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.1 $
Author:
Richard Kirkby (rkirkby@cs.waikato.ac.nz)

Constructor Index

 o TwoWayNominalSplit(int, int)
Creates a new two-way nominal splitter.

Method Index

 o attributeString(Instances)
Gets the string describing the attributes the split depends on.
 o branchInstanceGoesDown(Instance)
Gets the index of the branch that an instance applies to.
 o clone()
Clones this node.
 o comparisonString(int, Instances)
Gets the string describing the comparision the split depends on for a particular branch.
 o equalTo(Splitter)
Tests whether two splitters are equivalent.
 o getChildForBranch(int)
Gets the child for a branch of the split.
 o getNumOfBranches()
Gets the number of branches of the split.
 o instancesDownBranch(int, Instances)
Gets the subset of instances that apply to a particluar branch of the split.
 o setChildForBranch(int, PredictionNode)
Sets the child for a branch of the split.

Constructor Detail

 o 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

 o getNumOfBranches
public int getNumOfBranches()
          Gets the number of branches of the split.
Returns:
the number of branches (always = 2)
Overrides:
getNumOfBranches in class Splitter
 o branchInstanceGoesDown
public int branchInstanceGoesDown(Instance inst)
          Gets the index of the branch that an instance applies to. Returns -1 if no branches apply.
Parameters:
i - the instance
Returns:
the branch index
Overrides:
branchInstanceGoesDown in class Splitter
 o instancesDownBranch
public ReferenceInstances instancesDownBranch(int branch,
                                              Instances 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.
Parameters:
branch - the index of the branch
sourceInstances - the instances from which to find the subset
Returns:
the set of instances that apply
Overrides:
instancesDownBranch in class Splitter
 o attributeString
public java.lang.String attributeString(Instances dataset)
          Gets the string describing the attributes the split depends on. i.e. the left hand side of the description of the split.
Parameters:
dataset - the dataset that the split is based on
Returns:
a string describing the attributes
Overrides:
attributeString in class Splitter
 o comparisonString
public java.lang.String comparisonString(int branchNum,
                               Instances 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.
Parameters:
branchNum - the branch of the split
dataset - the dataset that the split is based on
Returns:
a string describing the comparison
Overrides:
comparisonString in class Splitter
 o equalTo
public boolean equalTo(Splitter compare)
          Tests whether two splitters are equivalent.
Parameters:
compare - the splitter to compare with
Returns:
whether or not they match
Overrides:
equalTo in class Splitter
 o setChildForBranch
public void setChildForBranch(int branchNum,
                              PredictionNode childPredictor)
          Sets the child for a branch of the split.
Parameters:
branchNum - the branch to set the child for
childPredictor - the new child
Overrides:
setChildForBranch in class Splitter
 o getChildForBranch
public PredictionNode getChildForBranch(int branchNum)
          Gets the child for a branch of the split.
Parameters:
branchNum - the branch to get the child for
Returns:
the child
Overrides:
getChildForBranch in class Splitter
 o clone
public java.lang.Object clone()
          Clones this node. Performs a deep copy, recursing through the tree.
Returns:
a clone
Overrides:
clone in class Splitter

All Packages  Class Hierarchy  This Package  Previous  Next  Index  WEKA's home