Simplifying tricky sum of products

161 Views Asked by At

Could someone please clearly write out how we get from this expression $$\log\left[\sum_{\mathbf Z}\left(\prod_{n=1}^N\prod_{m=1}^M\pi_m^{\mathbf{1}(z_n=m)}\mathcal{N}\left(\mathbf x_n;\mathbf{\mu}_m,\mathbf{\Sigma}_m\right)^{\mathbf{1}(z_n=m)}\right)\right]$$ to this one $$\sum_{n=1}^N\log\left[\sum_{m=1}^M\pi_m\,\mathcal{N}\!\left(\mathbf x_n;\mathbf{\mu}_m,\mathbf{\Sigma}_m\right)\right]$$ Above, $$\mathbf Z=\{z_1,\dots,z_N\}$$ and $\mathbf{1}(\cdot)$ is the indicator function taking the value $1$ if its input is true and $0$ otherwise.

This is in the context of the expectation maximisation algorithm for a Gaussian mixture model, but this isn't really that important since my trouble is just with simplifying/resolving a mathematical expression.