Date post: | 02-Jan-2016 |
Category: |
Documents |
Upload: | cynthia-barrett |
View: | 222 times |
Download: | 0 times |
Hidden Markov Models
Usman Roshan
CS 675
Machine Learning
HMM applications
• Determine coding and non-coding regions in DNA sequences
• Separating “bad” pixels from “good” ones in image files
• Classification of DNA sequences
Hidden Markov Models
• Alphabet of symbols:
• Set of states that emit symbols from the alphabet:
• Set of probabilities– State transition: – Emission probabilities:
Loaded die problem
Loaded die automata
F L
aFL
aLF
eF(i) eL(i)
aFF aLL
Loaded die problem
• Consider the following rolls:
Observed : 21665261
Underlying die : FFLLFLLF• What is the probability that the
underlying path generated the observed sequence?
HMM computational problems
Hidden sequence known
Hidden sequence unknown
Transition and emission probabilities known
Model fully specified
Viterbi to determine optimal hidden sequence
Transition and emission probabilities unknown
Maximum likelihood
Expected maximization and also known as Baum-Welch
Probabilities unknown but hidden sequence known
• Akl: number of transitions from state k to l
• Ek(b): number of times state k emits symbol b
Probabilities known but hidden sequence unknown
• Problem: Given an HMM and a sequence of rolls, find the most probably underlying generating path.
• Let be the sequence of rolls.• Let VF(i) denote the probability of the
most probable path of that ends in state F. (Define VL(i) similarly.)
Probabilities known but hidden sequence unknown
• Initialize:• Recurrence: for i=0..n-1
Probabilities and hidden sequence unknown
• Use Expected-Maximization algorithm (also known as EM algorithm)
• Very popular and many applications• For HMMs also called Baum-Welch algorithm• Outline:
1. Start with random assignment to transition and emission probabilities
2. Find expected transition and emission probabilities3. Estimate actual transition and emission probabilities from expected
values in previous step4. Go to step 2 if probabilities not converged
HMM forward probabilities• Consider the total probability of all hidden sequences under a given
HMM.
• Let fL(i) be the sum of the probabilities of all hidden sequences upto i that end in the state L.
• Then fL(i) is given by
• We calculate fF(i) in the same way.
• We call these forward probabilities: – f(i) = fL(i)+fF(i)+fB(i)
HMM backward probabilities
• Similarly we can calculate backward probabilties bL(i).
• Let bL(i) be the sum of the probabilities of all hidden sequences from i to the end that start in state L.
• Then bL(i) is given by
• We calculate bF(i) in the same way.
• We call these forward probabilities: – b(i) = bL(i)+bF(i)+bB(i)
Baum Welch
• How do we calculate expected transition and emission probabilities?
• Consider the fair-loaded die problem. What is the expected transition of fair (F) to loaded (L)?
• To answer we have to count the number of times F transitions to L in all possible hidden sequences and multiply each by the probability of the hidden sequence
Baum Welch
• For example suppose input is 12• What are the different hidden sequences?• What is the probability of each?• What is the total probability?• What is the probability of all hidden sequences
where the first state is F?• Can we determine these answers automatically
with forward and backward probabilities?
Baum WelchGeneral formula for expected number of transitionsfrom state k to l.
General formula for expected number of emissionsof b from state k.
Equations from Durbin et. al., 1998
Baum Welch
1. Initialize random values for all parameters
2. Calculate forward and backward probabilities
3. Calculate new model parameters
4. Did the new probabilities (parameters) change by more than 0.001? If yes goto step 2. Otherwise stop.