mrdbourke / zero-to-mastery-ml

All course materials for the Zero to Mastery Machine Learning and Data Science course.
https://dbourke.link/ZTMmlcourse
2.97k stars 3.44k forks source link

The plot_roc_curve is not supported in the shown version #65

Open ankitx55 opened 1 year ago

ankitx55 commented 1 year ago

Before sklearn 1.2:

from sklearn.metrics import plot_roc_curve svc_disp = plot_roc_curve(svc, X_test, y_test) rfc_disp = plot_roc_curve(rfc, X_test, y_test, ax=svcdisp.ax) From sklearn 1.2:

from sklearn.metrics import RocCurveDisplay svc_disp = RocCurveDisplay.from_estimator(svc, X_test, y_test) rfc_disp = RocCurveDisplay.from_estimator(rfc, X_test, y_test, ax=svcdisp.ax)

mrdbourke commented 1 year ago

Thank you for this!

Just added an updated code example in the Scikit-Learn notebook, should be live shortly.

Code:

from sklearn.metrics import RocCurveDisplay
roc_curve_display = RocCurveDisplay.from_estimator(estimator=clf, 
                                                   X=X_test, 
                                                   y=y_test)

Docs: https://scikit-learn.org/stable/modules/generated/sklearn.metrics.RocCurveDisplay.html#sklearn.metrics.RocCurveDisplay.from_estimator