gaussian_mixture_mo​del.m

Estimate the parameters of a 1D Gaussian Mixture Model using the EM algorithm.
6.9K Downloads
Updated 28 Oct 2009

View License

A Gaussian mixture model means that each data point is drawn (randomly) from one of C classes of data, with probability p_i of being drawn from class i, and each class is distributed as a Gaussian with mean standard deviation mu_i and sigma_i. Given a set of data drawn from such a distribution, we seek to estimate these unknown parameters.

The algorithm used here for estimation is EM (Expectation Maximization). Simply put, if we knew the class of each of the N input data points, we could separate them, and use Maximum Likelihood to estimate the parameters of each class. This is the M step. The E step makes (soft) choises of (unknown) classes for each of the data points based on the previous round of parameter estimates for each class.

Implicitly the data is classfied (or clustered) into the different classes, whose parameters are estimated.

The current code only works for 1D data, and is primarily of use in illustrating the idea about mixture models and EM, but it would be pretty easy to generalize to higher dimensions.

Cite As

Matthew Roughan (2024). gaussian_mixture_model.m (https://www.mathworks.com/matlabcentral/fileexchange/24867-gaussian_mixture_model-m), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2007a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Statistics and Machine Learning Toolbox in Help Center and MATLAB Answers

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.1.0.0

Minor fix to improve the initial variance estimates so it can deal with widely spread data.

1.0.0.0