Created
November 30, 2017 00:51
-
-
Save 64lines/6a5692a23d4b938e97629ac973a2fbef to your computer and use it in GitHub Desktop.
[PYTHON][SKLEARN] Plotting Logistic Regression Raw
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Import necessary modules | |
| from sklearn.metrics import roc_curve | |
| # Compute predicted probabilities: y_pred_prob | |
| y_pred_prob = logreg.predict_proba(X_test)[:,1] | |
| # Generate ROC curve values: fpr, tpr, thresholds | |
| fpr, tpr, thresholds = roc_curve(y_test, y_pred_prob) | |
| # Plot ROC curve | |
| plt.plot([0, 1], [0, 1], 'k--') | |
| plt.plot(fpr, tpr) | |
| plt.xlabel('False Positive Rate') | |
| plt.ylabel('True Positive Rate') | |
| plt.title('ROC Curve') | |
| plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment