Solution (source code)

= Solution

Let $\theta=(\beta,\pi)$ and regard $X_U$ as the <latent variable>. At iteration $t$, the E-step forms
$$
Q(\theta\mid\theta^{(t)})
=\mathbb E_{\theta^{(t)}}[
\log p(Y,X_U,X_O,\theta)
\mid Y,X_O].
$$
The M-step updates
$$
\theta^{(t+1)}\in\arg\max_\theta
Q(\theta\mid\theta^{(t)}).
$$
This is the <expectation-maximization algorithm> for the posterior objective: including $\log p(\theta)$ in the complete-data log density makes the maximizer a <maximum a posteriori estimate> rather than a maximum-likelihood estimate.