Understanding Bishop on EM for HMM's I'm reading page 616 of Bishop's PRML (pdf), which introduces EM for hidden markov models with categorical hidden states and arbitrary emission distributions. Bishop defines $z_n$ as the hidden state at time $n$, $x_n$ as the corresponding observation, and $\theta$ as all the parameters. When parameters are viewed separately, he writes $\pi$ for the initial condition, $A$ for the transition probabilities, and emission distribution parameters $\phi$. All told, the log likelihood is
$$\log p(z_1|\pi) + \sum_{n=2}^N \log p(z_n|z_{n-1}, A) + \sum_{n=1}^N \log p(x_n|z_n, \phi)$$
or
$$\sum_{k=1}^K z_{1k} \log \pi_k + \sum_{n=2}^N \sum_{k=1}^K\sum_{j=1}^K z_{nk}z_{n-1,j}\log A_{jk} + \sum_{n=1}^N \sum_{k=1}^K z_{nk}\log p(x_n|\phi_k)$$.
Bishop then defines two functions:
$$\gamma(z_n) = p(z_n | X, \theta)$$
$$\xi(z_n, z_{n-1}) = p(z_n, z_{n-1} | X, \theta)$$
These are a length-K vector and a K by K matrix, where $K$ is the size of the state space. Some people might prefer to notate them as $\gamma_n$ and $\xi_{n}$ because they depend on $n$, but they don't really depend on any realization of $z$.
The confusing part
Bishop then introduces these.
$$\gamma(z_{nk}) = E[z_{nk}] = \sum_{z_n} \gamma(z) z_{nk} $$
$$\xi(z_{nk}, z_{n-1,j}) = E[z_{nk}z_{n-1,j}] = \sum_{z_n, z_n-1} \gamma(z) z_{nk}z_{n-1,j} $$
The summations lack an index, as $\sum_0^9 i$, but I can't fill in the missing piece (the $_{i=}$).

*

*I would guess it is $_{z=}$, but then both lines equate scalars (left, middle) with a length-K vector (right). The text is very explicit about which ones are scalars, vectors, and matrices. Also, for the top line, the sum is over only one term, as in $\sum_{i=3.1415926535} i$, which begs the question of why it is included.

*The top RHS works much better if it's read as $\sum_k{[\gamma(z_n)]_k z_{nk}}$, but that's nonsense because the sum is not taken over the variable masquerading as the index. It's similar to writing $\sum_{i=1}v_{ij}w_j$ when you mean $\sum_j v_{1j}w_j$. It's also unclear how to generalize this strange reading to the second equation.

What's going on here? I'm lost & frustrated. Thanks!
 A: In my version the summation notation is slightly different; it has
$$γ(z_{nk})=E[z_{nk}]=\sum_{\textbf{z}}γ(\textbf{z})z_{nk}$$
and the same for the second equation - it's over $\textbf{z}$.
I started off assuming $\textbf{z}$ is implying $\textbf{z}_n$ - remembering that each $\textbf{z}_n$ is a K-dimensional binary variable.
This doesn't make sense to me, because the summation of the probabilities should equal one. $z_{nk}$ should be 1 or 0, but from the text I was assuming it should be 1. Which leaves us with $\gamma(z_{nk}) = 1$, which is clearly wrong.
The other options are that $\textbf{z} = \textbf{Z}$, but that makes less sense to me, or that it's somehow implying that it should be the probability of $z_{nk} = 1$ conditioned on all the previous latent variables, but I can't see how.
I'll note finally that he brings $\gamma(z_{nk})$ back in section 13.2.2 with the phrase 'Let us begin by evaluating $\gamma(z_{nk})$', and then proceeds to evaluate $\gamma(\textbf{z}_{n})$. So I'm confused too.
Posting this as an answer instead of a comment 'cos it's easier to write the maths, and also intending to update it once I can ponder some more. If you have any insight in the meantime, please let me know...
A: Considering how these quantities are used to derive EM updates, these equations seem to be wrong in multiple ways, and the corrected versions would probably read:
$$\gamma(z_{nk}) = E[z_{nk}] =  \gamma(z_n)_k  $$
$$\xi(z_{nk}, z_{n-1,j}) = E[z_{nk}z_{n-1,j}] = \xi(z_n, z_{n-1})_{k,j}$$
This is closest to the second option in the question. As support for this claim, note that Bishop often writes $\sum_{z_n} f(z_n)$ to mean $\sum_{k=1}^K f(z_n=k)$, for example in 13.36 and 13.38. Allowing for this, his notation almost works, because when $z_{n}=k$, $z_{nk}=1$ and $z_n$'s other entries are 0. The bottom equation still doesn't work, but the top equation does.
