public class Classifications
extends java.lang.Object
Classifications
is the container that stores the classification results for
classification on a single input.Modifier and Type | Class and Description |
---|---|
static class |
Classifications.Classification
A
Classification stores the classification result for a single class on a single
input. |
Modifier and Type | Field and Description |
---|---|
protected java.util.List<java.lang.String> |
classNames |
protected java.util.List<java.lang.Double> |
probabilities |
Constructor and Description |
---|
Classifications(java.util.List<java.lang.String> classNames,
java.util.List<java.lang.Double> probabilities)
Constructs a
Classifications using a parallel list of classNames and probabilities. |
Classifications(java.util.List<java.lang.String> classNames,
NDArray probabilities)
Constructs a
Classifications using list of classNames parallel to an NDArray of
probabilities. |
Modifier and Type | Method and Description |
---|---|
<T extends Classifications.Classification> |
best()
Returns the most likely class for the classification.
|
<T extends Classifications.Classification> |
get(java.lang.String className)
Returns the result for a particular class name.
|
<T extends Classifications.Classification> |
item(int index)
Returns the item at a given index based on the order used to construct the
Classifications . |
<T extends Classifications.Classification> |
items()
Returns a classification item for each potential class for the input.
|
<T extends Classifications.Classification> |
topK(int k)
Returns a list of the top
k best classes. |
java.lang.String |
toString() |
protected java.util.List<java.lang.String> classNames
protected java.util.List<java.lang.Double> probabilities
public Classifications(java.util.List<java.lang.String> classNames, java.util.List<java.lang.Double> probabilities)
Classifications
using a parallel list of classNames and probabilities.classNames
- the names of the classesprobabilities
- the probabilities for each class for the inputpublic Classifications(java.util.List<java.lang.String> classNames, NDArray probabilities)
Classifications
using list of classNames parallel to an NDArray of
probabilities.classNames
- the names of the classesprobabilities
- the probabilities for each class for the inputpublic <T extends Classifications.Classification> java.util.List<T> items()
T
- the type of classification item for the taskpublic <T extends Classifications.Classification> T item(int index)
Classifications
.T
- the type of classification item for the taskindex
- the index of the item to returnclassifications.items().get(index)
public <T extends Classifications.Classification> java.util.List<T> topK(int k)
k
best classes.T
- the type of the classification item for the taskk
- the number of classes to returnpublic <T extends Classifications.Classification> T best()
T
- the type of the classification item for the taskpublic <T extends Classifications.Classification> T get(java.lang.String className)
T
- the type of the classification item for the taskclassName
- the class name to get results forpublic java.lang.String toString()
toString
in class java.lang.Object