SlideShare a Scribd company logo
An Introduction to HMM


        Browny
       2010.07.21
MM vs. HMM

                States


States




             Observations
Markov Model
• Given 3 weather states:
  – {S1, S2, S3} = {rain, cloudy, sunny}
                    Rain   Cloudy   Sunny
          Rain      0.4    0.3      0.3
          Cloudy    0.2    0.6      0.2
          Sunny     0.1    0.1      0.8


• What is the probabilities for next 7 days
  will be {sun, sun, rain, rain, sun, cloud,
  sun} ?
Hidden Markov Model
• The states
  – We don’t understand, Hidden!
  – But it can be indirectly observed


• Example
  – 北極or赤道(model), Hot/Cold(state), 1/2/3
    ice cream(observation)
Hidden Markov Model
• The observation is a probability function
  of state which is not observable directly


                           Hidden States
HMM Elements
• N, the number of states in the model
• M, the number of distinct observation
  symbols
• A, the state transition probability distribution
• B, the observation symbol probability
  distribution in states
• π, the initial state distribution     λ: model
Example
            P(…|C)           P(…|H)     P(…|Start)
 P(1|…)       0.7              0.1

 P(2|…)      0.2       B:      0.2
                   Observation
 P(3|…)      0.1               0.7

 P(C|…)      0.8               0.1           0.5

                        A:            π:
 P(H|…)      0.1               0.8            0.5
                    Transition        initial

P(STOP|…)    0.1               0.1            0
3 Problems
3 Problems
1. 觀察到的現象最符合哪一個模型
   P(觀察到的現象|模型)
2. 怎樣的狀態序列最符合觀察到的現
   象和已知的模型
   P(狀態序列|觀察到的現象, 模型)
3. 怎樣的模型最有可能產生觀察到的
   現象
   what 模型 maximize P(觀察到的現象|
   模型)
Solution 1
• 已知模型,一觀察序列之產生機率 P(O|λ)
          R1               R1         R1
     S1               S1         S1
          R2               R2         R2

     S2   R1          S2 R1      S2   R1
          R2             R2           R2

     S3   R1          S3 R1      S3   R1
          R2             R2           R2

          1                2          3    t

     觀察到 R1      R1        R2 的機率為多少?
Solution 1
• 考慮一特定的狀態序列
                Q = q1, q2 … qT

• 產生出一特定觀察序列之機率為

 P(O|Q, λ) = P(O1|q1, λ) * P(O2|q2, λ) * … * P(Ot|qt, λ)

           = bq1(O1) * bq2(O2) * … * bqT(OT)
Solution 1
• 此一特定序列發生之機率為

               P(Q|λ) = πq1 * aq1q2 * aq2q3 * … * aq(T-1)qT

• 已知模型,一觀察序列之產生機率 P(O|λ)

 P(O|λ) = ,q∑ q P(O|Q, λ) * P(Q| λ)
         q  ,...,
               1   2   T




 = q ,q∑ q πq1 * bq1(O1) * aq1q2 bq2(O2)* … * aq(T-1)qT * bqT(OT)
       ,...,
   1   2   T
Solution 1
                 狀態的數量)
