I found an equality, but I don't see why it is true. I hope you can help me see it.
Why is it true that $E[P(X|Y)]=\sum_iP(X|Y=i)P(Y=i)$?
Thank you!
I found an equality, but I don't see why it is true. I hope you can help me see it.
Why is it true that $E[P(X|Y)]=\sum_iP(X|Y=i)P(Y=i)$?
Thank you!
Copyright © 2021 JogjaFile Inc.
$P(X|Y)$ is a function of $Y$, and we could write $f(Y) = P(X|Y)$ for some function $f$. Then $$ \mathbb{E}[P(X|Y)] = \mathbb{E}(g(Y)) = \sum_{y} g(y)\mathbb{P}(Y=y) = \sum_{y} P(X|Y=y)\mathbb{P}(Y=y) $$