Consider the following experiment:
We generate "green" points and "blue" points in $\mathbf{R}$ using two different normal distributions as follows:
- 1000 green points are sampled from a $N(-1, 1)$ distribution
- 1000 blue poiints are sampled from a $N(1,1)$ distribution
Now I hide the colors of the points, point to one of them at random and ask you: What is the probability that this point is green?
I think we want: $$P(g | X=x) = \frac{P(X=x | g)P(g)}{P(X=x)}.$$
Now I think $P(g)=\frac{1}{2}$, since green and blue are equally likely, and $P(X=x) = \frac{1}{2000}$ since I am showing you one of 2000 points with equal probability. What throws me off is the $P(X=x | g)$. This is the probability that $X=x$ when $X$ is distributed as $N(-1,1)$. Isn't this simply $0$ since $X$ is a continuous random variable? Am I way off here?
You have the right idea but the wrong Bayes formula.
You need to replace $P(X=x|g)$, which is indeed $0$, by $f_g(x)$ where $f_g$ is the pdf of $N(-1,1)$.
Similarly, $P(X=x)=0$ but you replace it by $f_g(x)P(g)+f_b(x)P(b)$. This is called a gaussian mixture.