L08 GMM
L08 GMM
Spring 2025
Recap: Kernel Density Estimator
0.75
True density
0.25
1 2
0.75
Density Estimation
0.25
2
Gaussian Mixture Model (GMM)
• Assume we have a small data set à not
possible to estimate class conditionals
using kernel density estimator
3
Gaussian Mixture Model (GMM)
• The parameters, i.e., the mean vectors &
covariance matrices, are determined so
that this sum approximates as good as
possible the given class conditional density
$ #
% ((%)! )" +#$ ((%)! )
𝑒 & !
𝑃! 𝑋 = % 𝑤! , #
!"# 2𝜋 & 𝑑𝑒𝑡 & (Σ! )
$
= % 𝑤! 𝑁(𝑋, 𝜇! , Σ! )
!"#
𝒘𝒋 ≡ represents the probability of each mixture component
𝑵(𝑿, 𝝁𝒋 , 𝜮𝒋 ) ≡ multi-variate Gaussian density with mean 𝝁𝒋 and covariance 𝜮𝒋 4
Gaussian Mixture Model (GMM)
-
𝑃! 𝑋 = % 𝑤* 𝑁(𝑋, 𝜇* , Σ* )
*+,
Condition:
-
% 𝑤* = 1
*+,
Because we need:
/ - /
. 𝑃! 𝑋 = % 𝑤* . 𝑁(𝑋, 𝜇* , Σ* ) = 1
./ *+, ./
=1
5
1-D Example𝑲
, 𝒘𝒋 𝑵(𝑿, 𝝁𝒋 , 𝝈𝒋 ) à approx. 𝑷(𝑿| 𝑪𝒊 )
𝒋*𝟏
𝑷(𝑿| 𝑪𝒊 )
6
Expectation–Maximization (EM)
• Apply EM algorithm, which is an iterative
algorithm, to estimate the parameters of
the GMM components
7
Expectation–Maximization (EM)
1. Take initial guesses for the parameters: 𝑤, 𝜇! , Σ! , 𝜇" and Σ"
2. Expectation step: compute the responsibilities:
𝑤𝑁
+ 𝑋(𝑚), 𝜇(! , Σ1!
𝛾(# =
+ 𝑁 𝑋(𝑚), 𝜇(! , Σ1! + 1 − 𝑤
𝑤 + 𝑁 𝑋(𝑚), 𝜇(" , Σ1 "
% %
∑$ %! ' # *%
!"# & +# ' # *%
+# ∑$
!"# !*%
&! ' # *%
+& ' # *%
+&
Σ1! = ∑$ %!
, Σ1 " = ∑$
!"# & !"#(!*%
&! )
∑-#,! 𝛾 (#
𝑤
+=
𝑀
8
Expectation–Maximization (EM)
𝛾7 = 𝑃 𝑋 𝑚 ∈ component 1
𝑃 comp. 1 𝑃 𝑋 𝑚 |comp. 1
= apply Bayes rule
𝑃 𝑋 𝑚
𝑃 comp. 1 𝑃 𝑋 𝑚 |comp. 1
=
𝑃 comp. 1 𝑃 𝑋 𝑚 |comp. 1 + 𝑃 comp. 2 𝑃 𝑋 𝑚 |comp. 2
8 9 :(7),;! ,<!
≡
8 9 :(7),;! ,<! = >?8 9 :(7),;" ,<"
9
Issues with GMM
• Initialization:
– EM is an iterative algorithm which is very
sensitive to initial conditions:
– Start from trash → end up with trash
– Usually, we use the K-Means to get a good
initialization
10
Acknowledgment
• These slides have been created relying on
lecture notes of Amir Atiya and Mohand
Saïd Allili
11