public class Prediction<T extends Output<T>> extends Object implements Serializable
Model
.
Contains the output, and optionally and a map of scores over the possible outputs.
If hasProbabilities() == true then it has a probability
distribution over outputs otherwise it is unnormalized scores over outputs.
If possible it also contains the number of features that were used to make a prediction,
and how many features originally existed in the Example
.
Constructor and Description |
---|
Prediction(Prediction<T> other,
int numUsed,
Example<T> example)
Constructs a prediction from the supplied arguments.
|
Prediction(T output,
int numUsed,
Example<T> example)
Constructs a prediction from the supplied arguments.
|
Prediction(T output,
Map<String,T> outputScores,
int numUsed,
Example<T> example,
boolean probability)
Constructs a prediction from the supplied arguments.
|
Modifier and Type | Method and Description |
---|---|
boolean |
distributionEquals(Prediction<T> other)
Checks that the other prediction has the same distribution as this prediction,
using the
Output.fullEquals(T) method. |
Example<T> |
getExample()
Returns the example itself.
|
int |
getExampleSize()
Returns the number of features in the example.
|
int |
getNumActiveFeatures()
Returns the number of features used in the prediction.
|
T |
getOutput()
Returns the predicted output.
|
Map<String,T> |
getOutputScores()
Gets the output scores for each output.
|
boolean |
hasProbabilities()
Are the scores probabilities?
|
String |
toString() |
public Prediction(T output, Map<String,T> outputScores, int numUsed, Example<T> example, boolean probability)
output
- The predicted output (i.e., the one with the maximum score).outputScores
- The output score distribution.numUsed
- The number of features used to make the prediction.example
- The input example.probability
- Are the scores probabilities?public Prediction(T output, int numUsed, Example<T> example)
output
- The predicted output.numUsed
- The number of features used to make the prediction.example
- The input example.public Prediction(Prediction<T> other, int numUsed, Example<T> example)
other
- The prediction to copy.numUsed
- The number of features used to make the prediction.example
- The input example.public T getOutput()
public int getNumActiveFeatures()
public int getExampleSize()
public Map<String,T> getOutputScores()
May be an empty map if it did not generate scores.
public boolean hasProbabilities()
public boolean distributionEquals(Prediction<T> other)
Output.fullEquals(T)
method.other
- The prediction to compare.Copyright © 2015–2021 Oracle and/or its affiliates. All rights reserved.