In a hidden Markov model, the state is not directly visible, but

‫به نام خدا‬
‫مدل‌‌مخفی‌مارکوف‌‬
‫و‌ تعمیم‌های‌آن‬
‫درس بیوانفورماتیک‬
‫‪December 2013‬‬
HMM
Concept
Observation:
Obs. Seri:
o1
o2
o3
o4
o5
o6
State Seri:
q1
q2
q3
q4
q5
q6
Markov Chain:
S2
S1
S3
S4
Observable Markov Model:
State=weather condition
S2
S5
S1
S2
S5
In a regular Markov model, the state is directly visible to the
observer, the state transition probabilities are the only
parameters.
S3
S4
2
Sharif University of Technology
HMM
Concept
Observation:
Obs. Seri:
State Seri:
Markov Chain:
o1
o2
o3
q1
q2
q3
S3
S2
S2
o4
q4
S4
o5
o6
q5
q6
S1
S2
Markov Hidden Model:
State=Pressure of Atmosphere
S2
In a hidden Markov model, the state is not directly visible,
but variables influenced by the state are visible. Each state
has a probability distribution over the possible output
tokens. Therefore the sequence of tokens generated by an
HMM gives some information about the sequence of states.
Sharif University of Technology
S1
S3
S4
3
HMM
Model
aij  P[qt  S j | qt 1  Si ],
S3
v2
S2
S2
S4
1  i, j  N
S1
q2
q3
q4
q5
q6
o1
o2
o3
o4
o5
o6
v3
v4
v2
S1
S2
q1
v1
S2
S3
S4
v5
b j (k )  P[vk at t | qt  S j ], 1  j  N
  ( A, B,  )
1 k  M
 i  P[q1  Si ],
1 i  N
Sharif University of Technology
4
HMM
Evaluation
Problem 1: Given an observation sequence and a model, compute the probability of the
observation sequence
  ( A, B,  )
S3
v2
S2
S2
S4
S1
S2
q1
q2
q3
q4
q5
q6
o1
o2
o3
o4
o5
o6
v1
v3
v4
v2
Sharif University of Technology
v5
5
HMM
Forward & Backward
N
 t (m)  P(o1:t , qt  S m )    t 1 (n)anmbm (ot )
Forward
n 1
1 (m)   mbm (o1 )
Ot
N
N
m 1
m 1
P(O1:T |  )   P(O1:T , qT  S m |  )    T (m)
𝑁
𝑃 𝑂𝜆 =
Sn
t-1
𝛼𝑡 (𝑖)𝛽𝑡 (𝑖)
Sm
t
𝑖=1
𝑐𝑜𝑚𝑝𝑙𝑒𝑥𝑖𝑡𝑦: 𝑁 2 𝑇
N
 t (m)  P(ot 1:T | qt  S m ,  )    t 1 (n)amnbn (ot 1 )
Ot+1
n 1
Backward
 T ( m)  1
Sharif University of Technology
Sm
Sn
t
t+1
6
HMM
Decoding / Classification / Inference
Problem 2: Given an observation sequence and a model, compute the optimal state
sequence to produce given observations
  ( A, B,  )
Viterbi
𝑄∗
= 𝑎𝑟𝑔𝑀𝑎𝑥
𝑄 𝑃(𝑄|𝑂, 𝜆)
Sm
Sn
𝑃(𝑂, 𝑄|𝜆)
= argMax𝑄
𝑃(𝑂|𝜆) t
t-1
= argMax𝑄 𝑃(𝑂, 𝑄|𝜆)
Ot
N
 t (m)    t 1 (n)anmbm (ot )
S3
v2
S2
S2
S4
S1
S2
q1
q2
q3
q4
q5
q6
o1
o2
o3
o4
o5
o6
v1
v3
v4
v2
v5
n 1
Recursion
 t (m)  max { t 1 (n)anm }bm (ot )
n
 t (m)  arg max { t 1 (n)anm }m
Backtracking
𝑃∗ = 𝑀𝑎𝑥𝑚 𝛿𝑇 𝑚
𝑞𝑇∗ = 𝑎𝑟𝑔𝑀𝑎𝑥𝑚 𝛿𝑇 𝑚
∗
𝑞𝑡−1
= 𝜓𝑡 (𝑞𝑡∗ )
m
n
Sharif University of Technology
t
7
HMM
Learning
Problem 3: Given an observation sequence estimate the parameters of the model:
whether knowing the sequence of states or not
Expectation/Maximization
t (n, m)  P(qt  S n , qt 1  S m | o)
 t (n)anm  t 1 (m)b j (ot 1 )
 N N
  t (n)anm t 1 (m)b j (ot 1 )
  ( A, B,  )
S3
m 1 n 1
N
 t (n)  P(qt  S n | o)  t (n, m)
m 1
v2
Ot
Sn
Sm
t
t+1
aij 
S2
S2
S4
S1
S2
q1
q2
q3
q4
q5
q6
o1
o2
o3
o4
o5
o6
v1
t t (n, m)
t  t (n)
Sharif University of Technology
v3
v4
v2
v5
 (n)o

b (k ) 
  ( n)
