given is the following:
A mixture model comprises a non-observable $\{ 0,1\}$-valued random variable $X$ such that $P(X=1)=1-P(X=0)=\pi$ and an observable variable $Y$ such that
$Y\mid X=0$ is $g_0(y)$
$Y\mid X = 1$ is $g_1(y)$
where $g$'s are know probability densities. The unknown probability $\pi$ is assigned a Beta$(\alpha,\beta)$ prior with known $\alpha$ and $\beta$. Given a set of observations $y_1,....,y_n$ and its corresponding non-observable date $x_1,....,x_n$ the task is to find the conditional probabilities:
$f(x_i \mid y_i, \pi)$ where $x_i \in \{0,1\}$
and
$f(\pi \mid y_{1:n},x_{1:n})$
How can I start with the first one? Really don't know how should I think of the model? Should I use indicator functions and first defining the joint density like $f(x_i,y_i,\pi)=I\{X=0\}f(y_i \mid \pi)f(\pi)+I\{X=1\}f(y_i \mid \pi)f(\pi)$ ? But from here I still don't know how to do. Thank you.
As you suggest, we should start by calculating $f(x_i, y_i, \pi)$. We can factorize it as $f(x_i, y_i, \pi) = f(y_i \mid x_i, \pi) f(x_i, \pi)$ by conditional probability, and we can make the following two observations:
So $$f(y_i, x_i, \pi) \propto \pi^{x_i + \alpha - 1} (1 - \pi)^{1 - x_i + \beta - 1} g_{x_i}(y_i).$$
To calculate $f(x_i \mid y_i, \pi)$ we use Bayes' Theorem: $$f(x_i \mid y_i, \pi) = \frac{f(y_i, x_i, \pi)}{f(y_i, x_i = 0, \pi) + f(y_i, x_i = 1, \pi)}.$$