Get One More Story in Your Member Preview When You Sign Up. It's Free
Get One More Story in Your Member Preview When You Sign Up. It's Free
1 of 12 11/7/19, 2:24 PM
Gaussian Mixture Models Explained - Towards ... https://towardsdatascience.com/gaussian-mixtu...
2 of 12 11/7/19, 2:24 PM
Gaussian Mixture Models Explained - Towards ... https://towardsdatascience.com/gaussian-mixtu...
. . .
3 of 12 11/7/19, 2:24 PM
Gaussian Mixture Models Explained - Towards ... https://towardsdatascience.com/gaussian-mixtu...
De�initions
A Gaussian Mixture is a function that is comprised of several
Gaussians, each identified by k ∈ {1,…, K}, where K is the
number of clusters of our dataset. Each Gaussian k in the
mixture is comprised of the following parameters:
. . .
5 of 12 11/7/19, 2:24 PM
Gaussian Mixture Models Explained - Towards ... https://towardsdatascience.com/gaussian-mixtu...
Initial derivations
We are now going to introduce some additional notation.
Just a word of warning. Math is coming on! Don’t worry. I’ll
try to keep the notation as clean as possible for better
understanding of the derivations. First, let’s suppose we
want to know what is the probability that a data point xn
comes from Gaussian k. We can express this as:
6 of 12 11/7/19, 2:24 PM
Gaussian Mixture Models Explained - Towards ... https://towardsdatascience.com/gaussian-mixtu...
. . .
7 of 12 11/7/19, 2:24 PM
Gaussian Mixture Models Explained - Towards ... https://towardsdatascience.com/gaussian-mixtu...
8 of 12 11/7/19, 2:24 PM
Gaussian Mixture Models Explained - Towards ... https://towardsdatascience.com/gaussian-mixtu...
. . .
9 of 12 11/7/19, 2:24 PM
Gaussian Mixture Models Explained - Towards ... https://towardsdatascience.com/gaussian-mixtu...
Implementation in Python
Just as a side note, the full implementation is available as a
Jupyter notebook at https://bit.ly/2MpiZp4
I have used the Iris dataset for this exercise, mainly for
simplicity and fast training. From our previous derivations,
we stated that the EM algorithm follows an iterative
approach to find the parameters of a Gaussian Mixture
Model. Our first step was to initialise our parameters. In this
case, we can use the values of K-means to suit this purpose.
The Python code for this would look like:
10 of 12 11/7/19, 2:24 PM
Gaussian Mixture Models Explained - Towards ... https://towardsdatascience.com/gaussian-mixtu...
. . .
Final remarks
Gaussian Mixture Models are a very powerful tool and are
widely used in diverse tasks that involve data clustering. I
hope you found this post useful! Feel free to approach with
questions or comments. I would also highly encourage you to
try the derivations yourself as well as look further into the
code. I look forward to creating more material like this soon.
Enjoy!
. . .
Get one
Towards Datamore
Science story in your member
11 of 12 11/7/19, 2:24 PM
Gaussian Mixture Models Explained - Towards ... https://towardsdatascience.com/gaussian-mixtu...
12 of 12 11/7/19, 2:24 PM