![](/img/trans.png)
[英]Scipy/Numpy/scikits - calculating precision/recall scores based on two arrays
[英]Precision Recall scores doesn't match visualization
我正在計算 3 個不同模型的精確召回分數。 對於我的第一個 model,plot 與 0.85 的 auc 分數不匹配,但應該是 0.5。
這是我的代碼:
precision, recall, thresholds = precision_recall_curve(y_test, pred1)
print(pred1)
fig, ax = plt.subplots()
ax.plot(recall, precision, color='red')
ax.set_title('Precision-Recall curve')
ax.set_ylabel('Precision')
ax.set_xlabel('Recall')
plt.show()
auc_precision_recall = auc(recall, precision)
抱歉,我沒有足夠的代表發表評論。
注意您的 y 軸,它介於 0.7-1 之間,因此 0.85 的 AUC 似乎與 plot 匹配。 如果 y 軸的范圍為 0-1,則 AUC 將為 0.5。
您可以使用ax.set_ylim((0,1))
將 y 軸設置為 0-1 之間
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.