There is a example in sklearn.metrics.average_precision_score documentation.
import numpy as np from sklearn.metrics import average_precision_score y_true = np.array([0, 0, 1, 1]) y_scores = np.array([0.1, 0.4, 0.35, 0.8]) average_precision_score(y_true, y_scores) 0.83
But when I plot precision_recall_curve
precision, recall, _ = precision_recall_curve(y_true, y_scores) plt.plot( recall,precision)
why the area under the precision_recall_curve is not 0.83?