Package weka.classifiers.trees.adtree
Class Splitter
java.lang.Object
weka.classifiers.trees.adtree.Splitter
- All Implemented Interfaces:
Serializable,Cloneable,RevisionHandler
- Direct Known Subclasses:
TwoWayNominalSplit,TwoWayNumericSplit
Abstract class representing a splitter node in an alternating tree.
- Version:
- $Revision: 1.5 $
- Author:
- Richard Kirkby (rkirkby@cs.waikato.ac.nz)
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionintThe number this node was in the order of nodes added to the tree -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract StringattributeString(Instances dataset) Gets the string describing the attributes the split depends on.abstract intGets the index of the branch that an instance applies to.abstract Objectclone()Clones this node.abstract StringcomparisonString(int branchNum, Instances dataset) Gets the string describing the comparision the split depends on for a particular branch.abstract booleanTests whether two splitters are equivalent.abstract PredictionNodegetChildForBranch(int branchNum) Gets the child for a branch of the split.abstract intGets the number of branches of the split.abstract ReferenceInstancesinstancesDownBranch(int branch, Instances sourceInstances) Gets the subset of instances that apply to a particluar branch of the split.abstract voidsetChildForBranch(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, waitMethods inherited from interface weka.core.RevisionHandler
getRevision
-
Field Details
-
orderAdded
public int orderAddedThe number this node was in the order of nodes added to the tree
-
-
Constructor Details
-
Splitter
public Splitter()
-
-
Method Details
-
getNumOfBranches
public abstract int getNumOfBranches()Gets the number of branches of the split.- Returns:
- the number of branches
-
branchInstanceGoesDown
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
-
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.- Parameters:
branch- the index of the branchsourceInstances- 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.- 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.- 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.- Parameters:
compare- the splitter to compare with- Returns:
- whether or not they match
-
setChildForBranch
Sets the child for a branch of the split.- Parameters:
branchNum- the branch to set the child forchildPredictor- the new child
-
getChildForBranch
Gets the child for a branch of the split.- Parameters:
branchNum- the branch to get the child for- Returns:
- the child
-
clone
Clones this node. Performs a deep copy, recursing through the tree.- Returns:
- a clone
-