Class Prediction<T extends Output<T>>
java.lang.Object
org.tribuo.Prediction<T>
- All Implemented Interfaces:
Serializable
A prediction made by a
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
.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionPrediction
(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. -
Method Summary
Modifier and TypeMethodDescriptionReturns the example itself.int
Returns the number of features in the example.int
Returns the number of features used in the prediction.Returns the predicted output.Gets the output scores for each output.boolean
Are the scores probabilities?toString()
-
Constructor Details
-
Prediction
public Prediction(T output, Map<String, T> outputScores, int numUsed, Example<T> example, boolean probability) Constructs a prediction from the supplied arguments.- Parameters:
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?
-
Prediction
Constructs a prediction from the supplied arguments.- Parameters:
output
- The predicted output.numUsed
- The number of features used to make the prediction.example
- The input example.
-
Prediction
Constructs a prediction from the supplied arguments.- Parameters:
other
- The prediction to copy.numUsed
- The number of features used to make the prediction.example
- The input example.
-
-
Method Details
-
getOutput
-
getNumActiveFeatures
Returns the number of features used in the prediction.- Returns:
- The number of features used.
-
getExampleSize
Returns the number of features in the example.- Returns:
- The number of features in the example.
-
getExample
-
getOutputScores
Gets the output scores for each output.May be an empty map if it did not generate scores.
- Returns:
- A Map.
-
hasProbabilities
Are the scores probabilities?- Returns:
- True if the scores are probabilities.
-
toString
-