Open mrdbourke opened 1 year ago
Link to notebook changed: https://github.com/mrdbourke/zero-to-mastery-ml/blob/master/section-3-structured-data-projects/end-to-end-heart-disease-classification.ipynb
As of Scikit-Learn 1.2+ the method sklearn.metrics.plot_roc_curve is deprecated in favour of sklearn.metrics.RocCurveDisplay.
sklearn.metrics.plot_roc_curve
sklearn.metrics.RocCurveDisplay
You can check your Scikit-Learn version with:
import sklearn sklearn.__version__
You can run the following command in your terminal with your Conda (or other) environment active to upgrade Scikit-Learn (the -U stands for "upgrade):
-U
pip install -U scikit-learn
# This will error if run in Scikit-Learn version 1.2+ from sklearn.metrics import plot_roc_curve
Also:
# This will error if run in Scikit-Learn version 1.2+ from sklearn.metrics import plot_roc_curve plot_roc_curve(gs_log_reg, X_test, y_test);
from sklearn.metrics import RocCurveDisplay # new in Scikit-Learn 1.2+
And to plot a ROC curve, note the use of RocCurveDisplay.from_estimator():
RocCurveDisplay.from_estimator()
# Scikit-Learn 1.2.0 or later from sklearn.metrics import RocCurveDisplay # from_estimator() = use a model to plot ROC curve on data RocCurveDisplay.from_estimator(estimator=gs_log_reg, X=X_test, y=y_test);
Thank you!!!
Thank you
Link to notebook changed: https://github.com/mrdbourke/zero-to-mastery-ml/blob/master/section-3-structured-data-projects/end-to-end-heart-disease-classification.ipynb
Error
As of Scikit-Learn 1.2+ the method
sklearn.metrics.plot_roc_curve
is deprecated in favour ofsklearn.metrics.RocCurveDisplay
.How to check your Scikit-Learn version
You can check your Scikit-Learn version with:
How to update your Scikit-Learn version
You can run the following command in your terminal with your Conda (or other) environment active to upgrade Scikit-Learn (the
-U
stands for "upgrade):Previous code (this will error if running Scikit-Learn version 1.2+)
Also:
New code (this will work with Scikit-Learn version 1.2+)
And to plot a ROC curve, note the use of
RocCurveDisplay.from_estimator()
: