public class LeafNode<T extends Output<T>> extends Object implements Node<T>
Node
that can create a prediction.
equals(java.lang.Object)
uses the Output.fullEquals(Output)
method
to determine equality of two leaves.
Constructor and Description |
---|
LeafNode(double impurity,
T output,
Map<String,T> scores,
boolean generatesProbabilities)
Constructs a leaf node.
|
Modifier and Type | Method and Description |
---|---|
LeafNode<T> |
copy()
Copies the node and it's children.
|
boolean |
equals(Object o) |
Map<String,T> |
getDistribution()
Gets the distribution over scores in this node.
|
double |
getImpurity()
The impurity score of this node.
|
Node<T> |
getNextNode(SparseVector e)
Returns the next node in the tree based on the supplied example, or null if it's a leaf.
|
T |
getOutput()
Gets the output in this node.
|
Prediction<T> |
getPrediction(int numUsed,
Example<T> example)
Constructs a new prediction object based on this node's scores.
|
int |
hashCode() |
boolean |
isLeaf()
Is it a leaf node?
|
String |
toString() |
public LeafNode(double impurity, T output, Map<String,T> scores, boolean generatesProbabilities)
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.public Node<T> getNextNode(SparseVector e)
Node
getNextNode
in interface Node<T extends Output<T>>
e
- The example.public boolean isLeaf()
Node
public double getImpurity()
Node
getImpurity
in interface Node<T extends Output<T>>
public LeafNode<T> copy()
Node
public T getOutput()
public Map<String,T> getDistribution()
public Prediction<T> getPrediction(int numUsed, Example<T> example)
numUsed
- The number of features used.example
- The example to be scored.Copyright © 2015–2021 Oracle and/or its affiliates. All rights reserved.