public class BinaryAccuracy extends AbstractAccuracy
BinaryAccuracy is the AbstractAccuracy with two classes.
It is assumed that the classes are identified with a labels array of 0s and 1s and a
prediction array where values above the threshold are the positive (1) examples and values below
the threshold are the negative (0) examples. If you have a different encoding, you may want to
look at the Accuracy.
axis, correctInstances, indextotalInstances| Constructor and Description |
|---|
BinaryAccuracy()
Creates a binary (two class) accuracy evaluator with 0 threshold.
|
BinaryAccuracy(float threshold)
Creates a binary (two class) accuracy evaluator that computes accuracy across axis 1 along
the 0th index.
|
BinaryAccuracy(java.lang.String name,
float threshold,
int index)
Creates a binary (two class) accuracy evaluator that computes accuracy across axis 1 along
given index.
|
BinaryAccuracy(java.lang.String name,
float threshold,
int index,
int axis)
Creates a binary (two class) accuracy evaluator.
|
| Modifier and Type | Method and Description |
|---|---|
protected ai.djl.util.Pair<java.lang.Long,NDArray> |
accuracyHelper(NDList labels,
NDList predictions)
A helper for classes extending
AbstractAccuracy. |
addAccumulator, evaluate, getAccumulator, resetAccumulator, updateAccumulatorcheckLabelShapes, checkLabelShapes, getNamepublic BinaryAccuracy(java.lang.String name,
float threshold,
int index,
int axis)
name - the name of the evaluator, default is "Accuracy"threshold - the value differentiating the posive and negative classes (usually 0 or .5)index - the index of the NDArray in labels to compute accuracy foraxis - the axis that represent classes in prediction, default 1public BinaryAccuracy(java.lang.String name,
float threshold,
int index)
name - the name of the evaluator, default is "Accuracy"threshold - the value differentiating the posive and negative classes (usually 0 or .5)index - the index of the NDArray in labels to compute accuracy forpublic BinaryAccuracy(float threshold)
threshold - the value differentiating the posive and negative classes (usually 0 or .5)public BinaryAccuracy()
protected ai.djl.util.Pair<java.lang.Long,NDArray> accuracyHelper(NDList labels, NDList predictions)
AbstractAccuracy.accuracyHelper in class AbstractAccuracylabels - the labels to get accuracy forpredictions - the predictions to get accuracy for