Package ai.djl.training.evaluator
Class Coverage
- java.lang.Object
-
- ai.djl.training.evaluator.Evaluator
-
- ai.djl.training.evaluator.AbstractAccuracy
-
- ai.djl.training.evaluator.Coverage
-
public class Coverage extends AbstractAccuracy
Coverage for a Regression problem: it measures the percent of predictions greater than the actual target, to determine whether the predictor is over-forecasting or under-forecasting. e.g. 0.50 if we predict near the median of the distribution.def coverage(target, forecast): return (np.mean((target < forecast)))...
-
-
Field Summary
-
Fields inherited from class ai.djl.training.evaluator.AbstractAccuracy
axis, correctInstances
-
Fields inherited from class ai.djl.training.evaluator.Evaluator
totalInstances
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ai.djl.util.Pair<java.lang.Long,NDArray>accuracyHelper(NDList labels, NDList predictions)A helper for classes extendingAbstractAccuracy.-
Methods inherited from class ai.djl.training.evaluator.AbstractAccuracy
addAccumulator, evaluate, getAccumulator, resetAccumulator, updateAccumulator
-
Methods inherited from class ai.djl.training.evaluator.Evaluator
checkLabelShapes, checkLabelShapes, getName
-
-
-
-
Constructor Detail
-
Coverage
public Coverage()
Creates an evaluator that measures the percent of predictions greater than the actual target.
-
Coverage
public Coverage(java.lang.String name, int axis)Creates an evaluator that measures the percent of predictions greater than the actual target.- Parameters:
name- the name of the evaluator, default is "Coverage"axis- the axis along which to count the correct prediction, default is 1
-
-
Method Detail
-
accuracyHelper
protected ai.djl.util.Pair<java.lang.Long,NDArray> accuracyHelper(NDList labels, NDList predictions)
A helper for classes extendingAbstractAccuracy.- Specified by:
accuracyHelperin classAbstractAccuracy- Parameters:
labels- the labels to get accuracy forpredictions- the predictions to get accuracy for- Returns:
- a pair(number of total values, ndarray int of correct values)
-
-