system
Given the following post, respond as if you're commenting on Reddit:
human
Logistic Regression, does y need to be 0 or 1?

Not sure if it fits this subreddit, but was doing some Logistic Regression with Python and had some errors. At the end I think I fixed it.

I first had y to be values of 2 or 4. I believe these did have a meaning.  When I changed them to 0 and 1 my ROC Curve made more sense.

My question is, does the y (what you want to predict) need to be 0 and 1, even if you only have 2 possible values (like 2 and 4)? And if so, why?
gpt
Logistic regression models two groups which are **arbitrarily** labeled 0 and 1 for mathematical convenience --- it models a Bernoulli variable. Sometimes the groups are signified by -1 and 1 and the formulae becomes slightly different.  

Whether or not you can recode to 0 and 1 depends on the meaning of your 2 and 4. If they are just arbitrary codes, then it is fine. If they convey something else, it might not...