Skip to content

Instantly share code, notes, and snippets.

@64lines
Created November 30, 2017 00:51
Show Gist options
  • Select an option

  • Save 64lines/6a5692a23d4b938e97629ac973a2fbef to your computer and use it in GitHub Desktop.

Select an option

Save 64lines/6a5692a23d4b938e97629ac973a2fbef to your computer and use it in GitHub Desktop.
[PYTHON][SKLEARN] Plotting Logistic Regression Raw
# 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