According to the definition of the average precision (AP) score in here, the AP is calculated based on the precision and increment in recall across thresholds.
In the average_precision_score function, the mandatory parameters are as follows:
y_true: True binary labels in binary label indicators.
y_score: Target scores, can either be probability estimates of the positive class, confidence values, or non-thresholded measure of decisions (as returned by "decision_function" on some classifiers).
To my understanding, y_true is a list of the ground truth classes to which each record belongs. y_score is the list of predicted classes corresponding to each record. Likewise, for a binary classification task, y_true = [1,0,0,1,1] and y_score = [0,0,0,1,0] would be feasible parameters, where for record 1, the ground truth class is positive (1) but the predicted class is negative (0).
We attempt our classification task with different thresholds. Hence we get different y_score lists for each threshold. In that case, when I apply the average_precision_score function, I would obtain an AP value per each threshold. Not a single value across thresholds as implied by the definition. In the sklearn function there is no 'threshold' parameter anyway.
Can you please tell me whether my understanding of the average_precision_score function in sklearn is correct? If so, what is the reason for the contradiction with the definition?