For GDA with binary , and , how do you derive the maximum likelihood estimates of , , and from labelled points?
Supervised learning, Gaussian discriminant analysis
Level L3 Intermediate. Length Long. Nature Mat Mathematical.
What's being asked
Whether you can write the joint log-likelihood and differentiate with respect to each parameter, including the covariance.
Key idea
The joint likelihood factorises, so each parameter is a class count or class average: , class mean, .
Steps
- Because GDA is generative, we maximise the joint log-likelihood . The two parts have separate parameters.
- For : . Setting the derivative to zero: , so , the fraction of class 1.
- For : . The gradient with respect to is . Setting it to zero gives .
- For : . Write and use and .
- The derivative is , so .
- This is the pooled within-class covariance: the weighted average of the two class covariances, , with the class means (not the overall mean) subtracted.
Common mistakes
- Subtracting the overall mean in instead of each class mean. That would also include between-class spread.
- Using or . The MLE uses ; the unbiased version uses here, because two means were estimated.
- Differentiating with respect to directly and getting the sign wrong. Using is simpler.
How long your answer should be
One page; 8–10 minutes.
Last checked on 4 December 2026.
Read this
Previous in Supervised learning: Multiple discriminant analysis (multi-class Fisher LDA) solves . For classes in dimensions with training points, how many useful discriminant directions are there, and what goes wrong with ? How can you fix it?
Next in Supervised learning: Show that a naive Bayes classifier with two classes and binary features is a linear classifier in , and give its weights. For , , , , , find the log-odds for and . What goes wrong if feature 2 is copied twice?