from sklearn.metrics import precision_recall_curveprecisions, recalls, thresholds =precision_recall_curve(y_test, decision_scores)plt.plot(thresholds, precisions[:-1])plt.plot(thresholds, recalls[:-1])plt.show()
Note 1:precisions.shape = (145,),recalls.shape = (145,),thresholds.shape = (145,),这是因为“the last precision and recall values are 1. and 0. respectively and do not have a corresponding threshold.”