Code covered by the BSD License  

Highlights from
gaussian_mixture_model.m

4.25

4.2 | 4 ratings Rate this file 44 Downloads (last 30 days) File Size: 20.82 KB File ID: #24867
image thumbnail

gaussian_mixture_model.m

by Matthew Roughan

 

29 Jul 2009 (Updated 28 Oct 2009)

Estimate the parameters of a 1D Gaussian Mixture Model using the EM algorithm.

| Watch this File

File Information
Description

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.

MATLAB release MATLAB 7.4 (R2007a)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (5)
28 Oct 2009 vanie

thanks for you work, its cool and helpfull,may i ask you something, what shoul i do if my data is 3D??

05 Oct 2010 Avi

EXCELLENT !!!

31 Oct 2010 Scott

Great M-file - thanks so much for this contribution - it works well for my application.

25 Oct 2011 Kent Conover

This function does not fit the parameters by maximizing EM, the log sum likelihood. Instead, the search is terminated when the parameter estimates are stable. As a result the fits can be poor.

23 Jan 2012 Jonathan Schachter

There's a "path" variable in gaussian)mixture_model.m that's hardwired to one of your local directories. Commenting it out made the script run.

Please login to add a comment or rating.
Updates
28 Oct 2009

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

Tag Activity for this File
Tag Applied By Date/Time
statistics Matthew Roughan 29 Jul 2009 09:57:09
estimation Matthew Roughan 29 Jul 2009 09:57:10
gaussian Matthew Roughan 29 Jul 2009 09:57:10
mixture model Matthew Roughan 29 Jul 2009 09:57:10
expectation maximization Matthew Roughan 29 Jul 2009 09:57:10
clustering Matthew Roughan 29 Jul 2009 09:57:10
data modelling Matthew Roughan 29 Jul 2009 09:57:10
classification Matthew Roughan 29 Jul 2009 09:57:10
em Matthew Roughan 29 Jul 2009 09:57:10
em Slava 15 Apr 2010 16:38:25
estimation suganya eswaran 28 Sep 2011 05:18:19

Contact us at files@mathworks.com