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.
Deze oefening maakt deel uit van de cursus
Supervised Learning with scikit-learn
Praktische interactieve oefening
Probeer deze oefening eens door deze voorbeeldcode in te vullen.
# Import roc_curve
____
# Generate ROC curve values: fpr, tpr, thresholds
fpr, tpr, thresholds = ____(____, ____)
plt.plot([0, 1], [0, 1], 'k--')
# Plot tpr against fpr
plt.plot(____, ____)
plt.xlabel('False Positive Rate')
plt.ylabel('True Positive Rate')
plt.title('ROC Curve for Diabetes Prediction')
plt.show()