matchzoo.metrics.mean_average_precision
¶
Mean average precision metric for ranking.
Module Contents¶
Classes¶
Mean average precision metric. |
-
class
matchzoo.metrics.mean_average_precision.
MeanAveragePrecision
(threshold: float = 0.0)¶ Bases:
matchzoo.engine.base_metric.RankingMetric
Mean average precision metric.
-
ALIAS
= ['mean_average_precision', 'map']¶
-
__repr__
(self)¶ - Returns
Formated string representation of the metric.
-
__call__
(self, y_true: np.array, y_pred: np.array) → float¶ Calculate mean average precision.
Example
>>> y_true = [0, 1, 0, 0] >>> y_pred = [0.1, 0.6, 0.2, 0.3] >>> MeanAveragePrecision()(y_true, y_pred) 1.0
- Parameters
y_true – The ground true label of each document.
y_pred – The predicted scores of each document.
- Returns
Mean average precision.
-