Code covered by the BSD License  

Highlights from
EM for HMM Multivariate Gaussian processes


5.0 | 3 ratings Rate this file 53 Downloads (last 30 days) File Size: 21.5 KB File ID: #20712
image thumbnail

EM for HMM Multivariate Gaussian processes



15 Jul 2008 (Updated )

A fast implementation of the EM Algorithm for HMM Multivariate Gaussian Mixture

| Watch this File

File Information

em_ghmm : Expectation-Maximization algorithm for a HMM with Multivariate Gaussian measurement

 [logl , PI , A , M , S] = em_ghmm(Z , PI0 , A0 , M0 , S0 , [options]);


 Z Measurements (m x K x n1 x ... x nl)

 PI0 Initial probabilities (d x 1) : Pr(x_1 = i) , i=1,...,d. PI0 can be (d x 1 x v1 x ... x vr)

 A0 Initial state transition probabilities matrix Pr(x_{k} = i| x_{k - 1} = j) such
               sum_{x_k}(A0) = 1 => sum(A , 1) = 1. A0 can be (d x d x v1 x ... x vr).

 M0 Initial mean vector. M0 can be (m x 1 x d x v1 x ... x vr)

 S0 Initial covariance matrix. S0 can be (m x m x d x v1 x ... x vr)

 options nb_ite Number of iteration (default [30])
               update_PI Update PI (0/1 = no/[yes])
               update_A Update PI (0/1 = no/[yes])
               update_M Update M (0/1 = no/[yes])
               update_S Update S (0/1 = no/[yes])


 logl Final loglikelihood (n1 x ... x nl x v1 x ... x vr)

 PI Estimated initial probabilities (d x 1 x n1 x ... x nl v1 x ... x vr)

 A Estimated state transition probabilities matrix (d x d x n1 x ... x nl v1 x ... x vr)

 M Estimated mean vector (m x 1 x d x n1 x ... x nl v1 x ... x vr)

 S Estimated covariance vector (m x m x d x n1 x ... x nl v1 x ... x vr)

Please run mexme_em_ghmm to compile mex files on your platform.

Run test_em_ghmm for demo

MATLAB release MATLAB 7.5 (R2007b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (12)
13 Oct 2011 Sebastien PARIS


No you can't model more than one gaussian .... sorry

29 Aug 2011 Josiah

Can this code be used for HMM based speech recognition (training and recognition) or does it need tweaking via Rabiners paper? I assume for speech you would need more than one gaussian per state?

21 Nov 2010 mepe mepe

Ok, thank you for the quick response!

21 Nov 2010 Sebastien PARIS

Unfortunatly, you can't do this job with this code ....

21 Nov 2010 mepe mepe

How can I use your code for multvariate gaussian mixtures? I mean that every state of the HMM can have multiple gaussians. Can you please post an example?

27 Sep 2010 Sebastien PARIS

Have a look to :

Lawrence R. Rabiner (February 1989). "A tutorial on Hidden Markov Models and selected applications in speech recognition". Proceedings of the IEEE 77 (2): 257–286.


21 Sep 2010 Dylan

Would you mind putting on the reference paper you used? Thanks.

23 Jul 2010 Dylan  
28 Dec 2008 wang linghua  
01 Dec 2008 Sebastien PARIS

Please read instructions how to compile mex-files in the top of each *.c files. eg. "mex -setup" and 'mex foo.c"

01 Dec 2008 wang linghua

??? Invalid MEX-file 'D:\mtlwork\em_ghmm\sample_ghmm.dll': 找不到指定的程序。
Error in ==> test_em_ghmm at 19
[Ztrain , Xtrain]= sample_ghmm(Ntrain , PI , A , M , S , L);

27 Jul 2008 liudaohai liudaohai

mex -output em_ghmm.dll em_ghmm.c

mex -f mexopts_intel10amd.bat -output em_ghmm.dll em_ghmm.c

??? Error using ==> mex
Unable to complete successfully

17 Dec 2008

-add mexme_em_ghmm and compatible with LCC compiler

19 Jan 2009

Fixed bug in the likelihood constant computation

04 Feb 2009

Correct a bug in likelihood_mvgm.c when d=1

19 Oct 2010

-Fixed bug with Linux64 & GCC

12 Oct 2011

-Minor update for Linux systems

19 Jan 2012

-Fixed a bug introduced in the last update

27 Nov 2012

-Fix 2 bugs (Thanks to Jonathan for reporting)

Contact us