DOC PREVIEW
Stanford CS 262 - Lecture 6 Notes

This preview shows page 1-2-3 out of 9 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 9 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 9 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 9 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 9 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

CS262: Computational Genomics Hidden Markov Models, Evaluation and Variants Lecture 6 Notes 1. Evaluation What is the probability of a given sequence to be generated by any underlying sequence of states? - With evaluation we will find the likelihood of a sequence of being generated by a model. We will develop algorithms that allow us to compute: P(x) Probability of x given the model P(xi…xj) Probability of a substring of x given the model P(πi = k | x) “Posterior” probability that the ith state is k, given x 2. Forward Algorithm Dynamic programming implementation: fk(i) = P(x1…xi, πi = k) (the forward probability) Initialization: f0(0) = 1 fk(0) = 0, for all k > 0 Iteration: fk(i) = ek(xi) Σl fl(i – 1) alk Termination: P(x) = Σk fk(N) All previously posible states lCS262: Computational Genomics 3. Backward Algorithm What is the probability to go from x to the ith state or y to the ith state? What is the probability to go from the ith state to y? We don’t want all the possible sequences to generate x, but all those cases where we pass by the ith position. Thinking about the dishonest casino player. How can we prove that he used a loaded die at a particular point in time? In order to do this it is necessary to compute the probability distribution on the ith position, given x, P(πi = k | x) , which is the probability that a given position in the sequence has an underlying state. P (πi = k, x) = P(x1…xi, πi = k, xi+1…xN) = P(x1…xi, πi = k) P(xi+1…xN | x1…xi, πi = k) = P(x1…xi, πi = k) P(xi+1…xN | πi = k) Forward, fk(i) Backward, bk(i) The first probability is the forward probability fk(i), and the other probability will be the backward probability bk(i). Even though we start at the ith state, the backward algorithm doesn’t include p of emitthing the ith character in the sequence, it is contained in the forward probability. The backward algorithm is just the same as forward algorithm, but starting from the end, and doing the process all the way back. Its dynamic programming implementation is similar as well: Initialization: bk(N) = 1, for all k Iteration: bk(i) = Σl el(xi+1) akl bl(i+1) Termination: P(x) = Σl a0l el(x1) bl(1) X i y We say we have a fixed sequence length in mindCS262: Computational Genomics Avoiding underflows In the Forward and Backward AlgorithmsRescaling technique: At each few posirange of a floating point number. Wcan compute the final probability In Viterbi Sum of logs: Take the logarithms of all values. Then, we canek(xi) + maxk [ Vk(i-1) + log akl ], so we take themultiplication of probabilities. Comparative Table Forward and Backward Algorithms each few positions, we multiply by a constant to keep the values within number. We must keep track of the constants we multiplied by so we can compute the final probability when it is required. ake the logarithms of all values. Then, we can rewrite each for Vl(i) as V], so we take the sum of the logarithms instead of the Running Time and space of Forward and Backward algorithms: Time: O(K2N) Space: O(KN) tions, we multiply by a constant to keep the values within track of the constants we multiplied by so we (i) as Vl(i) = log theCS262: Computational Genomics 4. Posterior decoding Previously, with Viterbi Algorithm we had one way to decide the underlying sequence of states given a sequence, posterior decoding is an alternative decoding method to Viterbi parsing. This alternative method consists in asking at each position, independently, what is the most likely state that will give us the character at determined position of the sequence. Thinking about the dishonest casino player. We would like to know what is the most likely state that produced each roll, that is, we want to know if it was a loaded or fair die the one that was used. In a summarized way: We use the formula: fk(i) bk(i) P(πi = k | x) = ––––––– P(x) Which means that the probability that the ith state has a specific value k, given the whole observed sequence x, is equal to (the forward state value (i) times the backward state value (i)) divided by the probability(x) Deriving P(πi = k | x) in the following way: P(πi = k | x) = P(πi = k , x)/P(x) = P(x1, …, xi, πi = k, xi+1, … xn) / P(x) = = P(x1, …, xi, πi = k) P(xi+1, … xn | πi = k) / P(x) = = fk(i) bk(i) / P(x) Posterior decoding: tells the most likely state at each particular position. Viterbi: tells the most likely whole sequences of states.CS262: Computational Genomics As shown in the following figure, were we can see what is being done when computing posterior decoding. Define π^ by posterior decoding: π ^i = argmaxk P(πi = k | x) Posterior Decoding gives us a curve of likelihood of state for each position, that is sometimes more informative than Viterbi path π*. But Posterior Decoding may give an invalid sequence of states (of prob 0) For example: State Emmision Letter: probability Transition State:probability A 0:100% C:1% Bi 0:99% 2:1% D:1% C 1:100% A:100% D 1:100% B:100% *Having i number of B states, 0<i<10000 and an initial equal probability between all states. Given the sequence: 0000000…..010…..000000000 Viterbi will give> AAAAAA…ACA….AAAA Posterior Decoding will give> BBBBBBB…BDB….DDDDCS262: Computational Genomics Variants of HMMs 5. Higher-order HMMs So far, in HMM each state depends on the previous state only, and the output character depends on the current state only. But what if we want to consider more states on the output character? Thinking about the dishonest casino player. He wants to avoid switching the die if he had just changed it in the previous turn, doing this in order to not get caught so easily. Or maybe, a lot of 6s have been shown, but as he doesn’t want to get caught, he wants to switch the die to not make it that obvious. This is the case where we want to use higher order HMMs. In the case of a 2nd order HMM, it is dependent on the current state and the previous state too. P(πi+1 = l | πi = k, πi -1 = j) It is possible to convert a 2nd order HMM with K states to an equivalent 1st order HMM with K2 states. Here is the example applied in a series of coin flips, having the 2nd order HMM at the left, and the 1st order HMM at the right.


View Full Document

Stanford CS 262 - Lecture 6 Notes

Documents in this Course
Lecture 8

Lecture 8

38 pages

Lecture 7

Lecture 7

27 pages

Lecture 4

Lecture 4

12 pages

Lecture 1

Lecture 1

11 pages

Biology

Biology

54 pages

Lecture 7

Lecture 7

45 pages

Load more
Download Lecture 6 Notes
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Lecture 6 Notes and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lecture 6 Notes 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?