• Complexity (N: 狀態的數量
  – 2T*NT ≈ (2T-1)NT muls + NT-1 adds (NT:狀態轉換
    組合數)
  – For N=5 states, T=100 observations, there are
    order 2*100*5100 ≈ 1072 computations!!
• Forward Algorithm
  – Forward variable αt(i) (給定時間 t 時狀態為 Si 的
    條件下,向前   向前局部觀察序列為O1, O2, O3…, Ot 的
             向前
    機率)
           at (i ) = P(O1 , O2 ,..., Ot , qt = Si | λ )
Solution 1
                          R1                R1                       R1
                    S1                 S1                      S1
                          R2                R2                       R2
                                                                              When O1 = R1
                    S2    R1           S2 R1                   S2    R1
                          R2              R2                         R2

                    S3    R1           S3 R1                   S3    R1
                          R2              R2                         R2

                         1                  2                       3                   t

α1 ( i ) = π i bi ( O1 ) 1 ≤ i ≤ N
                                     α 2 (1) = α1 (1) a11 + α1 ( 2 ) a21 + α1 ( 3) a31  b1 ( O2 )
                                                                                       
 α1 (1) = π 1b1 (O1 )
 α1 (2) = π 2b2 (O1 )                α 2 ( 2 ) = α1 (1) a12 + α1 ( 2 ) a22 + α1 ( 3) a32  b2 ( O2 )
                                                                                         
 α1 (3) = π 3b3 (O1 )
Forward Algorithm
• Initialization:
                  α1 (i ) = π i bi (O1 ) 1 ≤ i ≤ N
• Induction:
                  N                             1 ≤ t ≤ T −1
    αt +1 ( j ) = ∑αt ( i ) aij  bj ( Ot +1 )   1 ≤ j ≤ N
                   i=1          

• Termination:
                                            N
                          P(O | λ ) = ∑ αT (i )
                                           i =1
Backward Algorithm
• Forward Algorithm
        at (i ) = P(O1 , O2 ,..., Ot , qt = Si | λ )


• Backward Algorithm
  – 給定時間 t 時狀態為 Si 的條件下,向後    向後局
                              向後
    部觀察序列為 Ot+1, Ot+2, …, OT的機率

        βt (i ) = P(Ot +1 , Ot + 2 ,..., OT , qt = Si | λ )
Backward Algorithm
• Initialization
                      βT (i ) = 1 1 ≤ i ≤ N
• Induction
                N
                                                t = T −1, T − 2, ...,1
    βt (i ) = ∑ aij b j (Ot +1 ) β t +1 ( j )
               j =1                             1≤ i ≤ N
Backward Algorithm
             R1               R1             R1
    S1                   S1         S1
             R2               R2             R2
                                                  When OT = R1
    S2       R1          S2 R1      S2       R1
             R2             R2               R2

    S3       R1          S3 R1      S3       R1
             R2             R2               R2

         1                    2          3             t

                  N
β T −1 (1) = ∑ a1 j b j ( OT ) β T ( j )
                  j =1

= a11b1 ( OT ) + a12 b2 ( OT ) + a13b3 ( OT )
Solution 2
• 怎樣的狀態序列最能解釋觀察到的現
  象和已知的模型
  P(狀態序列|觀察到的現象, 模型)

• 無精確解,有很多種方式解此問題,
  對狀態序列的不同限制有不同的解法
  對狀態序列的不同限制
Solution 2
• 例: Choose the state qt which are individually
  most likely
  – γt(i) : the probability of being in state Si at
    time t, given the observation sequence O,
    and the model λ
                P (O | qt = Si , λ ) α t ( i ) βt ( i )    α t ( i ) βt ( i )
     γ t (i ) =                     =                   = N
                    P (O λ )           P (O λ )
                                                         ∑ α t ( i ) βt ( i )
                                                           i =1

     qt = argmax γ t ( i )  1 ≤ t ≤ T
                           
             1≤i ≤ N
Viterbi algorithm
• The most widely used criteria is to find
  the “single best state sequence”
     maxmize P ( Q | O, λ ) ≈ maxmize P ( Q, O | λ )


• A formal technique exists, based on
  dynamic programming methods, and is
  called the Viterbi algorithm
Viterbi algorithm
• To find the single best state sequence, Q =
  {q1, q2, …, qT}, for the given observation
  sequence O = {O1, O2, …, OT}

• δt(i): the best score (highest prob.) along a
  single path, at time t, which accounts for the
  first t observations and end in state Si
   δ t ( i ) = max P  q1 q2 ... qt = Si , O1 O2 ... Ot λ 
                                                         
            1 q , q ,..., q
                2   t −1
Viterbi algorithm
• Initialization - δ1(i)
  – When t = 1 the most probable path to a
    state does not sensibly exist

  – However we use the probability of being in
    that state given t = 1 and the observable
    state O1
                δ1 ( i ) = π i bi ( O1 ) 1 ≤ i ≤ N
               ψ (i ) = 0
Viterbi algorithm
• Calculate δt(i) when t > 1
  – δt(i) : The most probable path to the state X
    at time t
  – This path to X will have to pass through one
    of the states A, B or C at time (t-1)
  Most probable path to A: δ t −1 ( A)   a AX   bX ( Ot )
Viterbi algorithm
• Recursion
   δ t ( j ) = max δ t −1 ( i ) aij  b j ( Ot )
                                                  2≤t ≤T
               1≤ i ≤ N

   ψ t ( j ) = argmax δ t −1 ( i ) aij            1≤ j ≤ N
                      
                     1≤ i ≤ N
                                        

• Termination
   P* = max δ T ( i ) 
                      
           1≤i ≤ N

   q = argmax δ T ( i ) 
     *
     T                  
             1≤i ≤ N
Viterbi algorithm
• Path (state sequence) backtracking
   qt* = ψ t +1 (qt*+1 )   t = T − 1, T − 2, ..., 1
   qT −1 = ψ T (qT ) = argmax δ T −1 ( i ) aiq* 
    *            *

                        1≤i ≤ N               T 


   ...
   ...
    *         *
   q1 = ψ 2 (q2 )
Solution 3
• 怎樣的模型 λ = (A, B, π) 最有可能產生
  觀察到的現象
   what 模型 maximize P(觀察到的現象|
  模型)
• There is no known analytic solution. We
  can choose λ = (A, B, π) such that P(O| λ)
  is locally maximized using an iterative
  procedure
Baum-Welch Method
    • Define ξt(i, j) = P(qt=Si , qt+1=Sj|O, λ)
         – The probability of being in state Si at time t,
           and state Sj at time t+1

              α t ( i ) aij b j ( Ot +1 ) βt +1 ( j )
ξt ( i, j ) =
                            P (O λ )
         α t ( i ) aij b j ( Ot +1 ) βt +1 ( j )
=    N    N

    ∑∑ α ( i ) a b ( O ) β ( j )
    i =1 j =1
                t        ij   j    t +1    t +1
Baum-Welch Method
• γt(i) : the probability of being in state Si at time
  t, given the observation sequence O, and the
  model λ
                                              α t ( i ) βt ( i )    α ( i ) βt ( i )
                                 γ t (i ) =                      = N t
                                                P (O λ )
                                                                  ∑ α t ( i ) βt ( i )
• Relate γt(i) to ξt(i, j)                                         i =1



                                               α t ( i ) aij b j ( Ot +1 ) βt +1 ( j )
                N                ξt ( i, j ) =
     γ t ( i ) = ∑ ξt ( i, j )                               P (O λ )
                j =1                     α t ( i ) aij b j ( Ot +1 ) βt +1 ( j )
                                 =   N    N

                                     ∑∑ α ( i ) a b ( O ) β ( j )
                                     i =1 j =1
                                                 t       ij   j    t +1    t +1
Baum-Welch Method
• The expected number of times that state Si is
  visited
         T −1

         ∑ γ ( i ) = Expected number of transitions from Si
         t =1
                t




• Similarly, the expected number of transitions
  from state Si to state Sj
  T −1

  ∑ ξ ( i, j ) = Expected number of transitions from S to S
  t =1
          t                                               i   j
Baum-Welch Method
• Re-estimation formulas for π, A and B
π i = γ1(i)
        T −1

        ∑ξ (i, j)
        t =1
                 t
                                     expected number of transitions from state Si to S j
aij =     T −1
                                 =
                                        expected number of transitions from state Si
         ∑γt (i)
          t =1
                     T

                  ∑t =1
                             γ t ( j)
               s.t. Ot =vk                expected number of times in state j and observing symbol vk
b j (k) =           T
                                        =
                                                     expected number of times in state j
                  ∑γ ( j)
                     t =1
                             t
Baum-Welch Method
• P(O|λ) > P(O|λ)

• Iteratively use λ in place of λ and repeat
  the re-estimation, we then can improve
  P(O| λ) until some limiting point is
  reached

More Related Content

What's hot

Research Inventy : International Journal of Engineering and Science
Research Inventy : International Journal of Engineering and ScienceResearch Inventy : International Journal of Engineering and Science
Research Inventy : International Journal of Engineering and Science
researchinventy
 
L 32(nkd)(et) ((ee)nptel)
L 32(nkd)(et) ((ee)nptel)L 32(nkd)(et) ((ee)nptel)
L 32(nkd)(et) ((ee)nptel)sairoopareddy
 
Mcqmc talk
Mcqmc talkMcqmc talk
WAVELET-PACKET-BASED ADAPTIVE ALGORITHM FOR SPARSE IMPULSE RESPONSE IDENTIFI...
WAVELET-PACKET-BASED ADAPTIVE ALGORITHM FOR  SPARSE IMPULSE RESPONSE IDENTIFI...WAVELET-PACKET-BASED ADAPTIVE ALGORITHM FOR  SPARSE IMPULSE RESPONSE IDENTIFI...
WAVELET-PACKET-BASED ADAPTIVE ALGORITHM FOR SPARSE IMPULSE RESPONSE IDENTIFI...
bermudez_jcm
 
Quantization
QuantizationQuantization
Quantizationwtyru1989
 
R. Jimenez - Fundamental Physics from Astronomical Observations
R. Jimenez - Fundamental Physics from Astronomical ObservationsR. Jimenez - Fundamental Physics from Astronomical Observations
R. Jimenez - Fundamental Physics from Astronomical Observations
SEENET-MTP
 
DSP_FOEHU - MATLAB 02 - The Discrete-time Fourier Analysis
DSP_FOEHU - MATLAB 02 - The Discrete-time Fourier AnalysisDSP_FOEHU - MATLAB 02 - The Discrete-time Fourier Analysis
DSP_FOEHU - MATLAB 02 - The Discrete-time Fourier Analysis
Amr E. Mohamed
 
Nonlinear Stochastic Optimization by the Monte-Carlo Method
Nonlinear Stochastic Optimization by the Monte-Carlo MethodNonlinear Stochastic Optimization by the Monte-Carlo Method
Nonlinear Stochastic Optimization by the Monte-Carlo Method
SSA KPI
 
Signal fundamentals
Signal fundamentalsSignal fundamentals
Signal fundamentals
Lalit Kanoje
 
Z transfrm ppt
Z transfrm pptZ transfrm ppt
Z transfrm ppt
SWATI MISHRA
 
Laplace transform & fourier series
Laplace transform & fourier seriesLaplace transform & fourier series
Laplace transform & fourier series
vaibhav tailor
 
Fourier Series for Continuous Time & Discrete Time Signals
Fourier Series for Continuous Time & Discrete Time SignalsFourier Series for Continuous Time & Discrete Time Signals
Fourier Series for Continuous Time & Discrete Time Signals
Jayanshu Gundaniya
 
Balanced homodyne detection
Balanced homodyne detectionBalanced homodyne detection
Balanced homodyne detectionwtyru1989
 
Fourier analysis of signals and systems
Fourier analysis of signals and systemsFourier analysis of signals and systems
Fourier analysis of signals and systems
Babul Islam
 
SSA slides
SSA slidesSSA slides
SSA slides
atikrkhan
 
Dcs lec02 - z-transform
Dcs   lec02 - z-transformDcs   lec02 - z-transform
Dcs lec02 - z-transform
Amr E. Mohamed
 
DSP_2018_FOEHU - Lec 03 - Discrete-Time Signals and Systems
DSP_2018_FOEHU - Lec 03 - Discrete-Time Signals and SystemsDSP_2018_FOEHU - Lec 03 - Discrete-Time Signals and Systems
DSP_2018_FOEHU - Lec 03 - Discrete-Time Signals and Systems
Amr E. Mohamed
 

What's hot (20)

Rdnd2008
Rdnd2008Rdnd2008
Rdnd2008
 
Adc
AdcAdc
Adc
 
Research Inventy : International Journal of Engineering and Science
Research Inventy : International Journal of Engineering and ScienceResearch Inventy : International Journal of Engineering and Science
Research Inventy : International Journal of Engineering and Science
 
L 32(nkd)(et) ((ee)nptel)
L 32(nkd)(et) ((ee)nptel)L 32(nkd)(et) ((ee)nptel)
L 32(nkd)(et) ((ee)nptel)
 
Mcqmc talk
Mcqmc talkMcqmc talk
Mcqmc talk
 
WAVELET-PACKET-BASED ADAPTIVE ALGORITHM FOR SPARSE IMPULSE RESPONSE IDENTIFI...
WAVELET-PACKET-BASED ADAPTIVE ALGORITHM FOR  SPARSE IMPULSE RESPONSE IDENTIFI...WAVELET-PACKET-BASED ADAPTIVE ALGORITHM FOR  SPARSE IMPULSE RESPONSE IDENTIFI...
WAVELET-PACKET-BASED ADAPTIVE ALGORITHM FOR SPARSE IMPULSE RESPONSE IDENTIFI...
 
Quantization
QuantizationQuantization
Quantization
 
R. Jimenez - Fundamental Physics from Astronomical Observations
R. Jimenez - Fundamental Physics from Astronomical ObservationsR. Jimenez - Fundamental Physics from Astronomical Observations
R. Jimenez - Fundamental Physics from Astronomical Observations
 
DSP_FOEHU - MATLAB 02 - The Discrete-time Fourier Analysis
DSP_FOEHU - MATLAB 02 - The Discrete-time Fourier AnalysisDSP_FOEHU - MATLAB 02 - The Discrete-time Fourier Analysis
DSP_FOEHU - MATLAB 02 - The Discrete-time Fourier Analysis
 
Nonlinear Stochastic Optimization by the Monte-Carlo Method
Nonlinear Stochastic Optimization by the Monte-Carlo MethodNonlinear Stochastic Optimization by the Monte-Carlo Method
Nonlinear Stochastic Optimization by the Monte-Carlo Method
 
Signal fundamentals
Signal fundamentalsSignal fundamentals
Signal fundamentals
 
Z transfrm ppt
Z transfrm pptZ transfrm ppt
Z transfrm ppt
 
z transforms
z transformsz transforms
z transforms
 
Laplace transform & fourier series
Laplace transform & fourier seriesLaplace transform & fourier series
Laplace transform & fourier series
 
Fourier Series for Continuous Time & Discrete Time Signals
Fourier Series for Continuous Time & Discrete Time SignalsFourier Series for Continuous Time & Discrete Time Signals
Fourier Series for Continuous Time & Discrete Time Signals
 
Balanced homodyne detection
Balanced homodyne detectionBalanced homodyne detection
Balanced homodyne detection
 
Fourier analysis of signals and systems
Fourier analysis of signals and systemsFourier analysis of signals and systems
Fourier analysis of signals and systems
 
SSA slides
SSA slidesSSA slides
SSA slides
 
Dcs lec02 - z-transform
Dcs   lec02 - z-transformDcs   lec02 - z-transform
Dcs lec02 - z-transform
 
DSP_2018_FOEHU - Lec 03 - Discrete-Time Signals and Systems
DSP_2018_FOEHU - Lec 03 - Discrete-Time Signals and SystemsDSP_2018_FOEHU - Lec 03 - Discrete-Time Signals and Systems
DSP_2018_FOEHU - Lec 03 - Discrete-Time Signals and Systems
 

Viewers also liked

Data Science - Part XIII - Hidden Markov Models
Data Science - Part XIII - Hidden Markov ModelsData Science - Part XIII - Hidden Markov Models
Data Science - Part XIII - Hidden Markov Models
Derek Kane
 
12 Machine Learning Supervised Hidden Markov Chains
12 Machine Learning  Supervised Hidden Markov Chains12 Machine Learning  Supervised Hidden Markov Chains
12 Machine Learning Supervised Hidden Markov Chains
Andres Mendez-Vazquez
 
Probabilistic Models of Time Series and Sequences
Probabilistic Models of Time Series and SequencesProbabilistic Models of Time Series and Sequences
Probabilistic Models of Time Series and Sequences
Zitao Liu
 
Hidden Markov Model & Stock Prediction
Hidden Markov Model & Stock PredictionHidden Markov Model & Stock Prediction
Hidden Markov Model & Stock Prediction
David Chiu
 

Viewers also liked (6)

Data Science - Part XIII - Hidden Markov Models
Data Science - Part XIII - Hidden Markov ModelsData Science - Part XIII - Hidden Markov Models
Data Science - Part XIII - Hidden Markov Models
 
Ch11 hmm
Ch11 hmmCh11 hmm
Ch11 hmm
 
12 Machine Learning Supervised Hidden Markov Chains
12 Machine Learning  Supervised Hidden Markov Chains12 Machine Learning  Supervised Hidden Markov Chains
12 Machine Learning Supervised Hidden Markov Chains
 
Probabilistic Models of Time Series and Sequences
Probabilistic Models of Time Series and SequencesProbabilistic Models of Time Series and Sequences
Probabilistic Models of Time Series and Sequences
 
Hidden markov model ppt
Hidden markov model pptHidden markov model ppt
Hidden markov model ppt
 
Hidden Markov Model & Stock Prediction
Hidden Markov Model & Stock PredictionHidden Markov Model & Stock Prediction
Hidden Markov Model & Stock Prediction
 

Similar to An Introduction to Hidden Markov Model

Hidden Markov Models common probability formulas
Hidden Markov Models common probability formulasHidden Markov Models common probability formulas
Hidden Markov Models common probability formulas
Nidhal Selmi
 
Design and Analysis of Algorithms - Divide and Conquer
Design and Analysis of Algorithms - Divide and ConquerDesign and Analysis of Algorithms - Divide and Conquer
Design and Analysis of Algorithms - Divide and Conquer
Seshu Chakravarthy
 
1_Asymptotic_Notation_pptx.pptx
1_Asymptotic_Notation_pptx.pptx1_Asymptotic_Notation_pptx.pptx
1_Asymptotic_Notation_pptx.pptx
pallavidhade2
 
2003 Ames.Models
2003 Ames.Models2003 Ames.Models
2003 Ames.Models
pinchung
 
Asymptotic Notation
Asymptotic NotationAsymptotic Notation
Asymptotic Notation
sohelranasweet
 
Asymptotic notation
Asymptotic notationAsymptotic notation
Asymptotic notation
mustafa sarac
 
continious hmm.pdf
continious  hmm.pdfcontinious  hmm.pdf
continious hmm.pdf
Rahul Halder
 
One way to see higher dimensional surface
One way to see higher dimensional surfaceOne way to see higher dimensional surface
One way to see higher dimensional surface
Kenta Oono
 
MLP輪読スパース8章 トレースノルム正則化
MLP輪読スパース8章 トレースノルム正則化MLP輪読スパース8章 トレースノルム正則化
MLP輪読スパース8章 トレースノルム正則化
Akira Tanimoto
 
Dsp U Lec09 Iir Filter Design
Dsp U   Lec09 Iir Filter DesignDsp U   Lec09 Iir Filter Design
Dsp U Lec09 Iir Filter Design
taha25
 
Quantifying the call blending balance in two way communication retrial queues...
Quantifying the call blending balance in two way communication retrial queues...Quantifying the call blending balance in two way communication retrial queues...
Quantifying the call blending balance in two way communication retrial queues...
wrogiest
 
Daa divide-n-conquer
Daa divide-n-conquerDaa divide-n-conquer
Daa divide-n-conquer
sankara_rao
 
Paris2012 session2
Paris2012 session2Paris2012 session2
Paris2012 session2Cdiscount
 
Hidden markov model explained
Hidden markov model explainedHidden markov model explained
Hidden markov model explained
Donghoon Park
 
Final Present Pap1on relibility
Final Present Pap1on relibilityFinal Present Pap1on relibility
Final Present Pap1on relibility
ketan gajjar
 
Cosmin Crucean: Perturbative QED on de Sitter Universe.
Cosmin Crucean: Perturbative QED on de Sitter Universe.Cosmin Crucean: Perturbative QED on de Sitter Universe.
Cosmin Crucean: Perturbative QED on de Sitter Universe.
SEENET-MTP
 
2013.06.17 Time Series Analysis Workshop ..Applications in Physiology, Climat...
2013.06.17 Time Series Analysis Workshop ..Applications in Physiology, Climat...2013.06.17 Time Series Analysis Workshop ..Applications in Physiology, Climat...
2013.06.17 Time Series Analysis Workshop ..Applications in Physiology, Climat...
NUI Galway
 

Similar to An Introduction to Hidden Markov Model (20)

Hidden Markov Models common probability formulas
Hidden Markov Models common probability formulasHidden Markov Models common probability formulas
Hidden Markov Models common probability formulas
 
Design and Analysis of Algorithms - Divide and Conquer
Design and Analysis of Algorithms - Divide and ConquerDesign and Analysis of Algorithms - Divide and Conquer
Design and Analysis of Algorithms - Divide and Conquer
 
1_Asymptotic_Notation_pptx.pptx
1_Asymptotic_Notation_pptx.pptx1_Asymptotic_Notation_pptx.pptx
1_Asymptotic_Notation_pptx.pptx
 
Lec10
Lec10Lec10
Lec10
 
2003 Ames.Models
2003 Ames.Models2003 Ames.Models
2003 Ames.Models
 
Asymptotic Notation
Asymptotic NotationAsymptotic Notation
Asymptotic Notation
 
Asymptotic notation
Asymptotic notationAsymptotic notation
Asymptotic notation
 
continious hmm.pdf
continious  hmm.pdfcontinious  hmm.pdf
continious hmm.pdf
 
One way to see higher dimensional surface
One way to see higher dimensional surfaceOne way to see higher dimensional surface
One way to see higher dimensional surface
 
Algo complexity
Algo complexityAlgo complexity
Algo complexity
 
MLP輪読スパース8章 トレースノルム正則化
MLP輪読スパース8章 トレースノルム正則化MLP輪読スパース8章 トレースノルム正則化
MLP輪読スパース8章 トレースノルム正則化
 
Dsp U Lec09 Iir Filter Design
Dsp U   Lec09 Iir Filter DesignDsp U   Lec09 Iir Filter Design
Dsp U Lec09 Iir Filter Design
 
Quantifying the call blending balance in two way communication retrial queues...
Quantifying the call blending balance in two way communication retrial queues...Quantifying the call blending balance in two way communication retrial queues...
Quantifying the call blending balance in two way communication retrial queues...
 
Daa divide-n-conquer
Daa divide-n-conquerDaa divide-n-conquer
Daa divide-n-conquer
 
Rpra1
Rpra1Rpra1
Rpra1
 
Paris2012 session2
Paris2012 session2Paris2012 session2
Paris2012 session2
 
Hidden markov model explained
Hidden markov model explainedHidden markov model explained
Hidden markov model explained
 
Final Present Pap1on relibility
Final Present Pap1on relibilityFinal Present Pap1on relibility
Final Present Pap1on relibility
 
Cosmin Crucean: Perturbative QED on de Sitter Universe.
Cosmin Crucean: Perturbative QED on de Sitter Universe.Cosmin Crucean: Perturbative QED on de Sitter Universe.
Cosmin Crucean: Perturbative QED on de Sitter Universe.
 
2013.06.17 Time Series Analysis Workshop ..Applications in Physiology, Climat...
2013.06.17 Time Series Analysis Workshop ..Applications in Physiology, Climat...2013.06.17 Time Series Analysis Workshop ..Applications in Physiology, Climat...
2013.06.17 Time Series Analysis Workshop ..Applications in Physiology, Climat...
 

More from Shih-Hsiang Lin

Introduction to Apache Ant
Introduction to Apache AntIntroduction to Apache Ant
Introduction to Apache Ant
Shih-Hsiang Lin
 
Introduction to GNU Make Programming Language
Introduction to GNU Make Programming LanguageIntroduction to GNU Make Programming Language
Introduction to GNU Make Programming Language
Shih-Hsiang Lin
 
Ch6 file, saving states, and preferences
Ch6 file, saving states, and preferencesCh6 file, saving states, and preferences
Ch6 file, saving states, and preferencesShih-Hsiang Lin
 
[C++ gui programming with qt4] chap9
[C++ gui programming with qt4] chap9[C++ gui programming with qt4] chap9
[C++ gui programming with qt4] chap9Shih-Hsiang Lin
 
Ch5 intent broadcast receivers adapters and internet
Ch5 intent broadcast receivers adapters and internetCh5 intent broadcast receivers adapters and internet
Ch5 intent broadcast receivers adapters and internetShih-Hsiang Lin
 
Ch4 creating user interfaces
Ch4 creating user interfacesCh4 creating user interfaces
Ch4 creating user interfacesShih-Hsiang Lin
 
Ch3 creating application and activities
Ch3 creating application and activitiesCh3 creating application and activities
Ch3 creating application and activitiesShih-Hsiang Lin
 
[C++ GUI Programming with Qt4] chap7
[C++ GUI Programming with Qt4] chap7[C++ GUI Programming with Qt4] chap7
[C++ GUI Programming with Qt4] chap7Shih-Hsiang Lin
 
[C++ GUI Programming with Qt4] chap4
[C++ GUI Programming with Qt4] chap4[C++ GUI Programming with Qt4] chap4
[C++ GUI Programming with Qt4] chap4Shih-Hsiang Lin
 
Introduction to homography
Introduction to homographyIntroduction to homography
Introduction to homographyShih-Hsiang Lin
 
Project Hosting by Google
Project Hosting by GoogleProject Hosting by Google
Project Hosting by Google
Shih-Hsiang Lin
 

More from Shih-Hsiang Lin (13)

Introduction to Apache Ant
Introduction to Apache AntIntroduction to Apache Ant
Introduction to Apache Ant
 
Introduction to GNU Make Programming Language
Introduction to GNU Make Programming LanguageIntroduction to GNU Make Programming Language
Introduction to GNU Make Programming Language
 
Ch6 file, saving states, and preferences
Ch6 file, saving states, and preferencesCh6 file, saving states, and preferences
Ch6 file, saving states, and preferences
 
[C++ gui programming with qt4] chap9
[C++ gui programming with qt4] chap9[C++ gui programming with qt4] chap9
[C++ gui programming with qt4] chap9
 
Ch5 intent broadcast receivers adapters and internet
Ch5 intent broadcast receivers adapters and internetCh5 intent broadcast receivers adapters and internet
Ch5 intent broadcast receivers adapters and internet
 
Ch4 creating user interfaces
Ch4 creating user interfacesCh4 creating user interfaces
Ch4 creating user interfaces
 
Ch3 creating application and activities
Ch3 creating application and activitiesCh3 creating application and activities
Ch3 creating application and activities
 
[C++ GUI Programming with Qt4] chap7
[C++ GUI Programming with Qt4] chap7[C++ GUI Programming with Qt4] chap7
[C++ GUI Programming with Qt4] chap7
 
[C++ GUI Programming with Qt4] chap4
[C++ GUI Programming with Qt4] chap4[C++ GUI Programming with Qt4] chap4
[C++ GUI Programming with Qt4] chap4
 
Function pointer
Function pointerFunction pointer
Function pointer
 
Introduction to homography
Introduction to homographyIntroduction to homography
Introduction to homography
 
Git basic
Git basicGit basic
Git basic
 
Project Hosting by Google
Project Hosting by GoogleProject Hosting by Google
Project Hosting by Google
 

Recently uploaded

UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
RTTS
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Thierry Lestable
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
Ralf Eggert
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
DianaGray10
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
Product School
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
Frank van Harmelen
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 

Recently uploaded (20)

UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 

An Introduction to Hidden Markov Model

  • 1. An Introduction to HMM Browny 2010.07.21
  • 2. MM vs. HMM States States Observations
  • 3. Markov Model • Given 3 weather states: – {S1, S2, S3} = {rain, cloudy, sunny} Rain Cloudy Sunny Rain 0.4 0.3 0.3 Cloudy 0.2 0.6 0.2 Sunny 0.1 0.1 0.8 • What is the probabilities for next 7 days will be {sun, sun, rain, rain, sun, cloud, sun} ?
  • 4. Hidden Markov Model • The states – We don’t understand, Hidden! – But it can be indirectly observed • Example – 北極or赤道(model), Hot/Cold(state), 1/2/3 ice cream(observation)
  • 5. Hidden Markov Model • The observation is a probability function of state which is not observable directly Hidden States
  • 6. HMM Elements • N, the number of states in the model • M, the number of distinct observation symbols • A, the state transition probability distribution • B, the observation symbol probability distribution in states • π, the initial state distribution λ: model
  • 7. Example P(…|C) P(…|H) P(…|Start) P(1|…) 0.7 0.1 P(2|…) 0.2 B: 0.2 Observation P(3|…) 0.1 0.7 P(C|…) 0.8 0.1 0.5 A: π: P(H|…) 0.1 0.8 0.5 Transition initial P(STOP|…) 0.1 0.1 0
  • 9. 3 Problems 1. 觀察到的現象最符合哪一個模型 P(觀察到的現象|模型) 2. 怎樣的狀態序列最符合觀察到的現 象和已知的模型 P(狀態序列|觀察到的現象, 模型) 3. 怎樣的模型最有可能產生觀察到的 現象 what 模型 maximize P(觀察到的現象| 模型)
  • 10. Solution 1 • 已知模型,一觀察序列之產生機率 P(O|λ) R1 R1 R1 S1 S1 S1 R2 R2 R2 S2 R1 S2 R1 S2 R1 R2 R2 R2 S3 R1 S3 R1 S3 R1 R2 R2 R2 1 2 3 t 觀察到 R1 R1 R2 的機率為多少?
  • 11. Solution 1 • 考慮一特定的狀態序列 Q = q1, q2 … qT • 產生出一特定觀察序列之機率為 P(O|Q, λ) = P(O1|q1, λ) * P(O2|q2, λ) * … * P(Ot|qt, λ) = bq1(O1) * bq2(O2) * … * bqT(OT)
  • 12. Solution 1 • 此一特定序列發生之機率為 P(Q|λ) = πq1 * aq1q2 * aq2q3 * … * aq(T-1)qT • 已知模型,一觀察序列之產生機率 P(O|λ) P(O|λ) = ,q∑ q P(O|Q, λ) * P(Q| λ) q ,..., 1 2 T = q ,q∑ q πq1 * bq1(O1) * aq1q2 bq2(O2)* … * aq(T-1)qT * bqT(OT) ,..., 1 2 T
  • 13. Solution 1 狀態的數量) • Complexity (N: 狀態的數量 – 2T*NT ≈ (2T-1)NT muls + NT-1 adds (NT:狀態轉換 組合數) – For N=5 states, T=100 observations, there are order 2*100*5100 ≈ 1072 computations!! • Forward Algorithm – Forward variable αt(i) (給定時間 t 時狀態為 Si 的 條件下,向前 向前局部觀察序列為O1, O2, O3…, Ot 的 向前 機率) at (i ) = P(O1 , O2 ,..., Ot , qt = Si | λ )
  • 14. Solution 1 R1 R1 R1 S1 S1 S1 R2 R2 R2 When O1 = R1 S2 R1 S2 R1 S2 R1 R2 R2 R2 S3 R1 S3 R1 S3 R1 R2 R2 R2 1 2 3 t α1 ( i ) = π i bi ( O1 ) 1 ≤ i ≤ N α 2 (1) = α1 (1) a11 + α1 ( 2 ) a21 + α1 ( 3) a31  b1 ( O2 )   α1 (1) = π 1b1 (O1 ) α1 (2) = π 2b2 (O1 ) α 2 ( 2 ) = α1 (1) a12 + α1 ( 2 ) a22 + α1 ( 3) a32  b2 ( O2 )   α1 (3) = π 3b3 (O1 )
  • 15. Forward Algorithm • Initialization: α1 (i ) = π i bi (O1 ) 1 ≤ i ≤ N • Induction: N  1 ≤ t ≤ T −1 αt +1 ( j ) = ∑αt ( i ) aij  bj ( Ot +1 ) 1 ≤ j ≤ N  i=1  • Termination: N P(O | λ ) = ∑ αT (i ) i =1
  • 16. Backward Algorithm • Forward Algorithm at (i ) = P(O1 , O2 ,..., Ot , qt = Si | λ ) • Backward Algorithm – 給定時間 t 時狀態為 Si 的條件下,向後 向後局 向後 部觀察序列為 Ot+1, Ot+2, …, OT的機率 βt (i ) = P(Ot +1 , Ot + 2 ,..., OT , qt = Si | λ )
  • 17. Backward Algorithm • Initialization βT (i ) = 1 1 ≤ i ≤ N • Induction N t = T −1, T − 2, ...,1 βt (i ) = ∑ aij b j (Ot +1 ) β t +1 ( j ) j =1 1≤ i ≤ N
  • 18. Backward Algorithm R1 R1 R1 S1 S1 S1 R2 R2 R2 When OT = R1 S2 R1 S2 R1 S2 R1 R2 R2 R2 S3 R1 S3 R1 S3 R1 R2 R2 R2 1 2 3 t N β T −1 (1) = ∑ a1 j b j ( OT ) β T ( j ) j =1 = a11b1 ( OT ) + a12 b2 ( OT ) + a13b3 ( OT )
  • 19. Solution 2 • 怎樣的狀態序列最能解釋觀察到的現 象和已知的模型 P(狀態序列|觀察到的現象, 模型) • 無精確解,有很多種方式解此問題, 對狀態序列的不同限制有不同的解法 對狀態序列的不同限制
  • 20. Solution 2 • 例: Choose the state qt which are individually most likely – γt(i) : the probability of being in state Si at time t, given the observation sequence O, and the model λ P (O | qt = Si , λ ) α t ( i ) βt ( i ) α t ( i ) βt ( i ) γ t (i ) = = = N P (O λ ) P (O λ ) ∑ α t ( i ) βt ( i ) i =1 qt = argmax γ t ( i )  1 ≤ t ≤ T   1≤i ≤ N
  • 21. Viterbi algorithm • The most widely used criteria is to find the “single best state sequence” maxmize P ( Q | O, λ ) ≈ maxmize P ( Q, O | λ ) • A formal technique exists, based on dynamic programming methods, and is called the Viterbi algorithm
  • 22. Viterbi algorithm • To find the single best state sequence, Q = {q1, q2, …, qT}, for the given observation sequence O = {O1, O2, …, OT} • δt(i): the best score (highest prob.) along a single path, at time t, which accounts for the first t observations and end in state Si δ t ( i ) = max P  q1 q2 ... qt = Si , O1 O2 ... Ot λ    1 q , q ,..., q 2 t −1
  • 23. Viterbi algorithm • Initialization - δ1(i) – When t = 1 the most probable path to a state does not sensibly exist – However we use the probability of being in that state given t = 1 and the observable state O1 δ1 ( i ) = π i bi ( O1 ) 1 ≤ i ≤ N ψ (i ) = 0
  • 24. Viterbi algorithm • Calculate δt(i) when t > 1 – δt(i) : The most probable path to the state X at time t – This path to X will have to pass through one of the states A, B or C at time (t-1) Most probable path to A: δ t −1 ( A) a AX bX ( Ot )
  • 25. Viterbi algorithm • Recursion δ t ( j ) = max δ t −1 ( i ) aij  b j ( Ot )   2≤t ≤T 1≤ i ≤ N ψ t ( j ) = argmax δ t −1 ( i ) aij  1≤ j ≤ N  1≤ i ≤ N  • Termination P* = max δ T ( i )    1≤i ≤ N q = argmax δ T ( i )  * T   1≤i ≤ N
  • 26. Viterbi algorithm • Path (state sequence) backtracking qt* = ψ t +1 (qt*+1 ) t = T − 1, T − 2, ..., 1 qT −1 = ψ T (qT ) = argmax δ T −1 ( i ) aiq*  * * 1≤i ≤ N  T  ... ... * * q1 = ψ 2 (q2 )
  • 27. Solution 3 • 怎樣的模型 λ = (A, B, π) 最有可能產生 觀察到的現象 what 模型 maximize P(觀察到的現象| 模型) • There is no known analytic solution. We can choose λ = (A, B, π) such that P(O| λ) is locally maximized using an iterative procedure
  • 28. Baum-Welch Method • Define ξt(i, j) = P(qt=Si , qt+1=Sj|O, λ) – The probability of being in state Si at time t, and state Sj at time t+1 α t ( i ) aij b j ( Ot +1 ) βt +1 ( j ) ξt ( i, j ) = P (O λ ) α t ( i ) aij b j ( Ot +1 ) βt +1 ( j ) = N N ∑∑ α ( i ) a b ( O ) β ( j ) i =1 j =1 t ij j t +1 t +1
  • 29. Baum-Welch Method • γt(i) : the probability of being in state Si at time t, given the observation sequence O, and the model λ α t ( i ) βt ( i ) α ( i ) βt ( i ) γ t (i ) = = N t P (O λ ) ∑ α t ( i ) βt ( i ) • Relate γt(i) to ξt(i, j) i =1 α t ( i ) aij b j ( Ot +1 ) βt +1 ( j ) N ξt ( i, j ) = γ t ( i ) = ∑ ξt ( i, j ) P (O λ ) j =1 α t ( i ) aij b j ( Ot +1 ) βt +1 ( j ) = N N ∑∑ α ( i ) a b ( O ) β ( j ) i =1 j =1 t ij j t +1 t +1
  • 30. Baum-Welch Method • The expected number of times that state Si is visited T −1 ∑ γ ( i ) = Expected number of transitions from Si t =1 t • Similarly, the expected number of transitions from state Si to state Sj T −1 ∑ ξ ( i, j ) = Expected number of transitions from S to S t =1 t i j
  • 31. Baum-Welch Method • Re-estimation formulas for π, A and B π i = γ1(i) T −1 ∑ξ (i, j) t =1 t expected number of transitions from state Si to S j aij = T −1 = expected number of transitions from state Si ∑γt (i) t =1 T ∑t =1 γ t ( j) s.t. Ot =vk expected number of times in state j and observing symbol vk b j (k) = T = expected number of times in state j ∑γ ( j) t =1 t
  • 32. Baum-Welch Method • P(O|λ) > P(O|λ) • Iteratively use λ in place of λ and repeat the re-estimation, we then can improve P(O| λ) until some limiting point is reached