Considering that input $x$ is a scalar, the data generation process works as follows:
- First, a target t is sampled from {0, 1} with equal probability.
- If t = 0, x is sampled from a uniform distribution over the interval [0, 1].
- If t = 1, x is sampled from a uniform distribution over the interval [0, 2].
I'm trying to find the formula for $P(t=1)$, $P(t=0)$, $P(x|t=1)$ and $P(x|t=0)$ and then find the posterior probability $P(t = 0|x)$ as a function of $x$.
So far I have that $P(t=1)$ and $P(t=0)$ $=$ $\frac12$ but I wasn't sure how to find $P(x|t=1)$ and $P(x|t=0)$.
I know from there we can just use $P(A|B)=\frac{P(B|A)P(A)}{P(B)}$ to compute the probability $P(t = 0|x)$ as a function of $x$. Is that correct?
You have prior $T\sim Ber(1/2)$
You have data generation model, aka model of observation \begin{equation} f_{X|T=0}(x)=\begin{cases} 1,&0\leq x \leq 1\\ 0,&\text{otherwise} \end{cases} \end{equation}
\begin{equation} f_{X|T=1}(x)=\begin{cases} 1/2,&0\leq x \leq 2\\ 0,&\text{otherwise} \end{cases} \end{equation}
All you need is to apply Bayes rule in the form
\begin{equation} p_{T|X=x}(t)=\frac{f_{X|T=t}(x)p_T(t)}{f_X(x)} \end{equation} to obtain posterior.