# Source code for catalyst.dl.meters.mapmeter

from . import APMeter, meter

[docs]class mAPMeter(meter.Meter):
"""
The mAPMeter measures the mean average precision over all classes.

The mAPMeter is designed to operate on NxK Tensors output and
target, and optionally a Nx1 Tensor weight where (1) the output
contains model output scores for N examples and K classes that ought to
be higher when the model is more convinced that the example should be
positively labeled, and smaller when the model believes the example should
be negatively labeled (for instance, the output of a sigmoid function); (2)
the target contains only values 0 (for negative examples) and 1
(for positive examples); and (3) the weight ( > 0) represents weight for
each sample.
"""

def __init__(self):
super(mAPMeter, self).__init__()
self.apmeter = APMeter()

[docs]    def reset(self):
self.apmeter.reset()

[docs]    def add(self, output, target, weight=None):