ML_compare_mixture_algs
Goal: Compare expectation maximization (EM) and variational inference for mixture of Gaussians.
View animated example
Using the settings: n_components = 5, weight_concentration_prior = 1e-3
, creates this animation comparing EM and variational inference for mixture of Gaussians:
Check out the whole Jupyter Notebook here: https://abegehr.github.io/ML_compare_mixture_algs/
… and then run your own experiments!
Run your own experiments:
- Clone or download this repository.
- Navigate to folder:
cd (path to)/ML_compare_mixture_algs/
- Start jupyter notebook:
jupyter notebook
- Webbrowser with jupyter notebooks running opens.
- Open
main.ipynb
in jupyter notebooks. - Run all cells.
- Animations comparing expectation maximization (EM) and variational inference applied on a mixture of Gaussians are shown. Great!
- Change parameters to test the two methods. Use the settings in the second to last cell to change parameter settings under
# PARAMETER SETTINGS HERE
. For example, try these settings:n_components = 4, weight_concentration_prior = 1e-3
n_components = 5, weight_concentration_prior = 1e-3
n_components = 8, weight_concentration_prior = 1e-3
n_components = 5, weight_concentration_prior = 1e+3
- It is possible to experiment with many more parameters. Find the
sklearn
documentation for more information on possible parameters here:- Expectation Maximization (EM) for mixture of Gaussians: sklearn.mixture.GaussianMixture
- Variational Inference for mixture of Gaussians: sklearn.mixture.BayesianGaussianMixture
- Happy experimenting!
This animation was created as part of the seminar Mathematics of machine learning SS2018 (PD Dr. Pavel Gurevich). Group #6.
If you have any comments or questions, please contact: a.begehr@fu-berlin.de