Title: Markov Chains and Hidden Markov Models
1Markov Chains and Hidden Markov Models
- Marjolijn Elsinga
-
- Elze de Groot
2Andrei A. Markov
- Born 14 June 1856 in Ryazan, RussiaDied 20
July 1922 in Petrograd, Russia - Graduate of Saint Petersburg University (1878)
- Work number theory and analysis, continued
fractions, limits of integrals, approximation
theory and the convergence of series
3Todays topics
- Markov chains
- Hidden Markov models
- - Viterbi Algorithm
- - Forward Algorithm
- - Backward Algorithm
- - Posterior Probabilities
-
4Markov Chains (1)
5Markov Chains (2)
- Transition probabilities
- Probability of the sequence
6Key property of Markov Chains
- The probability of a symbol xi depends only on
the value of the preceding symbol xi-1
7Begin and End states
8Example CpG Islands
- CpG Cytosine phosphodiester bond Guanine
- 100 1000 bases long
- Cytosine is modified by methylation
- Methylation is suppressed in short stretches of
the genome (start regions of genes) - High chance of mutation into a thymine (T)
9Two questions
- How would we decide if a short strech of genomic
sequence comes from a CpG island or not? - How would we find, given a long piece of
sequence, the CpG islands in it, if there are any?
10Discrimination
- 48 putative CpG islands are extracted
- Derive 2 models
- - regions labelled as CpG island ( model)
- - regions from the remainder (- model)
- Transition probabilities are set
- - Where Cst is number of times letter t follows
letter s
11Maximum Likelihood Estimators
- Each row sums to 1
- Tables are asymmetric
12Log-odds ratio
13Discrimination shown
14Simulation model
15Simulation - model
16Todays topics
- Markov chains
- Hidden Markov models
- - Viterbi Algorithm
- - Forward Algorithm
- - Backward Algorithm
- - Posterior Probabilities
-
17Hidden Markov Models (HMM) (1)
- No one-to-one correspondence between states and
symbols - No longer possible to say what state the model is
in when in xi - Transition probability from state k to l
- pi is the ith state in the path (state sequence)
18Hidden Markov Models (HMM) (2)
- Begin state a0k
- End state a0k
- In CpG islands example
19Hidden Markov Models (HMM) (3)
- We need new set of parameters because we
decoupled symbols from states - Probability that symbol b is seen when in state k
20Example dishonest casino (1)
- Fair die and loaded die
- Loaded die probability 0.5 of a 6 and
probability 0.1 for 1-5 - Switch from fair to loaded probability 0.05
- Switch back probability 0.1
21Dishonest casino (2)
- Emission probabilities HMM model that generate
or emit sequences
22Dishonest casino (3)
- Hidden you dont know if die is fair or loaded
- Joint probability of observed sequence x and
state sequence p
23Three algorithms
- What is the most probable path for generating a
given sequence? - Viterbi Algorithm
- How likely is a given sequence?
- Forward Algorithm
- How can we learn the HMM parameters given a set
of sequences? - Forward-Backward (Baum-Welch) Algorithm
24Viterbi Algorithm
- CGCG can be generated on different ways, and with
different probabilities - Choose path with highest probability
- Most probable path can be found recursively
25Viterbi Algorithm (2)
- vk(i) probability of most probable path ending
in state k with observation i
26Viterbi Algorithm (3)
27Viterbi Algorithm
- Most probable path for CGCG
28Viterbi Algorithm
- Result with casino example
29Three algorithms
- What is the most probable path for generating a
given sequence? - Viterbi Algorithm
- How likely is a given sequence?
- Forward Algorithm
- How can we learn the HMM parameters given a set
of sequences? - Forward-Backward (Baum-Welch) Algorithm
30Forward Algorithm (1)
- Probability over all possible paths
- Number of possible paths increases exponentonial
with length of sequence - Forward algorithm enables us to compute this
efficiently
31Forward Algorithm (2)
- Replacing maximisation steps for sums in viterbi
algorithm - Probability of observed sequence up to and
including xi, requiring pi k
32Forward Algorithm (3)
33Three algorithms
- What is the most probable path for generating a
given sequence? - Viterbi Algorithm
- How likely is a given sequence?
- Forward Algorithm
- How can we learn the HMM parameters given a set
of sequences? - Forward-Backward (Baum-Welch) Algorithm
34Backward Algorithm (1)
- Probability of observed sequence from xi to the
end of the sequence, requiring pi k
35Disadvantage Algorithms
- Multiplying many probabilities gives very small
numbers which can lead to underflow errors on the
computer - ? can be solved by doing the algorithms in log
space, calculating log(vl(i))
36Backward Algorithm
37Posterior State Probability (1)
- Probability that observation xi came from state
k, given the observed sequence - Posterior probability of state k at time i when
the emitted sequence is known - P(pi k x)
38Posterior State Probability (2)
- First calculate probability of producing entire
observed sequence with the ith symbol being
produced by state k - P(x, pi k) fk (i) ? bk (i)
39Posterior State Probability (3)
- Posterior probabilities will then be
- P(x) is result of forward or backward calculation
40Posterior Probabilities (4)
41Two questions
- How would we decide if a short strech of genomic
sequence comes from a CpG island or not? - How would we find, given a long piece of
sequence, the CpG islands in it, if there are any?
42Prediction of CpG islands
- First way Viterbi Algorithm
- - Find most probable path through the model
- - When this path goes through the state, a
CpG island is predicted
43Prediction of CpG islands
- Second Way Posterior Decoding
- - function
-
- - g(k) 1 for k ? A, C, G, T
- - g(k) 0 for k ? A-, C-, G-, T-
- - G(ix) is posterior probability according to
the model that base i is in a CpG island
44Summary (1)
- Markov chain is a collection of states where a
state depends only on the state before - Hidden markov model is a model in which the
states sequence is hidden
45Summary (2)
- Most probable path viterbi algorithm
- How likely is a given sequence? forward
algorithm - Posterior state probability forward and backward
algorithms (used for most probable state of an
observation)