I am working on a binary classification model. Currently, when I use scikit logistic regression, it outputs binary values like 0s and 1s. However, I understand, from online reading, that it outputs probability, and based on threshold of 0.5, converts them into two classes.

1) Does building a risk prediction model mean just stopping our project as soon as we get the probability output and not apply this threshold? Is that what is called as Risk prediction model? If yes, how do I do that using scikit logistic regression?

2) Does scikit logistic allow us modify the threshold?

3) Can all classification algorithms like SVM, RF, XGBOOST, etc. be used to build a risk prediction model without going for the threshold cutoff?


1 Answer 1


I will try to answer your question as shortly as possible.

  1. Yes, if you define probability as a risk, then the probabilities are risk scores. But, there's a catch in these scenarios, you will have to include the prevalence of a class to calibrate them. If Person A has a risk score of 0.9 but you have observed that the positive class is only 20% of the data, then the actual risk is much lower than the probability it self. You can use clf.predict_proba() function to get these probabilities.
  2. Once you have these probabilities, you should be able to set your custom threshold.
  3. Yes, most of these models in different libraries have predict_proba() functions.

Let me know if you have more questions.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.