public abstract class AbstractTrainingNode<T extends Output<T>> extends Object implements Node<T>
Modifier and Type | Class and Description |
---|---|
static class |
AbstractTrainingNode.LeafDeterminer
Contains parameters needed to determine whether a node is a leaf.
|
Modifier and Type | Field and Description |
---|---|
protected static int |
DEFAULT_SIZE
Default buffer size used in the split operation.
|
protected int |
depth |
protected Node<T> |
greaterThan |
protected double |
impurityScore |
protected AbstractTrainingNode.LeafDeterminer |
leafDeterminer |
protected Node<T> |
lessThanOrEqual |
protected int |
numExamples |
protected boolean |
split |
protected int |
splitID |
protected double |
splitValue |
Modifier | Constructor and Description |
---|---|
protected |
AbstractTrainingNode(int depth,
int numExamples,
AbstractTrainingNode.LeafDeterminer leafDeterminer)
Builds an abstract training node.
|
Modifier and Type | Method and Description |
---|---|
abstract List<AbstractTrainingNode<T>> |
buildTree(int[] featureIDs,
SplittableRandom rng,
boolean useRandomSplitPoints)
Builds next level of a tree.
|
abstract Node<T> |
convertTree()
Converts a tree from a training representation to the final inference time representation.
|
Node<T> |
copy()
Copies the node and it's children.
|
SplitNode<T> |
createSplitNode()
Transforms an
AbstractTrainingNode into a SplitNode |
int |
getDepth()
The depth of this node in the tree.
|
Node<T> |
getNextNode(SparseVector example)
Returns the next node in the tree based on the supplied example, or null if it's a leaf.
|
int |
getNumExamples()
The number of training examples in this node.
|
abstract float |
getWeightSum()
The sum of the weights associated with this node's examples.
|
boolean |
isLeaf()
Is it a leaf node?
|
boolean |
shouldMakeLeaf(double impurityScore,
float weightSum)
Determines whether the node to be created should be a
LeafNode . |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getImpurity
protected static final int DEFAULT_SIZE
protected final int depth
protected final int numExamples
protected final AbstractTrainingNode.LeafDeterminer leafDeterminer
protected boolean split
protected int splitID
protected double splitValue
protected double impurityScore
protected AbstractTrainingNode(int depth, int numExamples, AbstractTrainingNode.LeafDeterminer leafDeterminer)
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.public abstract List<AbstractTrainingNode<T>> buildTree(int[] featureIDs, SplittableRandom rng, boolean useRandomSplitPoints)
featureIDs
- Indices of the features available in this split.rng
- Splittable random number generator.useRandomSplitPoints
- Whether to choose split points for features at random.public abstract Node<T> convertTree()
public abstract float getWeightSum()
public int getDepth()
public boolean shouldMakeLeaf(double impurityScore, float weightSum)
LeafNode
.impurityScore
- impurity score for the new node.weightSum
- total example weight for the new node.LeafNode
.public SplitNode<T> createSplitNode()
AbstractTrainingNode
into a SplitNode
SplitNode
public Node<T> getNextNode(SparseVector example)
Node
getNextNode
in interface Node<T extends Output<T>>
example
- The example.public int getNumExamples()
public boolean isLeaf()
Node
Copyright © 2015–2021 Oracle and/or its affiliates. All rights reserved.