Gaussian Mixture Models

A Gaussian mixture model (GMM) describes data as draws from Gaussian components. Each point has a hidden label that names the component that produced it:

Here the mixing weights satisfy and , and and are the mean and covariance of component . Summing over the hidden label gives the density of one point and the log-likelihood of the data:

Here collects all weights, means and covariances. The sum inside the logarithm leaves with no closed-form maximizer. Bayes’ rule gives the responsibility of component for point , the probability that produced the point:

The numbers sum to and form a soft assignment of point . The Expectation-Maximization (EM) algorithm fits the model. It starts from initial parameters, often a k-means solution, and alternates two steps:

  • E-step: compute every from the current parameters.
  • M-step: refit each component to all points, weighting point by .

With the soft counts , the M-step sets

The covariance update uses the new , and each term is a outer product. The log-likelihood never decreases from one iteration to the next. EM stops when improves by less than a tolerance, at a stationary point that is usually a local maximum.

Four covariance structures are common. They differ in cluster shape and in the number of covariance parameters:

  • Full: any ellipse, with parameters per component.
  • Diagonal: ellipses aligned with the axes, with parameters per component.
  • Spherical: round clusters, , with parameter per component.
  • Tied: one full covariance shared by all components, with parameters in total.

The likelihood is unbounded. A component that shrinks onto a single point drives , so implementations add a small to each . The number of components is chosen with the Bayesian information criterion,

where is the fitted model and counts its free parameters. With full covariances, , and the with the smallest BIC wins. K-means is the limit of EM with equal weights and as . A GMM adds elliptical clusters of different sizes, soft assignments and a density.

Intuition

The name lists the parts. A mixture draws each point from one of several sources, and here every source is a Gaussian. Picture the wait times at a café, pooled over quiet hours and rush hours. Each regime has its own bell curve, and the pooled histogram shows two humps. Nobody recorded which regime each customer came from. A GMM recovers both bell curves and the share of customers in each regime.

EM handles two unknowns that depend on each other. If the labels were known, each Gaussian would be the mean and covariance of its own points. If the Gaussians were known, Bayes’ rule would give each label’s probability. EM alternates between these two easy problems. It uses probabilities instead of hard labels, so a point between two clusters counts partly toward both.

Properties

(Weighted Sample Statistics) Each M-step update is the usual estimate for one Gaussian, with every point weighted by its responsibility.

If every were or , the updates would give each cluster’s share, mean and covariance. The covariance divides by and not , since it is a maximum likelihood estimate. The soft count acts as the number of points in cluster , and it need not be an integer. Each outer product in the covariance update has rank one. The inner product is a scalar instead. The weighted sum of inner products recovers only , the total variance, and loses every correlation.

(Likelihood Never Decreases) Each EM iteration raises or leaves it unchanged, which gives a built-in check on an implementation.

The proof in 3.11.5 EM Algorithm uses a lower bound on . The E-step makes the bound equal to at the current parameters. The M-step maximizes the bound in closed form. A drop in between iterations therefore signals a bug. The usual causes are errors in the covariance update or in the normalization of . The guarantee covers only convergence to a stationary point. Two components can end up sharing one true cluster while another cluster gets no component. EM cannot leave that state by itself. It also slows down when components overlap, since the responsibilities then change little between iterations. Practitioners run several starts and keep the best non-degenerate fit. Responsibilities are computed in log space, because Gaussian densities underflow when is large.

The animation runs EM on 62 points from a poor start. Each ellipse shows one Gaussian at one and two standard deviations. The log-likelihood rises every iteration and levels off after 11.

