Class 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)))
     
    ...
    • 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 extending AbstractAccuracy.
        Specified by:
        accuracyHelper in class AbstractAccuracy
        Parameters:
        labels - the labels to get accuracy for
        predictions - the predictions to get accuracy for
        Returns:
        a pair(number of total values, ndarray int of correct values)