Class AbstractTrainingNode<T extends Output<T>>
java.lang.Object
org.tribuo.common.tree.AbstractTrainingNode<T>
- All Implemented Interfaces:
Serializable,Node<T>
Base class for decision tree nodes used at training time.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classContains parameters needed to determine whether a node is a leaf. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final intDefault buffer size used in the split operation.protected final intprotected doubleprotected final AbstractTrainingNode.LeafDeterminerprotected final intprotected booleanprotected intprotected double -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractTrainingNode(int depth, int numExamples, AbstractTrainingNode.LeafDeterminer leafDeterminer) Builds an abstract training node. -
Method Summary
Modifier and TypeMethodDescriptionabstract List<AbstractTrainingNode<T>> buildTree(int[] featureIDs, SplittableRandom rng, boolean useRandomSplitPoints) Builds next level of a tree.Converts a tree from a training representation to the final inference time representation.copy()Copies the node and it's children.Transforms anAbstractTrainingNodeinto aSplitNodeintgetDepth()The depth of this node in the tree.getNextNode(SparseVector example) Returns the next node in the tree based on the supplied example, or null if it's a leaf.intThe number of training examples in this node.abstract floatThe sum of the weights associated with this node's examples.booleanisLeaf()Is it a leaf node?booleanshouldMakeLeaf(double impurityScore, float weightSum) Determines whether the node to be created should be aLeafNode.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.tribuo.common.tree.Node
getImpurity
-
Field Details
-
DEFAULT_SIZE
-
depth
-
numExamples
-
leafDeterminer
-
split
-
splitID
-
splitValue
-
impurityScore
-
greaterThan
-
lessThanOrEqual
-
-
Constructor Details
-
AbstractTrainingNode
protected AbstractTrainingNode(int depth, int numExamples, AbstractTrainingNode.LeafDeterminer leafDeterminer) Builds an abstract training node.- Parameters:
depth- The depth of this node.numExamples- The number of examples in this node.leafDeterminer- The parameters which determine if the node forms a leaf.
-
-
Method Details
-
buildTree
public abstract List<AbstractTrainingNode<T>> buildTree(int[] featureIDs, SplittableRandom rng, boolean useRandomSplitPoints) Builds next level of a tree.- Parameters:
featureIDs- Indices of the features available in this split.rng- Splittable random number generator.useRandomSplitPoints- Whether to choose split points for features at random.- Returns:
- A possibly empty list of TrainingNodes.
-
convertTree
Converts a tree from a training representation to the final inference time representation.- Returns:
- The converted subtree.
-
getWeightSum
The sum of the weights associated with this node's examples.- Returns:
- the sum of the weights associated with this node's examples.
-
getDepth
-
shouldMakeLeaf
-
createSplitNode
Transforms anAbstractTrainingNodeinto aSplitNode- Returns:
- A
SplitNode
-
getNextNode
-
getNumExamples
The number of training examples in this node.- Returns:
- The number of training examples in this node.
-
isLeaf
-
copy
-