t
t
t
j
t
t
𝜋𝑖 = 𝛾1 (𝑛)
8
APPLICATION
Protein Structure
Sharif University of Technology
9
HMM Variants
•
Profile HMM
•
Constructing a profile HMM
•
•
•
each consensus column can exist in 3 states
match, insert and delete states
number of states depends upon length of the
alignment
•
•
•
•
•
•
A typical profile HMM architecture
transition between match states -a M j M j 1
transition from match state to insert state - a M j I j
• squares
represent
transition
within insert
state match
-a I j I j states
• diamonds
represent
insert states
transition
from match
state to delete
state - a M j D j
• circles
delete
transition
within represent
delete state
-a D j Dstates
j
•
arrows
represent
transitions
emission of symbol at a state -e s ( a )
Sharif University of Technology
10

HMM Variants
There exist a large number of HMM variants that modify and extend the basic model to
meet the needs of various applications.
• Adding silent states to the model to represent the absence of certain symbols that are
expected to be present at specific locations
• Making the states emit two aligned symbols, instead of a single symbol, so that the
resulting HMM simultaneously generates two related symbol sequences
• Make the probabilities at certain states dependent on part of the previous emissions to
describe more complex symbol correlations.
Sharif University of Technology
11
Profile HMM
Example: CpG islands
Sharif University of Technology
12
Profile HMM
Concept and Model
•
Stochastic methods to model multiple sequence alignments – proteins and
DNA sequences
protein classification
• • Potential
application domains:
•• motif
detection
protein
families could be modeled as an HMM or a group of HMMs
• constructing
a profile HMM
• finding
multiple sequence
alignments
new protein
sequences
be aligned
•• Scoring
a sequence
againstcould
a profile
HMM with stored models to detect remote
homologytwo profile HMMs
• Comparing
• aligning a sequence with a stored profile HMM
•
align two or more protein family profile HMMs to detect homology
•
finding statistical similarities between two profile HMM models
Sharif University of Technology
13
Profile HMM
Example: Problem2
Sharif University of Technology
14
Profile HMM
Example: Problem1
Sharif University of Technology
15
Profile HMM
Applications
• Comparing two multiple sequence alignments or sequence profiles, instead of comparing a single
sequence against a multiple alignment or a profile.
• Comparing sequence profiles can be beneficial for detecting remote homologues: For example:
• COACH allows us to compare sequence alignments, by building a profile-HMM from one alignment and
aligning the other alignment to the constructed profile-HMM.
• HHsearch generalizes the traditional pairwise sequence alignment algorithm for finding the alignment
of two profile-HMMs.
• PRC (profile comparer) provides a tool for scoring and aligning profile-HMMs produced by popular
software tools
• model sequences of protein secondary structure symbols: helix (H), strand (E), and coil (C)
•
feature-based profile-HMM was proposed to improve the performance of remote protein homology
detection. Instead of emitting amino acids, emissions of these HMMs are based on `features' that
capture the biochemical properties of the protein family of interest.
Sharif University of Technology
16
Pair HMM
Concept and Model
• The optimal state sequence y* can be found using dynamic programming, by a simple modification of
the Viterbi algorithm.
• The computational complexity of the resulting alignment algorithm is only O(LxLz).
Sharif University of Technology
17
Pair HMM
Applications
• finding pairwise alignment of proteins and DNA sequences. In other words, find the optimal
sequence alignment, compute the overall alignment probability, and estimate the reliability of the
individual alignment regions.
• Many multiple sequence alignment (MSA) algorithms also make use of pair-HMMs. The most widely
adopted strategy for constructing a multiple alignment is the progressive alignment approach, where
sequences are assembled into one large multiple alignment through consecutive pairwise alignment
steps according to a guide tree
•
Gene prediction, For example, a method called Pairagon+N-SCAN_EST : pair-HMM is first used to find
accurate alignments of cDNA sequences to a given genome, and these alignments are combined with
a gene prediction algorithm for accurate genome annotation.
•
Compare two DNA sequences and jointly analyze their gene structures.
• Aligning more complex structures, such as trees.
Sharif University of Technology
HsMM
model
S3
S2
S2
S4
S1
S2
ot5 1:t6
  ( A, B,  , D)
o1:t1
ot1 1:t2
ot 2 1:t3
ot3 1:t 4
ot 4 1:t5
d1
d2
d3
d4
d5
Sharif University of Technology
d6
19
Coupling
Concept & Model
S2
S2
S1
S1
S3
S4
S1
S1
S2
S3
S5
S2
S4
S3
S5
S4
  ( A(c ) , B ( c ) ,  (c ) )
(C )
P( S
(c)
t
|S
(1)
t 1
,S
( 2)
t 1
, , S
(C )
t 1
)   P( S t( c ) | S t(d1) )
(d )
Brand, [3]
Sharif University of Technology
20
CHSMM
Ancestors Diagram
Ferguson 1980
Baum 1966
   ( A, B,  , D)
  ( A, B,  )
Natarajan 2007
Brand 1996
   ( Ac , B c ,  c , Dc )
Sharif University of Technology
   ( Ac , B c ,  c )
21