我在问一个后续问题,正如我之前的帖子所建议的那样——良好的 ROC 曲线,但精度召回曲线很差。我只使用 Python scikit-learn 的默认设置。似乎优化是在 AUC-ROC 上,但我对优化精确召回更感兴趣。以下是我的代码。
# Get ROC
y_score = classifierUsed2.decision_function(X_test)
false_positive_rate, true_positive_rate, thresholds = roc_curve(y_test, y_score)
roc_auc = auc(false_positive_rate, true_positive_rate)
print 'AUC-'+ethnicity_tar+'=',roc_auc
# Plotting
ax1.plot(false_positive_rate, true_positive_rate, c=color, label=('AUC-'+ethnicity_tar+'= %0.2f'%roc_auc))
ax1.plot([0,1],[0,1], color='lightgrey', linestyle='--')
ax1.legend(loc='lower right', prop={'size':8})
# Get P-R pairs
precision, recall, prThreshold = precision_recall_curve(y_test, y_score)
# Plotting
ax2.plot(recall, precision, c=color, label=ethnicity_tar)
ax2.legend(loc='upper right', prop={'size':8})
我在哪里以及如何插入 python 代码来更改设置,以便优化精确召回?