1. Learn
  2. /
  3. Courses
  4. /
  5. Supervised Learning with scikit-learn

Connected

Exercise

The ROC curve

Now you have built a logistic regression model for predicting diabetes status, you can plot the ROC curve to visualize how the true positive rate and false positive rate vary as the decision threshold changes.

The test labels, y_test, and the predicted probabilities of the test features belonging to the positive class, y_pred_probs, have been preloaded for you, along with matplotlib.pyplot as plt.

You will create a ROC curve and then interpret the results.

Instructions 1/2

undefined XP
    1
    2
  • Import roc_curve.
  • Calculate the ROC curve values, using y_test and y_pred_probs, and unpacking the results into fpr, tpr, and thresholds.
  • Plot true positive rate against false positive rate.