Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Sangarshanan/7e8f3cb19c29ca0af550d6b9ee8cac8c to your computer and use it in GitHub Desktop.
Save Sangarshanan/7e8f3cb19c29ca0af550d6b9ee8cac8c to your computer and use it in GitHub Desktop.
Threshold of 0.5 is used by default (for binary problems) to convert predicted probabilities into class predictions
Threshold can be adjusted to increase sensitivity or specificity
Sensitivity and specificity have an inverse relationship
Increasing one would always decrease the other
Adjusting the threshold should be one of the last step you do in the model-building process
Question: Wouldn't it be nice if we could see how sensitivity and specificity are affected by various thresholds, without actually changing the threshold?
Answer: Plot the ROC curve.
AUC is the percentage of the ROC plot that is underneath the curve:
print(metrics.roc_auc_score(y_test, y_pred_prob))
https://www.ritchieng.com/machine-learning-evaluate-classification-model/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment