Package org.tribuo.common.tree
Class LeafNode<T extends Output<T>>
java.lang.Object
org.tribuo.common.tree.LeafNode<T>
- All Implemented Interfaces:
Serializable,Node<T>
An immutable leaf
Node that can create a prediction.
equals(java.lang.Object) uses the Output.fullEquals(Output) method
to determine equality of two leaves.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intProtobuf serialization version. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncopy()Copies the node and it's children.booleanGets the distribution over scores in this node.doubleThe impurity score of this node.Returns the next node in the tree based on the supplied example, or null if it's a leaf.Gets the output in this node.getPrediction(int numUsed, Example<T> example) Constructs a new prediction object based on this node's scores.inthashCode()booleanisLeaf()Is it a leaf node?toString()
-
Field Details
-
CURRENT_VERSION
Protobuf serialization version.- See Also:
-
-
Constructor Details
-
LeafNode
Constructs a leaf node.- Parameters:
impurity- The impurity value calculated at training time.output- The output value from this node.scores- The score map for the other outputs.generatesProbabilities- If the scores are probabilities.
-
-
Method Details
-
equals
-
hashCode
-
getNextNode
Description copied from interface:NodeReturns the next node in the tree based on the supplied example, or null if it's a leaf.- Specified by:
getNextNodein interfaceNode<T extends Output<T>>- Parameters:
e- The example.- Returns:
- The next node down in the tree.
-
isLeaf
Description copied from interface:NodeIs it a leaf node? -
getImpurity
Description copied from interface:NodeThe impurity score of this node.- Specified by:
getImpurityin interfaceNode<T extends Output<T>>- Returns:
- The node impurity.
-
copy
Description copied from interface:NodeCopies the node and it's children. -
getOutput
Gets the output in this node.- Returns:
- The output.
-
getDistribution
Gets the distribution over scores in this node.- Returns:
- The score distribution.
-
getPrediction
Constructs a new prediction object based on this node's scores.- Parameters:
numUsed- The number of features used.example- The example to be scored.- Returns:
- The prediction for the supplied example.
-
toString
-