Task provided by the Scientific and Educational Center for Cognitive Modeling, MIPT
A small educational project: calculating Average Precision (AP) for the task of
classifying fruits as Ripe / Unripe at fixed probability thresholds
from 0.0 to 1.0 (exclusive) with step 0.1.
Precision at threshold t
where
and
Average Precision
The file data.csv contains 10 observations with columns:
id- photo numberprobability- probability of the Ripe classlabel- ground truth label (RipeorUnripe)
py fruit_metric.py --csv data.csvThe script will output a Threshold,Precision table and the final AP value.
It is assumed that if
probability >= threshold, then the prediction is Ripe.
The notebook main.ipynb shows the same calculation step by step with a small visualization
of the Precision vs threshold plot.