scikit-plot icon indicating copy to clipboard operation
scikit-plot copied to clipboard

Is there a [problem in precision_recall_curve?

Open Cbanyungong opened this issue 7 years ago • 1 comments

Dear sir Thanks for your excellent work in the scikit-plot. I am confused in the function of precision_recall_curve. As we all know,the PR curve goes through two points:(0,1) and(1,0).But I used the test code to draw the curve and found that the curve does not goes the point of (1,0).I used the below code and get the curve.

import scikitplot as skplt rf = GaussianNB () rf = rf.fit(X_train, y_train) y_pred = rf.predict(X_test) skplt.metrics.plot_confusion_matrix(y_test, y_pred, normalize=True) plt.show()

Cbanyungong avatar Dec 13 '18 12:12 Cbanyungong

I'm sorry I can't get your question idea. You want to plot the precision_recall curve, but your code is just using plot_confusion_matrix for confusion matrix. In fact, if you want to use plot_precision_recall_curve, you have to make your prediction probability based on your test data, just like this: prob = rf.predict_proba(X_test) skplt.metrics.plot_precision_recall_curve(y_test, prob) plt.show()

lugq1990 avatar Jan 02 '19 01:01 lugq1990