\usepackage{tikz}
\usetikzlibrary{animations, arrows.meta}
\begin{document}
\definecolor{hot}{HTML}{D9483B}
\definecolor{cold}{HTML}{2F80ED}
\definecolor{grn}{HTML}{2F9E44}
\newcommand{\el}[5]{\draw[#5, rotate around={#2:(#1)}] (#1) ellipse (#3 and #4);}
\newcommand{\mc}[2]{\filldraw[draw=black, fill=#2] (#1) ++(0,0.15) -- ++(0.15,-0.15) -- ++(-0.15,-0.15) -- ++(-0.15,0.15) -- cycle;}
\newcommand{\pu}[1]{\filldraw[draw=black, fill=white] (#1) circle (2.2pt);}
\newcommand{\pf}[2]{\filldraw[draw=black, fill=#2] (#1) circle (2.2pt);}
\newcommand{\ph}[2]{\filldraw[draw=#2, thick, fill=white] (#1) circle (2.1pt);}
\newcommand{\cur}[1]{\filldraw[draw=black, fill=white] (#1) circle (2.4pt);}
\begin{tikzpicture}[font=\small, >={Stealth[length=2.2mm]}]
\draw (0,0) rectangle (6.84,4.33);
\node[anchor=west] at (6.89,0.2) {$x_1$};
\node[anchor=south] at (0.25,4.33) {$x_2$};
\draw (8.29,0.55) -- (12.69,0.55);
\draw (8.29,0.55) -- (8.29,3.85);
\node[anchor=north] at (10.49,0.23) {\footnotesize iteration $t$};
\draw (8.29,0.55) -- (8.29,0.47) node[below] {\scriptsize $0$};
\draw (9.09,0.55) -- (9.09,0.47) node[below] {\scriptsize $2$};
\draw (9.89,0.55) -- (9.89,0.47) node[below] {\scriptsize $4$};
\draw (10.69,0.55) -- (10.69,0.47) node[below] {\scriptsize $6$};
\draw (11.49,0.55) -- (11.49,0.47) node[below] {\scriptsize $8$};
\draw (12.29,0.55) -- (12.29,0.47) node[below] {\scriptsize $10$};
\draw (8.29,0.55) -- (8.21,0.55) node[left] {\scriptsize $-260$};
\draw (8.29,1.21) -- (8.21,1.21) node[left] {\scriptsize $-240$};
\draw (8.29,1.87) -- (8.21,1.87) node[left] {\scriptsize $-220$};
\draw (8.29,2.53) -- (8.21,2.53) node[left] {\scriptsize $-200$};
\draw (8.29,3.19) -- (8.21,3.19) node[left] {\scriptsize $-180$};
\draw (8.29,3.85) -- (8.21,3.85) node[left] {\scriptsize $-160$};
\node[anchor=west] at (7.89,4.90) {\footnotesize $\log L = \sum_i \log \sum_k \pi_k\, \mathcal N(\mathbf x_i \mid \mu_k, \Sigma_k)$};
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 6.2s = "true", 20.8s = "true", repeats}}}]
\draw[thick] (8.29,1.11) -- (8.69,1.61);
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 9s = "true", 20.8s = "true", repeats}}}]
\draw[thick] (8.69,1.61) -- (9.09,1.77);
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 10.4s = "true", 20.8s = "true", repeats}}}]
\draw[thick] (9.09,1.77) -- (9.49,2.19);
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 11.8s = "true", 20.8s = "true", repeats}}}]
\draw[thick] (9.49,2.19) -- (9.89,2.59);
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 13s = "true", 20.8s = "true", repeats}}}]
\draw[thick] (9.89,2.59) -- (10.29,2.92);
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 13.7s = "true", 20.8s = "true", repeats}}}]
\draw[thick] (10.29,2.92) -- (10.69,3.28);
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 14.4s = "true", 20.8s = "true", repeats}}}]
\draw[thick] (10.69,3.28) -- (11.09,3.53);
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 15.1s = "true", 20.8s = "true", repeats}}}]
\draw[thick] (11.09,3.53) -- (11.49,3.67);
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 15.8s = "true", 20.8s = "true", repeats}}}]
\draw[thick] (11.49,3.67) -- (11.89,3.76);
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 16.5s = "true", 20.8s = "true", repeats}}}]
\draw[thick] (11.89,3.76) -- (12.29,3.77);
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 17.2s = "true", 20.8s = "true", repeats}}}]
\draw[thick] (12.29,3.77) -- (12.69,3.77);
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "true", 2.6s = "false", 20.8s = "false", repeats}}}]
\pu{2.72,2.24}
\pu{1.92,2.22}
\pu{0.60,1.20}
\pu{2.39,2.18}
\pu{0.76,1.79}
\pu{1.65,1.51}
\pu{2.44,2.96}
\pu{1.79,1.46}
\pu{1.99,1.77}
\pu{2.43,2.29}
\pu{2.36,2.57}
\pu{1.88,1.88}
\pu{1.21,1.85}
\pu{3.39,3.04}
\pu{2.73,2.60}
\pu{3.00,2.85}
\pu{1.82,1.92}
\pu{2.82,2.60}
\pu{3.01,2.43}
\pu{1.68,1.57}
\pu{0.48,1.31}
\pu{3.66,3.39}
\pu{2.81,2.73}
\pu{1.98,1.51}
\pu{4.83,3.37}
\pu{5.36,2.96}
\pu{5.26,3.00}
\pu{4.79,3.11}
\pu{5.57,3.73}
\pu{6.01,3.76}
\pu{5.31,3.85}
\pu{4.67,3.45}
\pu{5.53,3.31}
\pu{5.02,3.47}
\pu{5.20,3.32}
\pu{4.87,3.59}
\pu{4.98,3.10}
\pu{5.33,2.91}
\pu{4.41,2.92}
\pu{5.36,3.32}
\pu{4.51,2.98}
\pu{5.12,3.02}
\pu{4.38,3.75}
\pu{4.41,3.34}
\pu{4.93,0.80}
\pu{4.89,1.30}
\pu{4.54,0.57}
\pu{3.54,0.86}
\pu{4.67,1.00}
\pu{4.58,0.79}
\pu{4.39,0.78}
\pu{5.06,0.81}
\pu{5.01,1.45}
\pu{5.30,0.48}
\pu{6.25,1.02}
\pu{4.22,1.18}
\pu{4.95,0.75}
\pu{4.45,0.64}
\pu{4.97,1.22}
\pu{4.69,1.04}
\pu{6.36,0.58}
\pu{5.13,0.84}
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 2.6s = "true", 8.6s = "false", 20.8s = "false", repeats}}}]
\ph{2.72,2.24}{hot}
\ph{1.92,2.22}{hot}
\ph{0.60,1.20}{hot}
\ph{2.39,2.18}{hot}
\ph{0.76,1.79}{hot}
\ph{1.65,1.51}{hot}
\ph{2.44,2.96}{hot}
\ph{1.79,1.46}{hot}
\ph{1.99,1.77}{hot}
\ph{2.43,2.29}{hot}
\ph{2.36,2.57}{hot}
\ph{1.88,1.88}{hot}
\ph{1.21,1.85}{hot}
\ph{3.39,3.04}{cold}
\ph{2.73,2.60}{hot}
\ph{3.00,2.85}{hot}
\ph{1.82,1.92}{hot}
\ph{2.82,2.60}{hot}
\ph{3.01,2.43}{hot}
\ph{1.68,1.57}{hot}
\ph{0.48,1.31}{hot}
\ph{3.66,3.39}{cold}
\ph{2.81,2.73}{hot}
\ph{1.98,1.51}{hot}
\ph{4.83,3.37}{cold}
\ph{5.36,2.96}{cold}
\ph{5.26,3.00}{cold}
\ph{4.79,3.11}{cold}
\ph{5.57,3.73}{cold}
\ph{6.01,3.76}{cold}
\ph{5.31,3.85}{cold}
\ph{4.67,3.45}{cold}
\ph{5.53,3.31}{cold}
\ph{5.02,3.47}{cold}
\ph{5.20,3.32}{cold}
\ph{4.87,3.59}{cold}
\ph{4.98,3.10}{cold}
\ph{5.33,2.91}{cold}
\ph{4.41,2.92}{cold}
\ph{5.36,3.32}{cold}
\ph{4.51,2.98}{cold}
\ph{5.12,3.02}{cold}
\ph{4.38,3.75}{cold}
\ph{4.41,3.34}{cold}
\ph{4.93,0.80}{grn}
\ph{4.89,1.30}{grn}
\ph{4.54,0.57}{grn}
\ph{3.54,0.86}{grn}
\ph{4.67,1.00}{grn}
\ph{4.58,0.79}{grn}
\ph{4.39,0.78}{grn}
\ph{5.06,0.81}{grn}
\ph{5.01,1.45}{grn}
\ph{5.30,0.48}{grn}
\ph{6.25,1.02}{grn}
\ph{4.22,1.18}{grn}
\ph{4.95,0.75}{grn}
\ph{4.45,0.64}{grn}
\ph{4.97,1.22}{grn}
\ph{4.69,1.04}{grn}
\ph{6.36,0.58}{grn}
\ph{5.13,0.84}{grn}
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 8.6s = "true", 9s = "false", 20.8s = "false", repeats}}}]
\ph{2.72,2.24}{hot}
\ph{1.92,2.22}{hot}
\ph{0.60,1.20}{hot}
\ph{2.39,2.18}{hot}
\ph{0.76,1.79}{hot}
\ph{1.65,1.51}{hot}
\ph{2.44,2.96}{hot}
\ph{1.79,1.46}{hot}
\ph{1.99,1.77}{hot}
\ph{2.43,2.29}{hot}
\ph{2.36,2.57}{hot}
\ph{1.88,1.88}{hot}
\ph{1.21,1.85}{hot}
\ph{3.39,3.04}{cold}
\ph{2.73,2.60}{hot}
\ph{3.00,2.85}{hot}
\ph{1.82,1.92}{hot}
\ph{2.82,2.60}{hot}
\ph{3.01,2.43}{hot}
\ph{1.68,1.57}{hot}
\ph{0.48,1.31}{hot}
\ph{3.66,3.39}{cold}
\ph{2.81,2.73}{hot}
\ph{1.98,1.51}{hot}
\ph{4.83,3.37}{cold}
\ph{5.36,2.96}{cold}
\ph{5.26,3.00}{cold}
\ph{4.79,3.11}{cold}
\ph{5.57,3.73}{cold}
\ph{6.01,3.76}{cold}
\ph{5.31,3.85}{cold}
\ph{4.67,3.45}{cold}
\ph{5.53,3.31}{cold}
\ph{5.02,3.47}{cold}
\ph{5.20,3.32}{cold}
\ph{4.87,3.59}{cold}
\ph{4.98,3.10}{cold}
\ph{5.33,2.91}{cold}
\ph{4.41,2.92}{cold}
\ph{5.36,3.32}{cold}
\ph{4.51,2.98}{cold}
\ph{5.12,3.02}{cold}
\ph{4.38,3.75}{cold}
\ph{4.41,3.34}{cold}
\ph{4.93,0.80}{grn}
\ph{4.89,1.30}{grn}
\ph{4.54,0.57}{grn}
\ph{3.54,0.86}{grn}
\ph{4.67,1.00}{grn}
\ph{4.58,0.79}{grn}
\ph{4.39,0.78}{grn}
\ph{5.06,0.81}{grn}
\ph{5.01,1.45}{grn}
\ph{5.30,0.48}{grn}
\ph{6.25,1.02}{grn}
\ph{4.22,1.18}{grn}
\ph{4.95,0.75}{grn}
\ph{4.45,0.64}{grn}
\ph{4.97,1.22}{grn}
\ph{4.69,1.04}{grn}
\ph{6.36,0.58}{grn}
\ph{5.13,0.84}{grn}
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 9s = "true", 10.4s = "false", 20.8s = "false", repeats}}}]
\ph{2.72,2.24}{hot}
\ph{1.92,2.22}{hot}
\pf{0.60,1.20}{hot}
\ph{2.39,2.18}{hot}
\pf{0.76,1.79}{hot}
\ph{1.65,1.51}{hot}
\ph{2.44,2.96}{hot}
\ph{1.79,1.46}{hot}
\ph{1.99,1.77}{hot}
\ph{2.43,2.29}{hot}
\ph{2.36,2.57}{hot}
\ph{1.88,1.88}{hot}
\ph{1.21,1.85}{hot}
\ph{3.39,3.04}{cold}
\ph{2.73,2.60}{hot}
\ph{3.00,2.85}{hot}
\ph{1.82,1.92}{hot}
\ph{2.82,2.60}{hot}
\ph{3.01,2.43}{hot}
\ph{1.68,1.57}{hot}
\pf{0.48,1.31}{hot}
\ph{3.66,3.39}{cold}
\ph{2.81,2.73}{hot}
\ph{1.98,1.51}{hot}
\ph{4.83,3.37}{cold}
\ph{5.36,2.96}{cold}
\ph{5.26,3.00}{cold}
\ph{4.79,3.11}{cold}
\ph{5.57,3.73}{cold}
\ph{6.01,3.76}{cold}
\ph{5.31,3.85}{cold}
\ph{4.67,3.45}{cold}
\ph{5.53,3.31}{cold}
\ph{5.02,3.47}{cold}
\ph{5.20,3.32}{cold}
\ph{4.87,3.59}{cold}
\ph{4.98,3.10}{cold}
\ph{5.33,2.91}{cold}
\ph{4.41,2.92}{cold}
\ph{5.36,3.32}{cold}
\ph{4.51,2.98}{cold}
\ph{5.12,3.02}{cold}
\ph{4.38,3.75}{cold}
\ph{4.41,3.34}{cold}
\ph{4.93,0.80}{grn}
\ph{4.89,1.30}{grn}
\ph{4.54,0.57}{grn}
\ph{3.54,0.86}{grn}
\ph{4.67,1.00}{grn}
\ph{4.58,0.79}{grn}
\ph{4.39,0.78}{grn}
\ph{5.06,0.81}{grn}
\ph{5.01,1.45}{grn}
\pf{5.30,0.48}{grn}
\pf{6.25,1.02}{grn}
\ph{4.22,1.18}{grn}
\ph{4.95,0.75}{grn}
\ph{4.45,0.64}{grn}
\ph{4.97,1.22}{grn}
\ph{4.69,1.04}{grn}
\pf{6.36,0.58}{grn}
\ph{5.13,0.84}{grn}
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 10.4s = "true", 11.8s = "false", 20.8s = "false", repeats}}}]
\ph{2.72,2.24}{hot}
\ph{1.92,2.22}{hot}
\pf{0.60,1.20}{hot}
\ph{2.39,2.18}{hot}
\pf{0.76,1.79}{hot}
\ph{1.65,1.51}{hot}
\ph{2.44,2.96}{hot}
\ph{1.79,1.46}{hot}
\ph{1.99,1.77}{hot}
\ph{2.43,2.29}{hot}
\ph{2.36,2.57}{hot}
\ph{1.88,1.88}{hot}
\pf{1.21,1.85}{hot}
\ph{3.39,3.04}{hot}
\ph{2.73,2.60}{hot}
\ph{3.00,2.85}{hot}
\ph{1.82,1.92}{hot}
\ph{2.82,2.60}{hot}
\ph{3.01,2.43}{hot}
\ph{1.68,1.57}{hot}
\pf{0.48,1.31}{hot}
\ph{3.66,3.39}{cold}
\ph{2.81,2.73}{hot}
\ph{1.98,1.51}{hot}
\ph{4.83,3.37}{cold}
\ph{5.36,2.96}{cold}
\ph{5.26,3.00}{cold}
\ph{4.79,3.11}{cold}
\ph{5.57,3.73}{cold}
\ph{6.01,3.76}{cold}
\ph{5.31,3.85}{cold}
\ph{4.67,3.45}{cold}
\ph{5.53,3.31}{cold}
\ph{5.02,3.47}{cold}
\ph{5.20,3.32}{cold}
\ph{4.87,3.59}{cold}
\ph{4.98,3.10}{cold}
\ph{5.33,2.91}{cold}
\ph{4.41,2.92}{cold}
\ph{5.36,3.32}{cold}
\ph{4.51,2.98}{cold}
\ph{5.12,3.02}{cold}
\ph{4.38,3.75}{cold}
\ph{4.41,3.34}{cold}
\pf{4.93,0.80}{grn}
\pf{4.89,1.30}{grn}
\pf{4.54,0.57}{grn}
\ph{3.54,0.86}{grn}
\pf{4.67,1.00}{grn}
\pf{4.58,0.79}{grn}
\pf{4.39,0.78}{grn}
\pf{5.06,0.81}{grn}
\ph{5.01,1.45}{grn}
\pf{5.30,0.48}{grn}
\pf{6.25,1.02}{grn}
\ph{4.22,1.18}{grn}
\pf{4.95,0.75}{grn}
\pf{4.45,0.64}{grn}
\pf{4.97,1.22}{grn}
\pf{4.69,1.04}{grn}
\pf{6.36,0.58}{grn}
\pf{5.13,0.84}{grn}
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 11.8s = "true", 13s = "false", 20.8s = "false", repeats}}}]
\ph{2.72,2.24}{hot}
\pf{1.92,2.22}{hot}
\pf{0.60,1.20}{hot}
\pf{2.39,2.18}{hot}
\pf{0.76,1.79}{hot}
\pf{1.65,1.51}{hot}
\ph{2.44,2.96}{cold}
\pf{1.79,1.46}{hot}
\pf{1.99,1.77}{hot}
\ph{2.43,2.29}{hot}
\ph{2.36,2.57}{hot}
\pf{1.88,1.88}{hot}
\pf{1.21,1.85}{hot}
\ph{3.39,3.04}{hot}
\ph{2.73,2.60}{hot}
\ph{3.00,2.85}{hot}
\pf{1.82,1.92}{hot}
\ph{2.82,2.60}{hot}
\ph{3.01,2.43}{hot}
\pf{1.68,1.57}{hot}
\pf{0.48,1.31}{hot}
\ph{3.66,3.39}{cold}
\ph{2.81,2.73}{hot}
\ph{1.98,1.51}{hot}
\ph{4.83,3.37}{cold}
\ph{5.36,2.96}{cold}
\ph{5.26,3.00}{cold}
\ph{4.79,3.11}{cold}
\ph{5.57,3.73}{cold}
\ph{6.01,3.76}{cold}
\ph{5.31,3.85}{cold}
\ph{4.67,3.45}{cold}
\ph{5.53,3.31}{cold}
\ph{5.02,3.47}{cold}
\ph{5.20,3.32}{cold}
\ph{4.87,3.59}{cold}
\ph{4.98,3.10}{cold}
\ph{5.33,2.91}{cold}
\ph{4.41,2.92}{cold}
\ph{5.36,3.32}{cold}
\ph{4.51,2.98}{cold}
\ph{5.12,3.02}{cold}
\ph{4.38,3.75}{cold}
\ph{4.41,3.34}{cold}
\pf{4.93,0.80}{grn}
\pf{4.89,1.30}{grn}
\pf{4.54,0.57}{grn}
\pf{3.54,0.86}{grn}
\pf{4.67,1.00}{grn}
\pf{4.58,0.79}{grn}
\pf{4.39,0.78}{grn}
\pf{5.06,0.81}{grn}
\pf{5.01,1.45}{grn}
\pf{5.30,0.48}{grn}
\pf{6.25,1.02}{grn}
\pf{4.22,1.18}{grn}
\pf{4.95,0.75}{grn}
\pf{4.45,0.64}{grn}
\pf{4.97,1.22}{grn}
\pf{4.69,1.04}{grn}
\pf{6.36,0.58}{grn}
\pf{5.13,0.84}{grn}
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 13s = "true", 13.7s = "false", 20.8s = "false", repeats}}}]
\pf{2.72,2.24}{hot}
\pf{1.92,2.22}{hot}
\pf{0.60,1.20}{hot}
\pf{2.39,2.18}{hot}
\pf{0.76,1.79}{hot}
\pf{1.65,1.51}{hot}
\ph{2.44,2.96}{cold}
\pf{1.79,1.46}{hot}
\pf{1.99,1.77}{hot}
\pf{2.43,2.29}{hot}
\ph{2.36,2.57}{hot}
\pf{1.88,1.88}{hot}
\pf{1.21,1.85}{hot}
\ph{3.39,3.04}{hot}
\ph{2.73,2.60}{hot}
\ph{3.00,2.85}{hot}
\pf{1.82,1.92}{hot}
\ph{2.82,2.60}{hot}
\ph{3.01,2.43}{hot}
\pf{1.68,1.57}{hot}
\pf{0.48,1.31}{hot}
\ph{3.66,3.39}{cold}
\ph{2.81,2.73}{hot}
\pf{1.98,1.51}{hot}
\ph{4.83,3.37}{cold}
\ph{5.36,2.96}{cold}
\ph{5.26,3.00}{cold}
\ph{4.79,3.11}{cold}
\ph{5.57,3.73}{cold}
\ph{6.01,3.76}{cold}
\ph{5.31,3.85}{cold}
\ph{4.67,3.45}{cold}
\ph{5.53,3.31}{cold}
\ph{5.02,3.47}{cold}
\ph{5.20,3.32}{cold}
\ph{4.87,3.59}{cold}
\ph{4.98,3.10}{cold}
\ph{5.33,2.91}{cold}
\ph{4.41,2.92}{cold}
\ph{5.36,3.32}{cold}
\ph{4.51,2.98}{cold}
\ph{5.12,3.02}{cold}
\ph{4.38,3.75}{cold}
\ph{4.41,3.34}{cold}
\pf{4.93,0.80}{grn}
\pf{4.89,1.30}{grn}
\pf{4.54,0.57}{grn}
\pf{3.54,0.86}{grn}
\pf{4.67,1.00}{grn}
\pf{4.58,0.79}{grn}
\pf{4.39,0.78}{grn}
\pf{5.06,0.81}{grn}
\pf{5.01,1.45}{grn}
\pf{5.30,0.48}{grn}
\pf{6.25,1.02}{grn}
\pf{4.22,1.18}{grn}
\pf{4.95,0.75}{grn}
\pf{4.45,0.64}{grn}
\pf{4.97,1.22}{grn}
\pf{4.69,1.04}{grn}
\pf{6.36,0.58}{grn}
\pf{5.13,0.84}{grn}
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 13.7s = "true", 14.4s = "false", 20.8s = "false", repeats}}}]
\pf{2.72,2.24}{hot}
\pf{1.92,2.22}{hot}
\pf{0.60,1.20}{hot}
\pf{2.39,2.18}{hot}
\pf{0.76,1.79}{hot}
\pf{1.65,1.51}{hot}
\ph{2.44,2.96}{hot}
\pf{1.79,1.46}{hot}
\pf{1.99,1.77}{hot}
\pf{2.43,2.29}{hot}
\pf{2.36,2.57}{hot}
\pf{1.88,1.88}{hot}
\pf{1.21,1.85}{hot}
\ph{3.39,3.04}{hot}
\pf{2.73,2.60}{hot}
\ph{3.00,2.85}{hot}
\pf{1.82,1.92}{hot}
\pf{2.82,2.60}{hot}
\pf{3.01,2.43}{hot}
\pf{1.68,1.57}{hot}
\pf{0.48,1.31}{hot}
\ph{3.66,3.39}{cold}
\ph{2.81,2.73}{hot}
\pf{1.98,1.51}{hot}
\ph{4.83,3.37}{cold}
\pf{5.36,2.96}{cold}
\pf{5.26,3.00}{cold}
\ph{4.79,3.11}{cold}
\ph{5.57,3.73}{cold}
\ph{6.01,3.76}{cold}
\ph{5.31,3.85}{cold}
\ph{4.67,3.45}{cold}
\pf{5.53,3.31}{cold}
\ph{5.02,3.47}{cold}
\ph{5.20,3.32}{cold}
\ph{4.87,3.59}{cold}
\pf{4.98,3.10}{cold}
\pf{5.33,2.91}{cold}
\ph{4.41,2.92}{cold}
\pf{5.36,3.32}{cold}
\ph{4.51,2.98}{cold}
\pf{5.12,3.02}{cold}
\ph{4.38,3.75}{cold}
\ph{4.41,3.34}{cold}
\pf{4.93,0.80}{grn}
\pf{4.89,1.30}{grn}
\pf{4.54,0.57}{grn}
\pf{3.54,0.86}{grn}
\pf{4.67,1.00}{grn}
\pf{4.58,0.79}{grn}
\pf{4.39,0.78}{grn}
\pf{5.06,0.81}{grn}
\pf{5.01,1.45}{grn}
\pf{5.30,0.48}{grn}
\pf{6.25,1.02}{grn}
\pf{4.22,1.18}{grn}
\pf{4.95,0.75}{grn}
\pf{4.45,0.64}{grn}
\pf{4.97,1.22}{grn}
\pf{4.69,1.04}{grn}
\pf{6.36,0.58}{grn}
\pf{5.13,0.84}{grn}
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 14.4s = "true", 15.1s = "false", 20.8s = "false", repeats}}}]
\pf{2.72,2.24}{hot}
\pf{1.92,2.22}{hot}
\pf{0.60,1.20}{hot}
\pf{2.39,2.18}{hot}
\pf{0.76,1.79}{hot}
\pf{1.65,1.51}{hot}
\ph{2.44,2.96}{hot}
\pf{1.79,1.46}{hot}
\pf{1.99,1.77}{hot}
\pf{2.43,2.29}{hot}
\pf{2.36,2.57}{hot}
\pf{1.88,1.88}{hot}
\pf{1.21,1.85}{hot}
\ph{3.39,3.04}{hot}
\pf{2.73,2.60}{hot}
\ph{3.00,2.85}{hot}
\pf{1.82,1.92}{hot}
\pf{2.82,2.60}{hot}
\pf{3.01,2.43}{hot}
\pf{1.68,1.57}{hot}
\pf{0.48,1.31}{hot}
\ph{3.66,3.39}{cold}
\pf{2.81,2.73}{hot}
\pf{1.98,1.51}{hot}
\ph{4.83,3.37}{cold}
\pf{5.36,2.96}{cold}
\pf{5.26,3.00}{cold}
\pf{4.79,3.11}{cold}
\pf{5.57,3.73}{cold}
\pf{6.01,3.76}{cold}
\ph{5.31,3.85}{cold}
\ph{4.67,3.45}{cold}
\pf{5.53,3.31}{cold}
\pf{5.02,3.47}{cold}
\pf{5.20,3.32}{cold}
\ph{4.87,3.59}{cold}
\pf{4.98,3.10}{cold}
\pf{5.33,2.91}{cold}
\ph{4.41,2.92}{cold}
\pf{5.36,3.32}{cold}
\ph{4.51,2.98}{cold}
\pf{5.12,3.02}{cold}
\ph{4.38,3.75}{cold}
\ph{4.41,3.34}{cold}
\pf{4.93,0.80}{grn}
\pf{4.89,1.30}{grn}
\pf{4.54,0.57}{grn}
\pf{3.54,0.86}{grn}
\pf{4.67,1.00}{grn}
\pf{4.58,0.79}{grn}
\pf{4.39,0.78}{grn}
\pf{5.06,0.81}{grn}
\pf{5.01,1.45}{grn}
\pf{5.30,0.48}{grn}
\pf{6.25,1.02}{grn}
\pf{4.22,1.18}{grn}
\pf{4.95,0.75}{grn}
\pf{4.45,0.64}{grn}
\pf{4.97,1.22}{grn}
\pf{4.69,1.04}{grn}
\pf{6.36,0.58}{grn}
\pf{5.13,0.84}{grn}
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 15.1s = "true", 15.8s = "false", 20.8s = "false", repeats}}}]
\pf{2.72,2.24}{hot}
\pf{1.92,2.22}{hot}
\pf{0.60,1.20}{hot}
\pf{2.39,2.18}{hot}
\pf{0.76,1.79}{hot}
\pf{1.65,1.51}{hot}
\pf{2.44,2.96}{hot}
\pf{1.79,1.46}{hot}
\pf{1.99,1.77}{hot}
\pf{2.43,2.29}{hot}
\pf{2.36,2.57}{hot}
\pf{1.88,1.88}{hot}
\pf{1.21,1.85}{hot}
\pf{3.39,3.04}{hot}
\pf{2.73,2.60}{hot}
\pf{3.00,2.85}{hot}
\pf{1.82,1.92}{hot}
\pf{2.82,2.60}{hot}
\pf{3.01,2.43}{hot}
\pf{1.68,1.57}{hot}
\pf{0.48,1.31}{hot}
\ph{3.66,3.39}{hot}
\pf{2.81,2.73}{hot}
\pf{1.98,1.51}{hot}
\pf{4.83,3.37}{cold}
\pf{5.36,2.96}{cold}
\pf{5.26,3.00}{cold}
\pf{4.79,3.11}{cold}
\pf{5.57,3.73}{cold}
\pf{6.01,3.76}{cold}
\pf{5.31,3.85}{cold}
\pf{4.67,3.45}{cold}
\pf{5.53,3.31}{cold}
\pf{5.02,3.47}{cold}
\pf{5.20,3.32}{cold}
\pf{4.87,3.59}{cold}
\pf{4.98,3.10}{cold}
\pf{5.33,2.91}{cold}
\pf{4.41,2.92}{cold}
\pf{5.36,3.32}{cold}
\pf{4.51,2.98}{cold}
\pf{5.12,3.02}{cold}
\ph{4.38,3.75}{cold}
\ph{4.41,3.34}{cold}
\pf{4.93,0.80}{grn}
\pf{4.89,1.30}{grn}
\pf{4.54,0.57}{grn}
\pf{3.54,0.86}{grn}
\pf{4.67,1.00}{grn}
\pf{4.58,0.79}{grn}
\pf{4.39,0.78}{grn}
\pf{5.06,0.81}{grn}
\pf{5.01,1.45}{grn}
\pf{5.30,0.48}{grn}
\pf{6.25,1.02}{grn}
\pf{4.22,1.18}{grn}
\pf{4.95,0.75}{grn}
\pf{4.45,0.64}{grn}
\pf{4.97,1.22}{grn}
\pf{4.69,1.04}{grn}
\pf{6.36,0.58}{grn}
\pf{5.13,0.84}{grn}
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 15.8s = "true", 16.5s = "false", 20.8s = "false", repeats}}}]
\pf{2.72,2.24}{hot}
\pf{1.92,2.22}{hot}
\pf{0.60,1.20}{hot}
\pf{2.39,2.18}{hot}
\pf{0.76,1.79}{hot}
\pf{1.65,1.51}{hot}
\pf{2.44,2.96}{hot}
\pf{1.79,1.46}{hot}
\pf{1.99,1.77}{hot}
\pf{2.43,2.29}{hot}
\pf{2.36,2.57}{hot}
\pf{1.88,1.88}{hot}
\pf{1.21,1.85}{hot}
\pf{3.39,3.04}{hot}
\pf{2.73,2.60}{hot}
\pf{3.00,2.85}{hot}
\pf{1.82,1.92}{hot}
\pf{2.82,2.60}{hot}
\pf{3.01,2.43}{hot}
\pf{1.68,1.57}{hot}
\pf{0.48,1.31}{hot}
\ph{3.66,3.39}{hot}
\pf{2.81,2.73}{hot}
\pf{1.98,1.51}{hot}
\pf{4.83,3.37}{cold}
\pf{5.36,2.96}{cold}
\pf{5.26,3.00}{cold}
\pf{4.79,3.11}{cold}
\pf{5.57,3.73}{cold}
\pf{6.01,3.76}{cold}
\pf{5.31,3.85}{cold}
\pf{4.67,3.45}{cold}
\pf{5.53,3.31}{cold}
\pf{5.02,3.47}{cold}
\pf{5.20,3.32}{cold}
\pf{4.87,3.59}{cold}
\pf{4.98,3.10}{cold}
\pf{5.33,2.91}{cold}
\pf{4.41,2.92}{cold}
\pf{5.36,3.32}{cold}
\pf{4.51,2.98}{cold}
\pf{5.12,3.02}{cold}
\ph{4.38,3.75}{cold}
\pf{4.41,3.34}{cold}
\pf{4.93,0.80}{grn}
\pf{4.89,1.30}{grn}
\pf{4.54,0.57}{grn}
\pf{3.54,0.86}{grn}
\pf{4.67,1.00}{grn}
\pf{4.58,0.79}{grn}
\pf{4.39,0.78}{grn}
\pf{5.06,0.81}{grn}
\pf{5.01,1.45}{grn}
\pf{5.30,0.48}{grn}
\pf{6.25,1.02}{grn}
\pf{4.22,1.18}{grn}
\pf{4.95,0.75}{grn}
\pf{4.45,0.64}{grn}
\pf{4.97,1.22}{grn}
\pf{4.69,1.04}{grn}
\pf{6.36,0.58}{grn}
\pf{5.13,0.84}{grn}
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 16.5s = "true", 17.2s = "false", 20.8s = "false", repeats}}}]
\pf{2.72,2.24}{hot}
\pf{1.92,2.22}{hot}
\pf{0.60,1.20}{hot}
\pf{2.39,2.18}{hot}
\pf{0.76,1.79}{hot}
\pf{1.65,1.51}{hot}
\pf{2.44,2.96}{hot}
\pf{1.79,1.46}{hot}
\pf{1.99,1.77}{hot}
\pf{2.43,2.29}{hot}
\pf{2.36,2.57}{hot}
\pf{1.88,1.88}{hot}
\pf{1.21,1.85}{hot}
\pf{3.39,3.04}{hot}
\pf{2.73,2.60}{hot}
\pf{3.00,2.85}{hot}
\pf{1.82,1.92}{hot}
\pf{2.82,2.60}{hot}
\pf{3.01,2.43}{hot}
\pf{1.68,1.57}{hot}
\pf{0.48,1.31}{hot}
\pf{3.66,3.39}{hot}
\pf{2.81,2.73}{hot}
\pf{1.98,1.51}{hot}
\pf{4.83,3.37}{cold}
\pf{5.36,2.96}{cold}
\pf{5.26,3.00}{cold}
\pf{4.79,3.11}{cold}
\pf{5.57,3.73}{cold}
\pf{6.01,3.76}{cold}
\pf{5.31,3.85}{cold}
\pf{4.67,3.45}{cold}
\pf{5.53,3.31}{cold}
\pf{5.02,3.47}{cold}
\pf{5.20,3.32}{cold}
\pf{4.87,3.59}{cold}
\pf{4.98,3.10}{cold}
\pf{5.33,2.91}{cold}
\pf{4.41,2.92}{cold}
\pf{5.36,3.32}{cold}
\pf{4.51,2.98}{cold}
\pf{5.12,3.02}{cold}
\ph{4.38,3.75}{cold}
\pf{4.41,3.34}{cold}
\pf{4.93,0.80}{grn}
\pf{4.89,1.30}{grn}
\pf{4.54,0.57}{grn}
\pf{3.54,0.86}{grn}
\pf{4.67,1.00}{grn}
\pf{4.58,0.79}{grn}
\pf{4.39,0.78}{grn}
\pf{5.06,0.81}{grn}
\pf{5.01,1.45}{grn}
\pf{5.30,0.48}{grn}
\pf{6.25,1.02}{grn}
\pf{4.22,1.18}{grn}
\pf{4.95,0.75}{grn}
\pf{4.45,0.64}{grn}
\pf{4.97,1.22}{grn}
\pf{4.69,1.04}{grn}
\pf{6.36,0.58}{grn}
\pf{5.13,0.84}{grn}
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 17.2s = "true", 20.8s = "false", 20.8s = "false", repeats}}}]
\pf{2.72,2.24}{hot}
\pf{1.92,2.22}{hot}
\pf{0.60,1.20}{hot}
\pf{2.39,2.18}{hot}
\pf{0.76,1.79}{hot}
\pf{1.65,1.51}{hot}
\pf{2.44,2.96}{hot}
\pf{1.79,1.46}{hot}
\pf{1.99,1.77}{hot}
\pf{2.43,2.29}{hot}
\pf{2.36,2.57}{hot}
\pf{1.88,1.88}{hot}
\pf{1.21,1.85}{hot}
\pf{3.39,3.04}{hot}
\pf{2.73,2.60}{hot}
\pf{3.00,2.85}{hot}
\pf{1.82,1.92}{hot}
\pf{2.82,2.60}{hot}
\pf{3.01,2.43}{hot}
\pf{1.68,1.57}{hot}
\pf{0.48,1.31}{hot}
\pf{3.66,3.39}{hot}
\pf{2.81,2.73}{hot}
\pf{1.98,1.51}{hot}
\pf{4.83,3.37}{cold}
\pf{5.36,2.96}{cold}
\pf{5.26,3.00}{cold}
\pf{4.79,3.11}{cold}
\pf{5.57,3.73}{cold}
\pf{6.01,3.76}{cold}
\pf{5.31,3.85}{cold}
\pf{4.67,3.45}{cold}
\pf{5.53,3.31}{cold}
\pf{5.02,3.47}{cold}
\pf{5.20,3.32}{cold}
\pf{4.87,3.59}{cold}
\pf{4.98,3.10}{cold}
\pf{5.33,2.91}{cold}
\pf{4.41,2.92}{cold}
\pf{5.36,3.32}{cold}
\pf{4.51,2.98}{cold}
\pf{5.12,3.02}{cold}
\ph{4.38,3.75}{cold}
\pf{4.41,3.34}{cold}
\pf{4.93,0.80}{grn}
\pf{4.89,1.30}{grn}
\pf{4.54,0.57}{grn}
\pf{3.54,0.86}{grn}
\pf{4.67,1.00}{grn}
\pf{4.58,0.79}{grn}
\pf{4.39,0.78}{grn}
\pf{5.06,0.81}{grn}
\pf{5.01,1.45}{grn}
\pf{5.30,0.48}{grn}
\pf{6.25,1.02}{grn}
\pf{4.22,1.18}{grn}
\pf{4.95,0.75}{grn}
\pf{4.45,0.64}{grn}
\pf{4.97,1.22}{grn}
\pf{4.69,1.04}{grn}
\pf{6.36,0.58}{grn}
\pf{5.13,0.84}{grn}
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "true", 2.6s = "false", 20.8s = "false", repeats}}}]
\begin{scope}\clip (0,0) rectangle (6.84,4.33);
\el{2.86,2.36}{90.0}{1.20}{1.20}{hot, thick}
\el{2.86,2.36}{90.0}{2.40}{2.40}{hot, dashed}
\el{3.50,2.68}{90.0}{1.20}{1.20}{cold, thick}
\el{3.50,2.68}{90.0}{2.40}{2.40}{cold, dashed}
\el{3.66,1.88}{90.0}{1.20}{1.20}{grn, thick}
\el{3.66,1.88}{90.0}{2.40}{2.40}{grn, dashed}
\end{scope}
\mc{2.86,2.36}{hot}
\mc{3.50,2.68}{cold}
\mc{3.66,1.88}{grn}
\node[anchor=west] at (-0.1,-0.62) {A poor start: three wide, round Gaussians near the middle of the data.};
\node[anchor=west] at (7.89,4.40) {iteration $t = 0$: \ $\log L = -242.9$};
\cur{8.29,1.11}
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 2.6s = "true", 5.4s = "false", 20.8s = "false", repeats}}}]
\begin{scope}\clip (0,0) rectangle (6.84,4.33);
\el{2.86,2.36}{90.0}{1.20}{1.20}{hot, thick}
\el{2.86,2.36}{90.0}{2.40}{2.40}{hot, dashed}
\el{3.50,2.68}{90.0}{1.20}{1.20}{cold, thick}
\el{3.50,2.68}{90.0}{2.40}{2.40}{cold, dashed}
\el{3.66,1.88}{90.0}{1.20}{1.20}{grn, thick}
\el{3.66,1.88}{90.0}{2.40}{2.40}{grn, dashed}
\end{scope}
\mc{2.86,2.36}{hot}
\mc{3.50,2.68}{cold}
\mc{3.66,1.88}{grn}
\node[anchor=west] at (-0.1,-0.62) {E-step: each point gets responsibilities $r_{ik}$. Its color shows the largest one.};
\node[anchor=west] at (7.89,4.40) {iteration $t = 0$: \ $\log L = -242.9$};
\cur{8.29,1.11}
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 5.4s = "true", 5.6s = "false", 20.8s = "false", repeats}}}]
\begin{scope}\clip (0,0) rectangle (6.84,4.33);
\el{2.88,2.34}{-166.8}{1.25}{1.17}{hot, thick}
\el{2.88,2.34}{-166.8}{2.49}{2.33}{hot, dashed}
\el{3.56,2.66}{-160.1}{1.23}{1.18}{cold, thick}
\el{3.56,2.66}{-160.1}{2.45}{2.35}{cold, dashed}
\el{3.72,1.88}{175.9}{1.22}{1.19}{grn, thick}
\el{3.72,1.88}{175.9}{2.44}{2.38}{grn, dashed}
\end{scope}
\mc{2.88,2.34}{hot}
\mc{3.56,2.66}{cold}
\mc{3.72,1.88}{grn}
\node[anchor=west] at (-0.1,-0.62) {M-step: each Gaussian refits its mean, covariance and weight to its weighted points.};
\node[anchor=west] at (7.89,4.40) {iteration $t = 0$: \ $\log L = -242.9$};
\cur{8.29,1.11}
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 5.6s = "true", 5.8s = "false", 20.8s = "false", repeats}}}]
\begin{scope}\clip (0,0) rectangle (6.84,4.33);
\el{2.92,2.28}{-166.8}{1.35}{1.08}{hot, thick}
\el{2.92,2.28}{-166.8}{2.71}{2.16}{hot, dashed}
\el{3.73,2.62}{-160.1}{1.28}{1.12}{cold, thick}
\el{3.73,2.62}{-160.1}{2.57}{2.23}{cold, dashed}
\el{3.87,1.88}{175.9}{1.26}{1.16}{grn, thick}
\el{3.87,1.88}{175.9}{2.52}{2.32}{grn, dashed}
\end{scope}
\mc{2.92,2.28}{hot}
\mc{3.73,2.62}{cold}
\mc{3.87,1.88}{grn}
\node[anchor=west] at (-0.1,-0.62) {M-step: each Gaussian refits its mean, covariance and weight to its weighted points.};
\node[anchor=west] at (7.89,4.40) {iteration $t = 0$: \ $\log L = -242.9$};
\cur{8.29,1.11}
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 5.8s = "true", 6s = "false", 20.8s = "false", repeats}}}]
\begin{scope}\clip (0,0) rectangle (6.84,4.33);
\el{2.98,2.21}{-166.8}{1.47}{0.97}{hot, thick}
\el{2.98,2.21}{-166.8}{2.94}{1.94}{hot, dashed}
\el{3.92,2.57}{-160.1}{1.35}{1.04}{cold, thick}
\el{3.92,2.57}{-160.1}{2.70}{2.08}{cold, dashed}
\el{4.06,1.89}{175.9}{1.31}{1.13}{grn, thick}
\el{4.06,1.89}{175.9}{2.62}{2.25}{grn, dashed}
\end{scope}
\mc{2.98,2.21}{hot}
\mc{3.92,2.57}{cold}
\mc{4.06,1.89}{grn}
\node[anchor=west] at (-0.1,-0.62) {M-step: each Gaussian refits its mean, covariance and weight to its weighted points.};
\node[anchor=west] at (7.89,4.40) {iteration $t = 0$: \ $\log L = -242.9$};
\cur{8.29,1.11}
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 6s = "true", 6.2s = "false", 20.8s = "false", repeats}}}]
\begin{scope}\clip (0,0) rectangle (6.84,4.33);
\el{3.03,2.15}{-166.8}{1.56}{0.86}{hot, thick}
\el{3.03,2.15}{-166.8}{3.12}{1.73}{hot, dashed}
\el{4.08,2.53}{-160.1}{1.40}{0.97}{cold, thick}
\el{4.08,2.53}{-160.1}{2.80}{1.94}{cold, dashed}
\el{4.21,1.89}{175.9}{1.35}{1.10}{grn, thick}
\el{4.21,1.89}{175.9}{2.70}{2.20}{grn, dashed}
\end{scope}
\mc{3.03,2.15}{hot}
\mc{4.08,2.53}{cold}
\mc{4.21,1.89}{grn}
\node[anchor=west] at (-0.1,-0.62) {M-step: each Gaussian refits its mean, covariance and weight to its weighted points.};
\node[anchor=west] at (7.89,4.40) {iteration $t = 0$: \ $\log L = -242.9$};
\cur{8.29,1.11}
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 6.2s = "true", 8.6s = "false", 20.8s = "false", repeats}}}]
\begin{scope}\clip (0,0) rectangle (6.84,4.33);
\el{3.05,2.12}{-166.8}{1.60}{0.81}{hot, thick}
\el{3.05,2.12}{-166.8}{3.20}{1.63}{hot, dashed}
\el{4.15,2.51}{-160.1}{1.42}{0.94}{cold, thick}
\el{4.15,2.51}{-160.1}{2.85}{1.88}{cold, dashed}
\el{4.27,1.89}{175.9}{1.37}{1.09}{grn, thick}
\el{4.27,1.89}{175.9}{2.74}{2.17}{grn, dashed}
\end{scope}
\mc{3.05,2.12}{hot}
\mc{4.15,2.51}{cold}
\mc{4.27,1.89}{grn}
\node[anchor=west] at (-0.1,-0.62) {M-step: each Gaussian refits its mean, covariance and weight to its weighted points.};
\node[anchor=west] at (7.89,4.40) {iteration $t = 1$: \ $\log L = -228.0$};
\cur{8.69,1.61}
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 8.6s = "true", 8.8s = "false", 20.8s = "false", repeats}}}]
\begin{scope}\clip (0,0) rectangle (6.84,4.33);
\el{2.99,2.13}{-165.3}{1.60}{0.78}{hot, thick}
\el{2.99,2.13}{-165.3}{3.21}{1.56}{hot, dashed}
\el{4.17,2.54}{-159.0}{1.41}{0.92}{cold, thick}
\el{4.17,2.54}{-159.0}{2.83}{1.85}{cold, dashed}
\el{4.31,1.86}{171.8}{1.34}{1.08}{grn, thick}
\el{4.31,1.86}{171.8}{2.68}{2.16}{grn, dashed}
\end{scope}
\mc{2.99,2.13}{hot}
\mc{4.17,2.54}{cold}
\mc{4.31,1.86}{grn}
\node[anchor=west] at (-0.1,-0.62) {EM repeats both steps. The log-likelihood never decreases.};
\node[anchor=west] at (7.89,4.40) {iteration $t = 1$: \ $\log L = -228.0$};
\cur{8.69,1.61}
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 8.8s = "true", 9s = "false", 20.8s = "false", repeats}}}]
\begin{scope}\clip (0,0) rectangle (6.84,4.33);
\el{2.88,2.15}{-163.0}{1.62}{0.71}{hot, thick}
\el{2.88,2.15}{-163.0}{3.23}{1.41}{hot, dashed}
\el{4.19,2.59}{-157.2}{1.40}{0.89}{cold, thick}
\el{4.19,2.59}{-157.2}{2.79}{1.78}{cold, dashed}
\el{4.38,1.80}{161.3}{1.29}{1.06}{grn, thick}
\el{4.38,1.80}{161.3}{2.58}{2.13}{grn, dashed}
\end{scope}
\mc{2.88,2.15}{hot}
\mc{4.19,2.59}{cold}
\mc{4.38,1.80}{grn}
\node[anchor=west] at (-0.1,-0.62) {EM repeats both steps. The log-likelihood never decreases.};
\node[anchor=west] at (7.89,4.40) {iteration $t = 1$: \ $\log L = -228.0$};
\cur{8.69,1.61}
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 9s = "true", 10s = "false", 20.8s = "false", repeats}}}]
\begin{scope}\clip (0,0) rectangle (6.84,4.33);
\el{2.82,2.17}{-161.8}{1.62}{0.66}{hot, thick}
\el{2.82,2.17}{-161.8}{3.24}{1.33}{hot, dashed}
\el{4.21,2.61}{-156.2}{1.39}{0.87}{cold, thick}
\el{4.21,2.61}{-156.2}{2.78}{1.74}{cold, dashed}
\el{4.42,1.77}{154.6}{1.27}{1.05}{grn, thick}
\el{4.42,1.77}{154.6}{2.54}{2.09}{grn, dashed}
\end{scope}
\mc{2.82,2.17}{hot}
\mc{4.21,2.61}{cold}
\mc{4.42,1.77}{grn}
\node[anchor=west] at (-0.1,-0.62) {EM repeats both steps. The log-likelihood never decreases.};
\node[anchor=west] at (7.89,4.40) {iteration $t = 2$: \ $\log L = -222.9$};
\cur{9.09,1.77}
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 10s = "true", 10.2s = "false", 20.8s = "false", repeats}}}]
\begin{scope}\clip (0,0) rectangle (6.84,4.33);
\el{2.77,2.19}{-160.3}{1.62}{0.61}{hot, thick}
\el{2.77,2.19}{-160.3}{3.24}{1.22}{hot, dashed}
\el{4.23,2.65}{-155.7}{1.38}{0.84}{cold, thick}
\el{4.23,2.65}{-155.7}{2.75}{1.68}{cold, dashed}
\el{4.46,1.73}{149.4}{1.24}{1.02}{grn, thick}
\el{4.46,1.73}{149.4}{2.47}{2.04}{grn, dashed}
\end{scope}
\mc{2.77,2.19}{hot}
\mc{4.23,2.65}{cold}
\mc{4.46,1.73}{grn}
\node[anchor=west] at (-0.1,-0.62) {EM repeats both steps. The log-likelihood never decreases.};
\node[anchor=west] at (7.89,4.40) {iteration $t = 2$: \ $\log L = -222.9$};
\cur{9.09,1.77}
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 10.2s = "true", 10.4s = "false", 20.8s = "false", repeats}}}]
\begin{scope}\clip (0,0) rectangle (6.84,4.33);
\el{2.67,2.23}{-157.7}{1.61}{0.49}{hot, thick}
\el{2.67,2.23}{-157.7}{3.22}{0.98}{hot, dashed}
\el{4.27,2.73}{-155.0}{1.36}{0.79}{cold, thick}
\el{4.27,2.73}{-155.0}{2.71}{1.57}{cold, dashed}
\el{4.55,1.64}{138.7}{1.18}{0.96}{grn, thick}
\el{4.55,1.64}{138.7}{2.36}{1.93}{grn, dashed}
\end{scope}
\mc{2.67,2.23}{hot}
\mc{4.27,2.73}{cold}
\mc{4.55,1.64}{grn}
\node[anchor=west] at (-0.1,-0.62) {EM repeats both steps. The log-likelihood never decreases.};
\node[anchor=west] at (7.89,4.40) {iteration $t = 2$: \ $\log L = -222.9$};
\cur{9.09,1.77}
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 10.4s = "true", 11.4s = "false", 20.8s = "false", repeats}}}]
\begin{scope}\clip (0,0) rectangle (6.84,4.33);
\el{2.62,2.25}{-156.5}{1.61}{0.41}{hot, thick}
\el{2.62,2.25}{-156.5}{3.22}{0.81}{hot, dashed}
\el{4.29,2.77}{-154.6}{1.34}{0.75}{cold, thick}
\el{4.29,2.77}{-154.6}{2.69}{1.51}{cold, dashed}
\el{4.59,1.60}{133.0}{1.16}{0.92}{grn, thick}
\el{4.59,1.60}{133.0}{2.32}{1.85}{grn, dashed}
\end{scope}
\mc{2.62,2.25}{hot}
\mc{4.29,2.77}{cold}
\mc{4.59,1.60}{grn}
\node[anchor=west] at (-0.1,-0.62) {EM repeats both steps. The log-likelihood never decreases.};
\node[anchor=west] at (7.89,4.40) {iteration $t = 3$: \ $\log L = -210.3$};
\cur{9.49,2.19}
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 11.4s = "true", 11.6s = "false", 20.8s = "false", repeats}}}]
\begin{scope}\clip (0,0) rectangle (6.84,4.33);
\el{2.63,2.27}{-156.0}{1.61}{0.38}{hot, thick}
\el{2.63,2.27}{-156.0}{3.21}{0.75}{hot, dashed}
\el{4.33,2.83}{-155.0}{1.32}{0.71}{cold, thick}
\el{4.33,2.83}{-155.0}{2.64}{1.42}{cold, dashed}
\el{4.64,1.54}{129.5}{1.12}{0.89}{grn, thick}
\el{4.64,1.54}{129.5}{2.23}{1.77}{grn, dashed}
\end{scope}
\mc{2.63,2.27}{hot}
\mc{4.33,2.83}{cold}
\mc{4.64,1.54}{grn}
\node[anchor=west] at (-0.1,-0.62) {EM repeats both steps. The log-likelihood never decreases.};
\node[anchor=west] at (7.89,4.40) {iteration $t = 3$: \ $\log L = -210.3$};
\cur{9.49,2.19}
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 11.6s = "true", 11.8s = "false", 20.8s = "false", repeats}}}]
\begin{scope}\clip (0,0) rectangle (6.84,4.33);
\el{2.64,2.30}{-155.2}{1.60}{0.31}{hot, thick}
\el{2.64,2.30}{-155.2}{3.20}{0.63}{hot, dashed}
\el{4.40,2.94}{-155.8}{1.28}{0.61}{cold, thick}
\el{4.40,2.94}{-155.8}{2.55}{1.23}{cold, dashed}
\el{4.72,1.44}{121.9}{1.04}{0.81}{grn, thick}
\el{4.72,1.44}{121.9}{2.09}{1.62}{grn, dashed}
\end{scope}
\mc{2.64,2.30}{hot}
\mc{4.40,2.94}{cold}
\mc{4.72,1.44}{grn}
\node[anchor=west] at (-0.1,-0.62) {EM repeats both steps. The log-likelihood never decreases.};
\node[anchor=west] at (7.89,4.40) {iteration $t = 3$: \ $\log L = -210.3$};
\cur{9.49,2.19}
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 11.8s = "true", 12.8s = "false", 20.8s = "false", repeats}}}]
\begin{scope}\clip (0,0) rectangle (6.84,4.33);
\el{2.64,2.32}{-154.8}{1.60}{0.27}{hot, thick}
\el{2.64,2.32}{-154.8}{3.20}{0.55}{hot, dashed}
\el{4.43,3.00}{-156.3}{1.25}{0.56}{cold, thick}
\el{4.43,3.00}{-156.3}{2.50}{1.11}{cold, dashed}
\el{4.76,1.38}{117.5}{1.00}{0.76}{grn, thick}
\el{4.76,1.38}{117.5}{2.01}{1.52}{grn, dashed}
\end{scope}
\mc{2.64,2.32}{hot}
\mc{4.43,3.00}{cold}
\mc{4.76,1.38}{grn}
\node[anchor=west] at (-0.1,-0.62) {EM repeats both steps. The log-likelihood never decreases.};
\node[anchor=west] at (7.89,4.40) {iteration $t = 4$: \ $\log L = -198.1$};
\cur{9.89,2.59}
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 12.8s = "true", 13s = "false", 20.8s = "false", repeats}}}]
\begin{scope}\clip (0,0) rectangle (6.84,4.33);
\el{2.66,2.33}{-154.4}{1.59}{0.27}{hot, thick}
\el{2.66,2.33}{-154.4}{3.18}{0.53}{hot, dashed}
\el{4.51,3.08}{-159.0}{1.18}{0.47}{cold, thick}
\el{4.51,3.08}{-159.0}{2.37}{0.93}{cold, dashed}
\el{4.81,1.27}{115.7}{0.90}{0.71}{grn, thick}
\el{4.81,1.27}{115.7}{1.80}{1.42}{grn, dashed}
\end{scope}
\mc{2.66,2.33}{hot}
\mc{4.51,3.08}{cold}
\mc{4.81,1.27}{grn}
\node[anchor=west] at (-0.1,-0.62) {EM repeats both steps. The log-likelihood never decreases.};
\node[anchor=west] at (7.89,4.40) {iteration $t = 4$: \ $\log L = -198.1$};
\cur{9.89,2.59}
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 13s = "true", 13.5s = "false", 20.8s = "false", repeats}}}]
\begin{scope}\clip (0,0) rectangle (6.84,4.33);
\el{2.67,2.35}{-154.0}{1.58}{0.26}{hot, thick}
\el{2.67,2.35}{-154.0}{3.16}{0.52}{hot, dashed}
\el{4.59,3.17}{-162.0}{1.11}{0.34}{cold, thick}
\el{4.59,3.17}{-162.0}{2.22}{0.68}{cold, dashed}
\el{4.86,1.16}{111.4}{0.78}{0.65}{grn, thick}
\el{4.86,1.16}{111.4}{1.57}{1.31}{grn, dashed}
\end{scope}
\mc{2.67,2.35}{hot}
\mc{4.59,3.17}{cold}
\mc{4.86,1.16}{grn}
\node[anchor=west] at (-0.1,-0.62) {EM repeats both steps. The log-likelihood never decreases.};
\node[anchor=west] at (7.89,4.40) {iteration $t = 5$: \ $\log L = -188.1$};
\cur{10.29,2.92}
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 13.5s = "true", 13.7s = "false", 20.8s = "false", repeats}}}]
\begin{scope}\clip (0,0) rectangle (6.84,4.33);
\el{2.62,2.33}{-153.6}{1.54}{0.26}{hot, thick}
\el{2.62,2.33}{-153.6}{3.08}{0.52}{hot, dashed}
\el{4.66,3.20}{-164.0}{1.03}{0.32}{cold, thick}
\el{4.66,3.20}{-164.0}{2.05}{0.64}{cold, dashed}
\el{4.87,1.06}{145.1}{0.68}{0.61}{grn, thick}
\el{4.87,1.06}{145.1}{1.35}{1.22}{grn, dashed}
\end{scope}
\mc{2.62,2.33}{hot}
\mc{4.66,3.20}{cold}
\mc{4.87,1.06}{grn}
\node[anchor=west] at (-0.1,-0.62) {EM repeats both steps. The log-likelihood never decreases.};
\node[anchor=west] at (7.89,4.40) {iteration $t = 5$: \ $\log L = -188.1$};
\cur{10.29,2.92}
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 13.7s = "true", 14.2s = "false", 20.8s = "false", repeats}}}]
\begin{scope}\clip (0,0) rectangle (6.84,4.33);
\el{2.58,2.31}{-153.1}{1.50}{0.26}{hot, thick}
\el{2.58,2.31}{-153.1}{3.01}{0.52}{hot, dashed}
\el{4.73,3.23}{-166.8}{0.93}{0.29}{cold, thick}
\el{4.73,3.23}{-166.8}{1.87}{0.58}{cold, dashed}
\el{4.89,0.96}{176.5}{0.64}{0.46}{grn, thick}
\el{4.89,0.96}{176.5}{1.27}{0.92}{grn, dashed}
\end{scope}
\mc{2.58,2.31}{hot}
\mc{4.73,3.23}{cold}
\mc{4.89,0.96}{grn}
\node[anchor=west] at (-0.1,-0.62) {EM repeats both steps. The log-likelihood never decreases.};
\node[anchor=west] at (7.89,4.40) {iteration $t = 6$: \ $\log L = -177.2$};
\cur{10.69,3.28}
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 14.2s = "true", 14.4s = "false", 20.8s = "false", repeats}}}]
\begin{scope}\clip (0,0) rectangle (6.84,4.33);
\el{2.50,2.28}{-152.5}{1.44}{0.26}{hot, thick}
\el{2.50,2.28}{-152.5}{2.87}{0.52}{hot, dashed}
\el{4.79,3.24}{-167.8}{0.86}{0.29}{cold, thick}
\el{4.79,3.24}{-167.8}{1.72}{0.57}{cold, dashed}
\el{4.89,0.93}{177.0}{0.64}{0.37}{grn, thick}
\el{4.89,0.93}{177.0}{1.28}{0.75}{grn, dashed}
\end{scope}
\mc{2.50,2.28}{hot}
\mc{4.79,3.24}{cold}
\mc{4.89,0.93}{grn}
\node[anchor=west] at (-0.1,-0.62) {EM repeats both steps. The log-likelihood never decreases.};
\node[anchor=west] at (7.89,4.40) {iteration $t = 6$: \ $\log L = -177.2$};
\cur{10.69,3.28}
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 14.4s = "true", 14.9s = "false", 20.8s = "false", repeats}}}]
\begin{scope}\clip (0,0) rectangle (6.84,4.33);
\el{2.43,2.26}{-151.8}{1.37}{0.26}{hot, thick}
\el{2.43,2.26}{-151.8}{2.74}{0.51}{hot, dashed}
\el{4.85,3.26}{-169.4}{0.78}{0.28}{cold, thick}
\el{4.85,3.26}{-169.4}{1.55}{0.56}{cold, dashed}
\el{4.89,0.89}{177.3}{0.64}{0.26}{grn, thick}
\el{4.89,0.89}{177.3}{1.28}{0.52}{grn, dashed}
\end{scope}
\mc{2.43,2.26}{hot}
\mc{4.85,3.26}{cold}
\mc{4.89,0.89}{grn}
\node[anchor=west] at (-0.1,-0.62) {EM repeats both steps. The log-likelihood never decreases.};
\node[anchor=west] at (7.89,4.40) {iteration $t = 7$: \ $\log L = -169.6$};
\cur{11.09,3.53}
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 14.9s = "true", 15.1s = "false", 20.8s = "false", repeats}}}]
\begin{scope}\clip (0,0) rectangle (6.84,4.33);
\el{2.36,2.23}{-150.9}{1.28}{0.26}{hot, thick}
\el{2.36,2.23}{-150.9}{2.57}{0.51}{hot, dashed}
\el{4.91,3.27}{-169.6}{0.70}{0.28}{cold, thick}
\el{4.91,3.27}{-169.6}{1.39}{0.56}{cold, dashed}
\el{4.89,0.89}{177.3}{0.64}{0.26}{grn, thick}
\el{4.89,0.89}{177.3}{1.28}{0.52}{grn, dashed}
\end{scope}
\mc{2.36,2.23}{hot}
\mc{4.91,3.27}{cold}
\mc{4.89,0.89}{grn}
\node[anchor=west] at (-0.1,-0.62) {EM repeats both steps. The log-likelihood never decreases.};
\node[anchor=west] at (7.89,4.40) {iteration $t = 7$: \ $\log L = -169.6$};
\cur{11.09,3.53}
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 15.1s = "true", 15.6s = "false", 20.8s = "false", repeats}}}]
\begin{scope}\clip (0,0) rectangle (6.84,4.33);
\el{2.29,2.21}{-149.7}{1.20}{0.25}{hot, thick}
\el{2.29,2.21}{-149.7}{2.39}{0.51}{hot, dashed}
\el{4.96,3.29}{-169.9}{0.60}{0.28}{cold, thick}
\el{4.96,3.29}{-169.9}{1.21}{0.56}{cold, dashed}
\el{4.89,0.89}{177.3}{0.64}{0.26}{grn, thick}
\el{4.89,0.89}{177.3}{1.28}{0.52}{grn, dashed}
\end{scope}
\mc{2.29,2.21}{hot}
\mc{4.96,3.29}{cold}
\mc{4.89,0.89}{grn}
\node[anchor=west] at (-0.1,-0.62) {EM repeats both steps. The log-likelihood never decreases.};
\node[anchor=west] at (7.89,4.40) {iteration $t = 8$: \ $\log L = -165.3$};
\cur{11.49,3.67}
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 15.6s = "true", 15.8s = "false", 20.8s = "false", repeats}}}]
\begin{scope}\clip (0,0) rectangle (6.84,4.33);
\el{2.24,2.20}{-148.6}{1.13}{0.25}{hot, thick}
\el{2.24,2.20}{-148.6}{2.26}{0.50}{hot, dashed}
\el{5.00,3.30}{-169.1}{0.55}{0.28}{cold, thick}
\el{5.00,3.30}{-169.1}{1.09}{0.57}{cold, dashed}
\el{4.89,0.89}{177.3}{0.64}{0.26}{grn, thick}
\el{4.89,0.89}{177.3}{1.28}{0.52}{grn, dashed}
\end{scope}
\mc{2.24,2.20}{hot}
\mc{5.00,3.30}{cold}
\mc{4.89,0.89}{grn}
\node[anchor=west] at (-0.1,-0.62) {EM repeats both steps. The log-likelihood never decreases.};
\node[anchor=west] at (7.89,4.40) {iteration $t = 8$: \ $\log L = -165.3$};
\cur{11.49,3.67}
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 15.8s = "true", 16.3s = "false", 20.8s = "false", repeats}}}]
\begin{scope}\clip (0,0) rectangle (6.84,4.33);
\el{2.20,2.18}{-147.2}{1.06}{0.25}{hot, thick}
\el{2.20,2.18}{-147.2}{2.12}{0.49}{hot, dashed}
\el{5.03,3.31}{-167.7}{0.48}{0.28}{cold, thick}
\el{5.03,3.31}{-167.7}{0.97}{0.57}{cold, dashed}
\el{4.89,0.89}{177.3}{0.64}{0.26}{grn, thick}
\el{4.89,0.89}{177.3}{1.28}{0.52}{grn, dashed}
\end{scope}
\mc{2.20,2.18}{hot}
\mc{5.03,3.31}{cold}
\mc{4.89,0.89}{grn}
\node[anchor=west] at (-0.1,-0.62) {EM repeats both steps. The log-likelihood never decreases.};
\node[anchor=west] at (7.89,4.40) {iteration $t = 9$: \ $\log L = -162.7$};
\cur{11.89,3.76}
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 16.3s = "true", 16.5s = "false", 20.8s = "false", repeats}}}]
\begin{scope}\clip (0,0) rectangle (6.84,4.33);
\el{2.19,2.18}{-146.6}{1.04}{0.24}{hot, thick}
\el{2.19,2.18}{-146.6}{2.08}{0.49}{hot, dashed}
\el{5.04,3.31}{-166.2}{0.47}{0.28}{cold, thick}
\el{5.04,3.31}{-166.2}{0.93}{0.57}{cold, dashed}
\el{4.89,0.89}{177.3}{0.64}{0.26}{grn, thick}
\el{4.89,0.89}{177.3}{1.28}{0.52}{grn, dashed}
\end{scope}
\mc{2.19,2.18}{hot}
\mc{5.04,3.31}{cold}
\mc{4.89,0.89}{grn}
\node[anchor=west] at (-0.1,-0.62) {EM repeats both steps. The log-likelihood never decreases.};
\node[anchor=west] at (7.89,4.40) {iteration $t = 9$: \ $\log L = -162.7$};
\cur{11.89,3.76}
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 16.5s = "true", 17s = "false", 20.8s = "false", repeats}}}]
\begin{scope}\clip (0,0) rectangle (6.84,4.33);
\el{2.18,2.18}{-146.0}{1.02}{0.24}{hot, thick}
\el{2.18,2.18}{-146.0}{2.04}{0.48}{hot, dashed}
\el{5.05,3.31}{-164.4}{0.45}{0.28}{cold, thick}
\el{5.05,3.31}{-164.4}{0.89}{0.57}{cold, dashed}
\el{4.89,0.89}{177.3}{0.64}{0.26}{grn, thick}
\el{4.89,0.89}{177.3}{1.28}{0.52}{grn, dashed}
\end{scope}
\mc{2.18,2.18}{hot}
\mc{5.05,3.31}{cold}
\mc{4.89,0.89}{grn}
\node[anchor=west] at (-0.1,-0.62) {EM repeats both steps. The log-likelihood never decreases.};
\node[anchor=west] at (7.89,4.40) {iteration $t = 10$: \ $\log L = -162.3$};
\cur{12.29,3.77}
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 17s = "true", 17.2s = "false", 20.8s = "false", repeats}}}]
\begin{scope}\clip (0,0) rectangle (6.84,4.33);
\el{2.18,2.18}{-145.9}{1.02}{0.24}{hot, thick}
\el{2.18,2.18}{-145.9}{2.04}{0.48}{hot, dashed}
\el{5.05,3.31}{-163.8}{0.44}{0.28}{cold, thick}
\el{5.05,3.31}{-163.8}{0.89}{0.57}{cold, dashed}
\el{4.89,0.89}{177.3}{0.64}{0.26}{grn, thick}
\el{4.89,0.89}{177.3}{1.28}{0.52}{grn, dashed}
\end{scope}
\mc{2.18,2.18}{hot}
\mc{5.05,3.31}{cold}
\mc{4.89,0.89}{grn}
\node[anchor=west] at (-0.1,-0.62) {EM repeats both steps. The log-likelihood never decreases.};
\node[anchor=west] at (7.89,4.40) {iteration $t = 10$: \ $\log L = -162.3$};
\cur{12.29,3.77}
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 17.2s = "true", 20.8s = "false", 20.8s = "false", repeats}}}]
\begin{scope}\clip (0,0) rectangle (6.84,4.33);
\el{2.18,2.18}{-145.8}{1.02}{0.24}{hot, thick}
\el{2.18,2.18}{-145.8}{2.03}{0.48}{hot, dashed}
\el{5.05,3.31}{-163.2}{0.44}{0.28}{cold, thick}
\el{5.05,3.31}{-163.2}{0.88}{0.56}{cold, dashed}
\el{4.89,0.89}{177.3}{0.64}{0.26}{grn, thick}
\el{4.89,0.89}{177.3}{1.28}{0.52}{grn, dashed}
\end{scope}
\mc{2.18,2.18}{hot}
\mc{5.05,3.31}{cold}
\mc{4.89,0.89}{grn}
\node[anchor=west] at (-0.1,-0.62) {After 11 iterations $\log L$ gains under $0.05$ per step. Each ellipse fits one cluster.};
\node[anchor=west] at (7.89,4.40) {iteration $t = 11$: \ $\log L = -162.3$};
\cur{12.69,3.77}
\end{scope}
\node[anchor=west] at (-0.1,-1.12) {\footnotesize solid: $1\sigma$ ellipse, dashed: $2\sigma$ ellipse, hollow point: largest $r_{ik} < 0.9$};
\end{tikzpicture}
\end{document}

