Consider domain $X$, label set $ Y=\{0,1\} $ and the zero-one loss. Given any probabillity distribution D over $ X\times \{0,1\} $, we've defined the Bayes classidier $ f_D $ to be- $ f_{D}(x)= \begin{cases} 1 & if\,\mathbb{P}[y=1|x]\geq\frac{1}{2}\\ 0 & otherwise \end{cases} $ I wish to prove that for any classifer $ g:X\rightarrow\{0,1\}$ it holds that $ L_D(f_D)\leq L_D(g)$, which means that $ f_D$ is optimal. $L_D(h) $ is defined to be the "true error" of the classifier h. That is, $L_D(h)=D\{(x,y)| h(x)\not = y\}$. I'm having some hard time proving this given the definitions above, and some hints/intuition will be appriciated.