Sigmoid function predicts the probability value which is between 0 & 1. What is the formula in logistic regression that maps the predicted probabilities to either 1 or 0?
1 Answers
You get the output of the logistic regression $\sigma$, which is between $0$ and $1$.
Default option (is spit out out from most packages): In order to get class labels you simply map all values $\sigma \leq 0.5$ to $0$ and all values $\sigma >0.5$ to $1$. The $\sigma =0.5$ belonging to class $0$ can be different in different implementations (practically irrelevant). But it must be deterministic in order to get reproducible results. This implies that random assignment for the threshold $0.5$ should not be done.
Depending on your application you might change this rule. For example if the negative effect of wrong labels $1$ is associated with high cost (e.g. label 1 means that a person does get good conditions for life insurance). If you only want to give good conditions when your model predicts a high probability larger than 0.95. Then we would have the following rule: All values $\sigma \leq 0.95$ to $0$ and all values $\sigma >0.95$ to $1$. You have to implement this by our own from the probabilities that the logistic regression fit gives you.
- 1,918
- 7
- 15