Which class the logistic regression's probabilities belong to?



Hello All,

When we do the prediction on glm model we get the probabilities, suppose for first record I got the probability of 0.7 and my class labels are: spam and no-spam.

How would I know that this predicted probability 0.7 belong to which class.

does it mean 70% chances of being spam or no-spam, and why ?

which class does it predict by default ?



Hi Vijay,

By default the probabilities belong to class 1(this can be whatever you chose it to be. i.e you can represent spam to be 1 or no-spam to be 1. But majorly, you use 1 to represent spam).




Thanks for the reply.
I have not encoded classes into 0 and 1. i am passing the data as it is to the train function, see the example below:
fit.glm <- train(Class~., data=BreastCancer, method=“glm”, metric=metric, preProc=c(“BoxCox”),
in this case for which class it will predict the probabilities for ?


Hi @vijaypalmanit,

As NSS mentioned, the probabilities by default predict the probability of class 1. Please go through the problem statement again which should mention whether the class 1 represents spam or no-spam.

Assuming the target variable is spam = 1 and not-spam = 0 (please check with the problem statement) and you get probability of 0.7, this means that there is 70% chance that the first record is spam.


What aishwarya explained absolutely correct