Consider domain $X$, label set $ Y=\{0,1\} $$ Y=\{0,1\}$ and the zero-one loss.
Given any probabillityprobability distribution D over $ X\times \{0,1\} $, we've defined the Bayes classidierclassifier $ f_D $ to be-
$ f_{D}(x)= \begin{cases} 1 & if\,\mathbb{P}[y=1|x]\geq\frac{1}{2}\\ 0 & otherwise \end{cases} $$$ f_{D}(x)= \begin{cases} 1 & \text{if }\mathbb{P}[y=1|x]\geq\tfrac{1}{2}\\ 0 & \text{otherwise.} \end{cases} $$
I wish to prove that, for any classifer $ g:X\rightarrow\{0,1\}$ it holds that$ g\colon X\rightarrow\{0,1\}$, $ 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$h$. That is, $L_D(h)=D\{(x,y)| h(x)\not = y\}$$L_D(h)=D\{(x,y)\mid h(x)\not = y\}$.
I'm having some hard time proving this given the definitions above, and some hints/intuition will be appriciatedappreciated.