public class IndexEvaluator extends Evaluator
totalInstances
Constructor and Description |
---|
IndexEvaluator(Evaluator evaluator,
int index)
Constructs an
IndexEvaluator with the same index for both predictions and labels. |
IndexEvaluator(Evaluator evaluator,
java.lang.Integer predictionsIndex,
java.lang.Integer labelsIndex)
Constructs an
IndexEvaluator . |
Modifier and Type | Method and Description |
---|---|
void |
addAccumulator(java.lang.String key)
Adds an accumulator for the results of the evaluation with the given key.
|
NDArray |
evaluate(NDList labels,
NDList predictions)
Calculates the evaluation between the labels and the predictions.
|
float |
getAccumulator(java.lang.String key)
Returns the accumulated evaluator value.
|
void |
resetAccumulator(java.lang.String key)
Resets the evaluator value with the given key.
|
void |
updateAccumulator(java.lang.String key,
NDList labels,
NDList predictions)
Updates the evaluator with the given key based on a
NDList of labels and predictions. |
checkLabelShapes, checkLabelShapes, getName
public IndexEvaluator(Evaluator evaluator, int index)
IndexEvaluator
with the same index for both predictions and labels.evaluator
- the base evaluatorindex
- the index for both predictions and labelspublic IndexEvaluator(Evaluator evaluator, java.lang.Integer predictionsIndex, java.lang.Integer labelsIndex)
IndexEvaluator
.evaluator
- the base evaluatorpredictionsIndex
- the predictions indexlabelsIndex
- the labels indexpublic NDArray evaluate(NDList labels, NDList predictions)
public void addAccumulator(java.lang.String key)
addAccumulator
in class Evaluator
key
- the key for the new accumulatorpublic void updateAccumulator(java.lang.String key, NDList labels, NDList predictions)
NDList
of labels and predictions.
This is a synchronized operation. You should only call it at the end of a batch or epoch.
updateAccumulator
in class Evaluator
key
- the key of the accumulator to updatelabels
- a NDList
of labelspredictions
- a NDList
of predictionspublic void resetAccumulator(java.lang.String key)
resetAccumulator
in class Evaluator
key
- the key of the accumulator to resetpublic float getAccumulator(java.lang.String key)
getAccumulator
in class Evaluator
key
- the key of the accumulator to get