Professional Documents
Culture Documents
Gaussian Mixture Model and Hidden Markov Model
Gaussian Mixture Model and Hidden Markov Model
and
Majority of the slides are taken from S.Umeshs tutorial on ASR (WiSSAP 2006).
1 of 88
Pattern Recognition
Training
Input
Signal Processing
Testing
2 of 88
Basic Probability
Joint and Conditional probability p(A, B) = p(A|B) p(B) = p(B|A) p(A)
Bayes rule p(B|A) p(A) p(A|B) = p(B) If Ais are mutually exclusive events, p(B) =
i
p(A|B) =
Normal Distribution
Many phenomenon are described by Gaussian pdf 1 1 p(x|) = exp 2 (x )2 2 2 2 pdf is parameterised by = [, 2] where mean = and variance= 2. A convenient pdf : second order statistics is sucient. Example: Heights of Pygmies Gaussian pdf with = 4f t & std-dev() = 1f t OR: Heights of bushmen Gaussian pdf with = 6f t & std-dev() = 1f t Question:If we arbitrarily pick a person from a population what is the probability of the height being a particular value?
WiSSAP 2009: Tutorial on GMM and HMM, Samudravijaya K 4 of 88
(1)
If I pick arbitrarily a Pygmy, say x, then 1 1 exp (41 4)2 Pr(Height of x=41) = 2.1 2.1 Note: Here mean and variances are xed, only the observations, x, change. Also see: P r(x = 41) P r(x = 5)
WiSSAP 2009: Tutorial on GMM and HMM, Samudravijaya K
(2)
AND
Conversely: Given a persons height is 41 Person is more likely to be a pygmy than bushman. If we observe heights of many persons say 36, 41, 38, 45, 47, 4, 65 and all are from same population (i.e. either pygmy or bushmen.) then more certain we are that the population is pygmy. More the observations better will be our decision
WiSSAP 2009: Tutorial on GMM and HMM, Samudravijaya K 6 of 88
Likelihood Function
x[0], x[1], . . . , x[N 1] set of independent observations from pdf parameterised by . Previous Example: x[0], x[1], . . . , x[N 1] are heights observed and is the mean of density which is unknown ( 2 assumed known).
N
L(X; ) = p(x0 . . . xN 1 ; ) =
i=0
i=0
(xi )2
(3)
L(X; ) is a function of and is called Likelihood Function Given: x0 . . . xN 1, what can we say about value of , i.e. best estimate of .
WiSSAP 2009: Tutorial on GMM and HMM, Samudravijaya K 7 of 88
Maximum of L(x[0]; = 3), L(x[0]; 46) and L(x[0]; = 6) choose = 46. If is just a parameter, we will choose arg max L(x[0]; ).
p(xi; )
i=0
xi
Bayesian Estimation
MLE is assumed unknown but deterministic Bayesian Approach: is assumed random with pdf p() Prior Knowledge. p(|x) =
Aposterior
Prior
p(x) =
m=1
wi = 1
Characteristics of GMM: Just like ANNs are universal approximators of functions, GMMs are universal approximators of densities (provided sucient no. of mixtures are used); true for diagonal GMMs as well.
WiSSAP 2009: Tutorial on GMM and HMM, Samudravijaya K 11 of 88
Assume that there are M components. Each component generates data from a Gaussian with mean m and covariance matrix m.
WiSSAP 2009: Tutorial on GMM and HMM, Samudravijaya K 12 of 88
GMM
Consider the following probability density function shown in solid blue
13 of 88
Actually pdf is a mixture of 3 Gaussians, i.e. p(x) = c1N (x; 1, 1) + c2N (x; 2, 2) + c3N (x; 3, 3 ) and pdf parameters: c1, c2, c3, 1, 2, 3, 1, 2, 3 ci = 1 (4)
14 of 88
Therefore : p(x[i]; ) = c1N (x; 1, 1) + c2N (x; 2, 2) + c3N (x; 3, 3) but we do not which urn x[i] comes from! Can we estimate component = [c1 c2 c3 1 2 3 1 2 3]T from the observations?
N
p(xi; )
(5)
15 of 88
belong to
p1(x; 1, 1 ) p2(x; 2, 2)
belongs to
In practice we do not know which observation come from which pdf. How do we solve for arg max p(X; ) ?
y[i] = missing dataunobserved data information about component z = (x; y) is complete data observations and which density they come from p(z; ) = p(x, y; ) M LE = arg max p(z; ) Question: But how do we nd which observation belongs to which density ?
WiSSAP 2009: Tutorial on GMM and HMM, Samudravijaya K 17 of 88
Given observation x[0] and g , what is the probability of x[0] coming from rst distribution?
p (y[0] = 1|x[0]; g )
= = =
p(y[0]=1,x[0]; g ) p(x[0]; g ) p(x[0]|y[0]=1;1 ,1 ) p(y[0]=1) 3 g j=1 p(x[0]|y[0]=j; ) p(y[0]=j) p(x[0]|y[0]=1,1 ,1 ) c1 g g g g g g p(x[0]|y[0]=1;1 ,1 ) c1 +p(x[0]|y[0]=2;2 ,2 ) c2 +...
g g g g g
All parameters are known we can calculate p(y[0] = 1|x[0]; g ) (Similarly calculate p(y[0] = 2|x[0]; g ), p(y[0] = 3|x[0]; g ) Which density? y[0] = arg max p(y[0] = i|x[0]; g ) Hard allocation
i
WiSSAP 2009: Tutorial on GMM and HMM, Samudravijaya K 18 of 88
2 7
c2 =
2 i, i
4 7
c3 =
1 7
19 of 88
Example: Prob. of each sample belonging to component 1 p(y[0] = 1|x[0]; g ), p(y[1] = 1|x[1]; g ) p(y[2] = 1|x[2]; g ), Average probability that a sample belongs to Comp.#1 is cnew 1 = = 1 N
N
p(y[i] = 1|x[i]; g )
i=1
20 of 88
1 | x[i]; g ) | x[i]; g )
2 (1 )new
= 1 | x[i]; g ) x[i]; g )
21 of 88
3.
bnew cj
4.
new j =
PN
j | x[i]; g ) | x[i]; g )
5.
2 (j )new
PN
i=1 (xi
PN
i=1
22 of 88
23 of 88
24 of 88
Live demonstration: http://www.neurosci.aist.go.jp/ akaho/MixtureEM.html Practical Issues E.M. can get stuck in local minima. EM is very sensitive to initial conditions; a good initial guess helps; k-means algorithm is used prior to application of EM algorithm
WiSSAP 2009: Tutorial on GMM and HMM, Samudravijaya K 25 of 88
Size of a GMM
Bayesian Information Criterion (BIC) value of a GMM can be dened as follows: d logN BIC(G | X) = logp(X | G) 2 where G represent the GMM with the ML parameter conguration d represents the number of parameters in G N is the size of the dataset the rst term is the log-likelihood term; the second term is the model complexity penalty term. BIC selects the best GMM corresponding to the largest BIC value by trading o these two terms.
WiSSAP 2009: Tutorial on GMM and HMM, Samudravijaya K 26 of 88
source: Boosting GMM and Its Two Applications, F.Wang, C.Zhang and N.Lu in N.C.Oza et al. (Eds.) LNCS 3541, pp. 12-21, 2005
The BIC criterion can discover the true GMM size eectively as shown in the gure.
27 of 88
Sometimes, it is dicult to get sucient number of examples for robust estimation of parameters. However, one may have access to large number of similar examples which can be utilized. Adapt the target distribution from such a distribution. For example, adapt a speaker independent model to a new speaker using small amount of adaptation data.
28 of 88
MAP Adaptation
ML Estimation M LE = arg max p(X|)
p() is the a priori distribution of parameters . A conjugate prior is chosen such that the corresponding posterior belongs to the same functional family as the prior.
WiSSAP 2009: Tutorial on GMM and HMM, Samudravijaya K 29 of 88
30 of 88
Simple Implementation
Train a prior model p with a large amount of available data (say, from multiple speakers). Adapt the parameters to a new speaker using some adaptation data (X). Let = [0, 1] be a parameter that describes the faith on the prior model. Adapted weight of j th mixture
wj =
p wj
+ (1 )
p(j|xi)
i
wj = 1.
31 of 88
means
j =
p j
+ (1 )
i p(j|xi)
xi i p(j|xi)
j =
p j
pp j j
+ (1 )
i p(j|xi)
xi xi j j i p(j|xi)
32 of 88
HMM
Primary role of speech signal is to carry a message; sequence of sounds (phonemes) encode a sequence of words. The acoustic manifestation of a phoneme is mostly determined by: Conguration of articulators (jaw, tongue, lip) physiology and emotional state of speaker Phonetic context HMM models sequential patterns; speech is a sequential pattern Most text dependent speaker recognition systems use HMMs Text verication involves verication/recognition of phonemes
33 of 88
Phoneme recognition
Consider two phonemes classes /aa/ and /iy/. Problem: Determine to which class a given sound belongs. Processing of speech signal results in a sequence of feature (observation) vectors: o1, . . . , oT (say MFCC vectors) We say the speech is /aa/ if: p(aa|O) > p(iy|O) Using Bayes Rule AcousticM odel P riorP rob
Training Phase: Collect many examples of /aa/ being said Compute corresponding observations o1, . . . , oTaa Use the Maximum Likelihood Principle aa = arg max p(O; aa)
aa
Recall: if the pdf is modelled as a Gaussian Mixture Model . then we use EM Algorithm
WiSSAP 2009: Tutorial on GMM and HMM, Samudravijaya K 35 of 88
Modelling of Phoneme
Our Articulators are moving from a conguration To enunciate /aa/ in a word for previous phoneme to /aa/ and then proceeding to move to conguration of next phoneme. Can think of 3 distinct time periods: Transition from previous phoneme Steady state Transition to next phoneme Features for 3 time-interval are quite dierent Use dierent density functions to model the three time intervals model as paa1 (; aa1) paa2 (; aa2) paa3 (; aa3) Also need to model the time durations of these time-intervals transition probs.
WiSSAP 2009: Tutorial on GMM and HMM, Samudravijaya K 36 of 88
a11
1
p(f)
a12
2
p(f) p(f)
f(Hz)
f(Hz)
f(Hz)
37 of 88
Observation, ot, is generated by which state density? Only observations are seen, the state-sequence is hidden Recall: In GMM, the mixture component is hidden
WiSSAP 2009: Tutorial on GMM and HMM, Samudravijaya K 38 of 88
Probability of Observation
Recall: To classify, we evaluate P r(O|) where are parameters of models In /aa/ Vs /iy/ calculation: P r(O|aa) Vs P r(O|iy ) Example: 2-state HMM model and 3 observations o1 o2 o3
Model parameters are assumed known: Transition Prob. a11, a12, a21, and a22 model time durations State density b1(ot) and b2(ot). 2 bj (ot) are usually modelled as single Gaussian with parameter j , j or by GMMs
WiSSAP 2009: Tutorial on GMM and HMM, Samudravijaya K 39 of 88
T = 3 observations and N = 2 nodes 8 paths thru 2 nodes for 3 observations Example: Path P1 through states 1, 1, 1. P r{O|P1, } = b1(o1) b1(o2) b1(o3) Prob. of Path P1 = P r{P1|} = a01 a11 a11 P r{O, P1|} = P r{O|P1, } P r{P1|} = a01b1(o1).a11b1(o2).a11b1(o3)
WiSSAP 2009: Tutorial on GMM and HMM, Samudravijaya K 40 of 88
Probability of Observation
Path
o1
1 1 1 1 2 1 1 1
o2
1 1 2 2 1 1 1 1
o3
1 2 1 2 1 2 1 2
p(O, Pi |) a01 b1 (o1).a11 b1 (o2).a11b1 (o3 ) a01 b1 (o1).a11 b1 (o2).a12 b2 (o3 ) a01 b1 (o1).a12 b2 (o2).a21 b1 (o3 ) a01 b1 (o1).a12 b2 (o2).a22 b2 (o3 ) a02 b2 (o1).a21 b1 (o2).a11b1 (o3 ) a02 b2 (o1).a21 b1 (o2).a12 b2 (o3 ) a02 b2 (o1).a22 b1 (o2).a21 b1 (o3 ) a02 b2 (o1).a22 b1 (o2).a22 b2 (o3 )
P1 P2 P3 P4 P5 P6 P7 P8
p(O|) =
Pi
P {O, Pi|} =
Pi
P {O|Pi, } P {Pi, }
Forward Algorithm Avoid Repeat Calculations: Two Multiplications a01b1(o1)a11b1(o2).a11b1(o3) + a02b2(o1).a21b1(o2).a11b1(o3) =[a01.b1(o1)a11b1(o2) + a02b2(o1)a21b1(o2)]a11b1(o3) One Multiplication
WiSSAP 2009: Tutorial on GMM and HMM, Samudravijaya K 41 of 88
Let :1(t = 1) = a01b1(o1) Let :2(t = 1) = a02b2(o2) Recursion : 1(t = 2) = [a01b1(o1).a11 + a02b2(o1).a21].b1(o2) = [1(t = 1).a11 + 2(t = 1).a21].b1(o2)
42 of 88
p(0|) =
j=1 N
=
j=1
Backward Algorithm
analogous to Forward, but coming from the last time instant T Example: a01b1(o1).a11b1(o2).a11b1(o3) + a01b1(o1).a11b1(o2)a12b2(o3) + . . . = [a01.b1(o1).a11b1(o2)].(a11b1(o3) + a12b2(o3))
1(t = 2) = p{o3|st=2 = 1, } = p{o3, st=3 = 1|st=2 = 1; } + p{o3, st=3 = 2|st=2 = 1, } p{o3|st=3 = 1, st=2 = 1, }.p{st=3 = 1|st=2 = 1, } + = p{o3|st=3 = 2, st=2 = 1, }.p{st=3 = 2|st=2 = 1, }
= b1(o3).a11 + b2(o3).a12
44 of 88
Given that we are at node j at time t j (t) Sum of probabilities of all paths such that partial sequence ot+1, . . . , oT are observed
i(t) =
j=1
[aij bj (ot+1)]
Going to each node from i
th
j (t + 1)
Prob. of observation ot+2 . . . oT given now we are in j th node at t + 1
node
= p{ot+1, . . . , ot|st = i, }
45 of 88
p(O|) = N (T ) = 1(T ) =
j=1
j (t)j (t)
46 of 88
In practice since we do not know which state generated the observation So we will do probabilistic assignment.
47 of 88
j b2
PT
Baum-Welch Algorithm
Here: We do not know which observation ot comes from which state si Again like GMM we will assume initial guess parameter g Then prob. of being in state=i at time=t and state=j at time=t+1 is
p{O|g } = N (T ) =
i i(T )
49 of 88
Baum-Welch Algorithm
Then prob. of being in state=i at time=t and state=j at time=t+1 is p{qt = i, qt+1 = j, O|g } t(i, j) = p{qt = i, qt+1 = j|O, g } = p{O|g } where p{O|g } = N (T ) =
i i (T )
50 of 88
t(i, j) prob. of being in state=i at time=t and state=j at time=t+1 If we average t(i, j) over all time-instants, we get the number of times the system was in ith state and made a transition to j th state. So, a revised estimation of transition probability is
anew ij
=
T t=1 (
T 1 t=1 t (i, j) N
t(i, j) )
j=1
51 of 88
i =
i)T
These are weighted averages weighted by Prob. of being in state j at t Given observation HMM model parameters estimated iteratively p(O|) evaluated eciently by Forward/Backward algorithm
WiSSAP 2009: Tutorial on GMM and HMM, Samudravijaya K 52 of 88
Viterbi Algorithm
Given the observation sequence, the goal is to nd corresponding state-sequence that generated it there are many possible combination (N T ) of state sequence many paths. One possible criterion : Choose the state sequence corresponding to path that with maximum probability
53 of 88
NT
i=1
p{O, Pi|}
Viterbi is just special case of Forward algo. instead of sum of prob. of all paths choose path with max prob.
At each node
54 of 88
Viterbi Algorithm
55 of 88
Decoding
Search over all possible W astronomically large! Viterbi Search nd most likely path through a HMM Sequence of phones (states) which is most probable Mostly: most probable sequence of phones correspond to most probable sequence of words
56 of 88
HMM parameters estimated using large databases 100 hours Parameters estimated using Maximum Likelihood Criterion
57 of 88
Recognition
58 of 88
Speaker Recognition
Spectra (formants) of a given sound are dierent for dierent speakers.
Derive speaker dependent model of a new speaker by MAP adaptation of SpeakerIndependent (SI) model using small amount of adaptation data; use for speaker recognition.
59 of 88
References
Pattern Classication, R.O.Duda, P.E.Hart and D.G.Stork, John Wiley, 2001. Introduction to Statistical Pattern Recognition, K.Fukunaga, Academic Press, 1990. The EM Algorithm and Extensions, Georey J. McLachlan and Thriyambakam Krishnan, Wiley-Interscience; 2nd edition, 2008. ISBN-10: 0471201707 The EM Algorithm and Extensions, Georey J. McLachlan and Thriyambakam Krishnan, Wiley-Interscience; 2nd edition, 2008. ISBN-10: 0471201707 Fundamentals of Speech Recognition, Lawrence Rabiner & Biing-Hwang Juang, Englewood Clis NJ: PTR Prentice Hall (Signal Processing Series), c1993, ISBN 0-13-015157-2
WiSSAP 2009: Tutorial on GMM and HMM, Samudravijaya K 60 of 88
Hidden Markov models for speech recognition, X.D. Huang, Y. Ariki, M.A. Jack. Edinburgh: Edinburgh University Press, c1990. Statistical methods for speech recognition, F.Jelinek, The MIT Press, Cambridge, MA., 1998. Maximum Likelihood from incomplete data via the em algorithm, J. Royal Statistical Soc. 39(1), pp. 1-38, 1977. Maximum a Posteriori Estimation for Multivariate Guassian Mixture Observation of Markov Chains, J.-L.Gauvain and C.-H.Lee, IEEE Trans. SAP, 2(2), pp. 291298, 1994. A Gentle Tutorial of the EM Algorithm and its Application to Parameter Estimation for Gaussian Mixture and Hidden Markov Models, J.A.Bilmes, ISCI, TR-97-021. Boosting GMM and Its Two Applications, F.Wang, C.Zhang and N.Lu in N.C.Oza et al. (Eds.) LNCS 3541, pp. 12-21, 2005.
WiSSAP 2009: Tutorial on GMM and HMM, Samudravijaya K 61 of 88