(Collapsing Components) The maximum likelihood estimate does not exist without constraints, because one component can shrink onto a single point.

Set and , and let the other components cover the remaining points. The density of component at is , which grows without bound as . Every other point keeps a positive density from the other components, so . The same failure occurs when a component’s points span fewer than dimensions. This happens whenever it has or fewer points with real weight. Its covariance is then singular, with determinant zero. Scikit-learn adds to every diagonal entry after each M-step. A prior on the covariances turns EM into MAP estimation and removes the singularity. Diagonal or tied covariances need fewer points per component. A component whose weight or determinant collapses can also be restarted at a random point.

(Covariance Shapes the Boundaries) Tied covariances give flat boundaries between clusters, and separate full covariances give curved ones.

Compare for two components. With a shared , the quadratic term cancels, and the boundary is a hyperplane. This is the algebra of linear discriminant analysis in 4.2. Linear Discriminants, with the labels unknown. Separate covariances keep the quadratic term, so the boundaries are quadrics, as in QDA. Fewer covariance parameters give a more stable fit on small data. More parameters allow flexible shapes but raise the risk of collapse. With , a full covariance has parameters per component, while a diagonal one has .

(Reading BIC) BIC charges per parameter, so it never picks more components than AIC once .

The fitted rises as grows, since a larger mixture contains every smaller one. BIC approximates times the log marginal likelihood of the model (Schwarz 1978). The Akaike information criterion (AIC) charges instead of , and once . BIC can still choose more components than there are visible groups. A skewed group may need two Gaussians to fit its shape. The components then describe pieces of a density. A separate merging step must recover the groups a person would see.

Derivation

The E-step fixes the responsibilities. 3.11.5 EM Algorithm shows that the M-step should then maximize the expected complete-data log-likelihood,

Each Gaussian log-density is

The gradient of with respect to is . Setting it to zero and multiplying by gives the weighted mean. The weights appear in only through , maximized subject to . A Lagrange multiplier gives for every . Summing over gives , so .

For the covariance, work with the precision . A scalar equals its own trace, so . The terms of that involve are then

The gradient of is , and the gradient of is for symmetric . Setting gives . The outer product enters through the trace identity.

Examples

(Easy) Was It Rush Hour?

Wait times at a café follow a two-component mixture. Quiet hours give minutes with weight . Rush hours give minutes with weight . One customer waits minutes.

(Medium) One EM Iteration

A smart meter records daily energy use of , , , and kWh. A two-component GMM starts from , and .

(Medium) How Many Delivery Zones?

A courier fits GMMs with full covariances to drop-off locations in dimensions. The fitted log-likelihoods are for , for and for .

(Hard) A Component That Collapses

Return to the five meter readings. Component is the single Gaussian fit to all of them, with mean , variance and weight . Component sits on the reading with standard deviation and weight .

See Also