# Understanding expected risk for binary classification

We have defined expected loss as follows:

$\mathbb{E}_y[C(y,a)|x] = \int C(y,a)P(y|x)dy$

"C(.)" being the cost-function, "y" the class, "a" a taken action. In the case that y can only have two possible values, say y $\in \{0,1\}$, isn't it then the case that if $P(y=1|x) = p$ it follows that $P(y=-1|x) = 1-p$? And hence if two actions are possible, expected loss could be written (in the discrete case) as:

$C(y=1,a=-1)*P(y=1|x)+C(y=-1,a=1)*1-P(y=-1|x)$?

Is this correct? I see that even in cases where there are only two classes, the posteriors P(y=1|x) and P(y=-1|x) would be used, without expressing one in the terms of the other.

• What is your question? – Tim Aug 4 '17 at 19:53
• Edited: Included my question. Particularly I was told here that this is not always the case, and I do not understand why: stats.stackexchange.com/questions/296230/… – user24544 Aug 4 '17 at 19:56