We can calculate the log loss for a classification problem with two classes as follows:

enter image description here

where y is the label of the actual class and p the probability of the class being positive (e.g. P(y=1)).

However, this assumes that y has the classes 0 and 1. What can I do when my class labels are actually -1 and +1? How do you calculate the log loss in that case?

  • $\begingroup$ See stats.stackexchange.com/questions/229645/… $\endgroup$ – Tim May 29 '18 at 8:54
  • 3
    $\begingroup$ recode your classes? convert -1 to 0 $\endgroup$ – ReneBt May 29 '18 at 8:56
  • 1
    $\begingroup$ Compose $\frac{z+1}{2} \mapsto y$ with your function $L: y \mapsto \ell$. $\endgroup$ – Neil G May 29 '18 at 9:01
  • 2
    $\begingroup$ Think of an outcome $y=a, b$ and write the log likelihood function (don't call this log loss) by replacing $y$ with $y=b$ and $1-y$ with $y=a$ and you'll see the general issue. This is only a labeling issue and no math is required. $\endgroup$ – Frank Harrell May 29 '18 at 12:04
  • 1
    $\begingroup$ @FrankHarrell No I agree, there is clearly an issue when you apply the classes {-1,+1}. But since the interval between the two is not important, it might as well be A or B (in my case, stock price Up or stock price Down), then I guess I can just replace -1 with 0. $\endgroup$ – JohnAndrews May 29 '18 at 16:40