Quiz: the multivariate Gaussian and the mixture model
Before this unit: Feature spaces & k-means (previous unit); Day 12: Thresholding.
See also: Day 33: Random forests; Day 46: Colour; Day 39: Variational autoencoders.
Short questions to test your understanding. Try each on paper first, then open the answer. A Gaussian has mean \boldsymbol\mu and covariance \Sigma; a mixture has weights \pi_k; responsibilities r_k(\mathbf x) = \pi_k\mathcal N_k(\mathbf x)/p(\mathbf x).
Q1. A 2D Gaussian has \Sigma = \begin{pmatrix} 4 & 0 \\ 0 & 1\end{pmatrix}. Describe its 1σ ellipse.
A diagonal matrix: the eigenvectors are the coordinate axes.
Axis-aligned, with half-axis \sqrt4 = 2 along x and \sqrt1 = 1 along y: twice as wide as tall.
Q2. What does a positive off-diagonal entry of \Sigma do to the ellipse, and what does it mean for the two features?
Think of two colour channels.
It tilts the ellipse towards the diagonal y = x direction: the features are positively correlated, so a pixel that is high in one tends to be high in the other.
Q3. Two points are both at Euclidean distance 3 from the mean of a Gaussian that is long in the x direction (σ = 3) and narrow in y (σ = 1). One lies at (3, 0), the other at (0, 3) relative to the mean. Give their Mahalanobis distances. Which is the outlier?
For a diagonal covariance, d_M^2 = \sum_j (x_j - \mu_j)^2/\sigma_j^2.
(3, 0): d_M = 3/3 = 1, on the 1σ ellipse, quite typical. (0, 3): d_M = 3/1 = 3, three standard deviations out across the narrow direction: the outlier.
Q4. A mixture of 4 components in 2D with full covariances. How many numbers must be estimated?
Weights (they sum to 1), means, and d(d+1)/2 numbers per covariance.
3 weights + 4 \times 2 means + 4 \times 3 covariance numbers = 23.
Q5. Describe in words how a Gaussian mixture “makes” one data point. What is hidden when we only see the data?
Two random choices.
First pick a component k with probability \pi_k, then draw the point from that component’s Gaussian. In the data we see the point but not which component was picked: the component label is hidden (latent).
Q6. Two 1D components with equal variances have \mu_1 = 100 and \mu_2 = 160. A pixel has value 130. What is r_1 if the weights are (0.5, 0.5)? If they are (0.9, 0.1)?
At the midpoint the two Gaussian densities are equal.
The densities are equal, so r_1 = \pi_1/(\pi_1 + \pi_2): 0.5, and 0.9 with the unequal weights. At the midpoint only the prior weights decide.
Q7. Two components have the same covariance matrix. What shape is the boundary between the regions where each is most probable? And if one is much wider than the other?
Which terms cancel when you compare the two log-densities?
Same covariance: a straight line (plane), shifted towards the less frequent component when the weights differ. Different widths: a curved boundary; the narrow component’s region is a closed island, and the wide component wins far away on all sides.
Q8. Why can one Gaussian be fitted in closed form (sample mean and covariance), while a mixture cannot?
Look at the log of the density of one point.
For one Gaussian, \log p(\mathbf x_i) is a quadratic in \mathbf x_i - \boldsymbol\mu, and setting the gradient of the sum to zero gives the mean and covariance directly. For a mixture, \log p(\mathbf x_i) = \log\sum_k\pi_k\mathcal N_k(\mathbf x_i): the log of a sum couples all components, and the equations have no closed-form solution. If the labels were known it would split into separate one-Gaussian fits.
Q9. (math) Show that \mathbf x = \boldsymbol\mu + L\mathbf z, with \mathbf z standard normal and LL^\top = \Sigma, has mean \boldsymbol\mu and covariance \Sigma.
E[\mathbf z] = \mathbf 0 and E[\mathbf z\mathbf z^\top] = I.
E[\mathbf x] = \boldsymbol\mu + LE[\mathbf z] = \boldsymbol\mu. E[(\mathbf x - \boldsymbol\mu)(\mathbf x - \boldsymbol\mu)^\top] = LE[\mathbf z\mathbf z^\top]L^\top = LL^\top = \Sigma. (A linear transformation of a Gaussian vector is Gaussian, so \mathbf x \sim \mathcal N(\boldsymbol\mu, \Sigma).)