Time Warping Hidden Markov Models Lecture 2, Thursday April 3, 2003.

Slides:



Advertisements
Similar presentations
Pair-HMMs and CRFs Chuong B. Do CS262, Winter 2009 Lecture #8.
Advertisements

Marjolijn Elsinga & Elze de Groot1 Markov Chains and Hidden Markov Models Marjolijn Elsinga & Elze de Groot.
Hidden Markov Model.
Gapped Blast and PSI BLAST Basic Local Alignment Search Tool ~Sean Boyle Basic Local Alignment Search Tool ~Sean Boyle.
Rolling Dice Data Analysis - Hidden Markov Model Danielle Tan Haolin Zhu.
Lecture 8: Hidden Markov Models (HMMs) Michael Gutkin Shlomi Haba Prepared by Originally presented at Yaakov Stein’s DSPCSP Seminar, spring 2002 Modified.
Bioinformatics Hidden Markov Models. Markov Random Processes n A random sequence has the Markov property if its distribution is determined solely by its.
Hidden Markov Models.
 CpG is a pair of nucleotides C and G, appearing successively, in this order, along one DNA strand.  CpG islands are particular short subsequences in.
Patterns, Profiles, and Multiple Alignment.
Hidden Markov Models Modified from:
Statistical NLP: Lecture 11
Hidden Markov Models Theory By Johan Walters (SR 2003)
Hidden Markov Model Most pages of the slides are from lecture notes from Prof. Serafim Batzoglou’s course in Stanford: CS 262: Computational Genomics (Winter.
1 Hidden Markov Models (HMMs) Probabilistic Automata Ubiquitous in Speech/Speaker Recognition/Verification Suitable for modelling phenomena which are dynamic.
Hidden Markov Models 1 2 K … 1 2 K … 1 2 K … … … … 1 2 K … x1x1 x2x2 x3x3 xKxK 2 1 K 2.
CpG islands in DNA sequences
Heuristic Local Alignerers 1.The basic indexing & extension technique 2.Indexing: techniques to improve sensitivity Pairs of Words, Patterns 3.Systems.
Linear-Space Alignment. Subsequences and Substrings Definition A string x’ is a substring of a string x, if x = ux’v for some prefix string u and suffix.
Lecture 6, Thursday April 17, 2003
Hidden Markov Models. Two learning scenarios 1.Estimation when the “right answer” is known Examples: GIVEN:a genomic region x = x 1 …x 1,000,000 where.
Hidden Markov Models. Decoding GIVEN x = x 1 x 2 ……x N We want to find  =  1, ……,  N, such that P[ x,  ] is maximized  * = argmax  P[ x,  ] We.
Hidden Markov Models. Two learning scenarios 1.Estimation when the “right answer” is known Examples: GIVEN:a genomic region x = x 1 …x 1,000,000 where.
Hidden Markov Models Lecture 6, Thursday April 17, 2003.
Hidden Markov Models Lecture 5, Tuesday April 15, 2003.
Hidden Markov Models 1 2 K … 1 2 K … 1 2 K … … … … 1 2 K … x1x1 x2x2 x3x3 xKxK 2 1 K 2.
Hidden Markov Models 1 2 K … 1 2 K … 1 2 K … … … … 1 2 K … x1x1 x2x2 x3x3 xKxK 2 1 K 2.
Linear-Space Alignment. Linear-space alignment Using 2 columns of space, we can compute for k = 1…M, F(M/2, k), F r (M/2, N – k) PLUS the backpointers.
CpG islands in DNA sequences
Hidden Markov Models Lecture 5, Tuesday April 15, 2003.
Sequence Alignment Cont’d. Needleman-Wunsch with affine gaps Initialization:V(i, 0) = d + (i – 1)  e V(0, j) = d + (j – 1)  e Iteration: V(i, j) = max{
Hidden Markov Models 1 2 K … 1 2 K … 1 2 K … … … … 1 2 K … x1x1 x2x2 x3x3 xKxK 2 1 K 2.
Hidden Markov Models K 1 … 2. Outline Hidden Markov Models – Formalism The Three Basic Problems of HMMs Solutions Applications of HMMs for Automatic Speech.
Hidden Markov Models Usman Roshan BNFO 601. Hidden Markov Models Alphabet of symbols: Set of states that emit symbols from the alphabet: Set of probabilities.
Hidden Markov Models—Variants Conditional Random Fields 1 2 K … 1 2 K … 1 2 K … … … … 1 2 K … x1x1 x2x2 x3x3 xKxK 2 1 K 2.
Hidden Markov Models 1 2 K … x1 x2 x3 xK.
Bioinformatics Hidden Markov Models. Markov Random Processes n A random sequence has the Markov property if its distribution is determined solely by its.
Hidden Markov Models 1 2 K … 1 2 K … 1 2 K … … … … 1 2 K … x1x1 x2x2 x3x3 xKxK 2 1 K 2.
Hidden Markov Models Usman Roshan BNFO 601. Hidden Markov Models Alphabet of symbols: Set of states that emit symbols from the alphabet: Set of probabilities.
Sequence Alignment Cont’d. Linear-space alignment Iterate this procedure to the left and right! N-k * M/2 k*k*
Hidden Markov Models.
Hidden Markov Models 1 2 K … 1 2 K … 1 2 K … … … … 1 2 K … x1x1 x2x2 x3x3 xKxK 2 1 K 2.
CS262 Lecture 4, Win07, Batzoglou Heuristic Local Alignerers 1.The basic indexing & extension technique 2.Indexing: techniques to improve sensitivity Pairs.
Doug Downey, adapted from Bryan Pardo,Northwestern University
Hidden Markov Models (HMMs) for Information Extraction
Hidden Markov models Sushmita Roy BMI/CS 576 Oct 16 th, 2014.
Sequence Alignment Cont’d. CS262 Lecture 4, Win06, Batzoglou Indexing-based local alignment (BLAST- Basic Local Alignment Search Tool) 1.SEED Construct.
CS262 Lecture 5, Win07, Batzoglou Hidden Markov Models 1 2 K … 1 2 K … 1 2 K … … … … 1 2 K … x1x1 x2x2 x3x3 xKxK 2 1 K 2.
Dishonest Casino Let’s take a look at a casino that uses a fair die most of the time, but occasionally changes it to a loaded die. This model is hidden.
1 Markov Chains. 2 Hidden Markov Models 3 Review Markov Chain can solve the CpG island finding problem Positive model, negative model Length? Solution:
BINF6201/8201 Hidden Markov Models for Sequence Analysis
Gapped BLAST and PSI- BLAST: a new generation of protein database search programs By Stephen F. Altschul, Thomas L. Madden, Alejandro A. Schäffer, Jinghui.
Hidden Markov Models 1 2 K … 1 2 K … 1 2 K … … … … 1 2 K … x1x1 x2x2 x3x3 xKxK 2 1 K 2.
Motif finding with Gibbs sampling CS 466 Saurabh Sinha.
Hidden Markov Models Yves Moreau Katholieke Universiteit Leuven.
Hidden Markov Models Usman Roshan CS 675 Machine Learning.
CS5263 Bioinformatics Lecture 10: Markov Chain and Hidden Markov Models.
PGM 2003/04 Tirgul 2 Hidden Markov Models. Introduction Hidden Markov Models (HMM) are one of the most common form of probabilistic graphical models,
Hidden Markov Models 1 2 K … 1 2 K … 1 2 K … … … … 1 2 K … x1x1 x2x2 x3x3 xKxK 2 1 K 2.
Advanced Algorithms and Models for Computational Biology -- a machine learning approach Computational Genomics II: Sequence Modeling & Gene Finding with.
Algorithms in Computational Biology11Department of Mathematics & Computer Science Algorithms in Computational Biology Markov Chains and Hidden Markov Model.
John Lafferty Andrew McCallum Fernando Pereira
Eric Xing © Eric CMU, Machine Learning Mixture Model, HMM, and Expectation Maximization Eric Xing Lecture 9, August 14, 2010 Reading:
ECE 8443 – Pattern Recognition ECE 8527 – Introduction to Machine Learning and Pattern Recognition Objectives: Reestimation Equations Continuous Distributions.
Eric Xing © Eric CMU, Machine Learning Structured Models: Hidden Markov Models versus Conditional Random Fields Eric Xing Lecture 13,
Hidden Markov Models. A Hidden Markov Model consists of 1.A sequence of states {X t |t  T } = {X 1, X 2,..., X T }, and 2.A sequence of observations.
Definition of the Hidden Markov Model A Seminar Speech Recognition presentation A Seminar Speech Recognition presentation October 24 th 2002 Pieter Bas.
Hidden Markov Models – Concepts 1 2 K … 1 2 K … 1 2 K … … … … 1 2 K … x1x1 x2x2 x3x3 xKxK 2 1 K 2.
CSCI2950-C Lecture 2 September 11, Comparative Genomic Hybridization (CGH) Measuring Mutations in Cancer.
Hidden Markov Model ..
Presentation transcript:

Time Warping Hidden Markov Models Lecture 2, Thursday April 3, 2003

Review of Last Lecture Lecture 2, Thursday April 3, 2003

Lecture 4, Thursday April 10, 2003 The Four-Russian Algorithm t t t

Lecture 4, Thursday April 10, 2003 BLAST  Original Version Dictionary: All words of length k (~11) Alignment initiated between words of alignment score  T (typically T = k) Alignment: Ungapped extensions until score below statistical threshold Output: All local alignments with score > statistical threshold …… query DB query scan

Lecture 4, Thursday April 10, 2003 PatternHunter Main features: Non-consecutive position words Highly optimized 5 hits 3 hits 7 hits Consecutive PositionsNon-Consecutive Positions 6 hits On a 70% conserved region: Consecutive Non-consecutive Expected # hits: Prob[at least one hit]:

Lecture 4, Thursday April 10, 2003 Today Time Warping Hidden Markov models

Lecture 4, Thursday April 10, 2003 Time Warping

Lecture 4, Thursday April 10, 2003 Time Warping Align and compare two trajectories in multi-D space  (t)  (t) Additive random error Variations in speed from one segment to another

Lecture 4, Thursday April 10, 2003 Time Warping Definition:  (u),  (u) are connected by an approximate continuous time warping (u 0, v 0 ), if: u 0, v 0 are strictly increasing functions on [0, T], and  (u 0 (t))   (v 0 (t))for 0  t  T  (t)  (t) 0 T u 0 (t) v 0 (t)

Lecture 4, Thursday April 10, 2003 Time Warping How do we measure how “good” a time warping is? Let’s try:  0 T w(  (u 0 (t)),  (v 0 (t)) ) dt However, an equivalent time warping ( u 1 (s), v 1 (s) ), is given by: s = f(t);f: [0, T]  [0, S] has score  0 S w(  (u 1 (s)),  (v 1 (s)) ) ds =  0 T w(  (u 0 (t)),  (v 0 (t)) ) f’(t) dt This is arbitrarily different

Lecture 4, Thursday April 10, 2003 Time Warping This one works: d( u 0, v 0 ) =  0 T w(  (u 0 (t)),  (v 0 (t)) ) [(u’ 0 (t) + v’ 0 (t))/2] dt Now, if s = f(t); t = g(s), and g = f -1,  0 S w(  (u 1 (s)),  (v 1 (s)) ) (u’ 1 (s) + v’ 1 (s))/2 ds = f(t) = f(g(s)) = s; f’(t) = f’(g(s)) g’(s) = 1, therefore g’(s) = 1/f’(t) u 0 (t) = u 0 (g(s)), therefore u’ 0 (t) = u’ 0 (g(s)) g’(s)  0 T w(  (u 0 (t)),  (v 0 (t)) ) (u’ 0 (t)+v’ 0 (t))/2 g’(s) f’(t) dt =  0 T w(  (u 0 (t)),  (v 0 (t)) ) [(u’ 0 (t) + v’ 0 (t))/2] dt

Lecture 4, Thursday April 10, 2003 Time Warping From continuous to discrete: Let’s discretize the signals:  (t):a = a 0 ……a M  (t):b = b 0 ……b N Definition: a, b are connected by an approximate discrete time warping (u, v), if u and v are weakly increasing integer functions on 1  h  H, such that a u[h]  b v[h] for all h = 1……H Moreover, we require u[0] = v[0] = 0; u[H] = M; v[h] = N

Lecture 4, Thursday April 10, 2003 Time Warping v u M N Define possible steps: (  u,  v) is the possible difference of u and v between steps h-1 and h (1, 0) (  u,  v) = (1, 1) (0, 1)

Lecture 4, Thursday April 10, 2003 Time Warping Alternatively: (2, 0) (  u,  v) = (1, 1) (0, 2) Advantage: Every time warp has the same number of steps possible position at h (0, 2) possible position at h (1, 1) position at h-1 possible position at h (2, 0)

Lecture 4, Thursday April 10, 2003 Time Warping Discrete objective function: For 0  i = u[h]  M; 0  j = v[h]  N, Define w(i, j) = w( a u[h], b v[h] ) Then, D(u, v) =  h w(u[h], v[h]) (  u +  v )/2 In the case where we allow (2, 0), (1, 1), and (0, 2) steps, D(u, v) =  h w(u[h], v[h])

Lecture 4, Thursday April 10, 2003 Time Warping Algorithm for optimal discrete time warping: Initialization: D(i, 0) = ½  i’<i w(i, 0) D(0, j) = ½  j’<j w(0, j) D(1, j) = D(i, 1) = w(i, j) + w(i-1, j-1) Iteration: For i = 2……M For j = 2……N D(i – 2, j) + w(i, j) D(i, j) = minD(i – 1, j – 1) + w(i, j) D(i – 2, j) + w(i, j)

Hidden Markov Models 1 2 K … 1 2 K … 1 2 K … … … … 1 2 K … x1x1 x2x2 x3x3 xKxK 2 1 K 2

Lecture 4, Thursday April 10, 2003 Outline for our next topic Hidden Markov models – the theory Probabilistic interpretation of alignments using HMMs Later in the course: Applications of HMMs to biological sequence modeling and discovery of features such as genes

Lecture 4, Thursday April 10, 2003 Example: The Dishonest Casino A casino has two dice: Fair die P(1) = P(2) = P(3) = P(5) = P(6) = 1/6 Loaded die P(1) = P(2) = P(3) = P(5) = 1/10 P(6) = 1/2 Casino player switches back-&-forth between fair and loaded die once every 20 turns Game: 1.You bet $1 2.You roll (always with a fair die) 3.Casino player rolls (maybe with fair die, maybe with loaded die) 4.Highest number wins $2

Lecture 4, Thursday April 10, 2003 Question # 1 – Evaluation GIVEN A sequence of rolls by the casino player QUESTION How likely is this sequence, given our model of how the casino works? This is the EVALUATION problem in HMMs

Lecture 4, Thursday April 10, 2003 Question # 2 – Decoding GIVEN A sequence of rolls by the casino player QUESTION What portion of the sequence was generated with the fair die, and what portion with the loaded die? This is the DECODING question in HMMs

Lecture 4, Thursday April 10, 2003 Question # 3 – Learning GIVEN A sequence of rolls by the casino player QUESTION How “loaded” is the loaded die? How “fair” is the fair die? How often does the casino player change from fair to loaded, and back? This is the LEARNING question in HMMs

Lecture 4, Thursday April 10, 2003 The dishonest casino model FAIRLOADED P(1|F) = 1/6 P(2|F) = 1/6 P(3|F) = 1/6 P(4|F) = 1/6 P(5|F) = 1/6 P(6|F) = 1/6 P(1|L) = 1/10 P(2|L) = 1/10 P(3|L) = 1/10 P(4|L) = 1/10 P(5|L) = 1/10 P(6|L) = 1/2

Lecture 4, Thursday April 10, 2003 Definition of a hidden Markov model Definition: A hidden Markov model (HMM) Alphabet  = { b 1, b 2, …, b M } Set of states Q = { 1,..., K } Transition probabilities between any two states a ij = transition prob from state i to state j a i1 + … + a iK = 1, for all states i = 1…K Start probabilities a 0i a 01 + … + a 0K = 1 Emission probabilities within each state e i (b) = P( x i = b |  i = k) e i (b 1 ) + … + e i (b M ) = 1, for all states i = 1…K K 1 … 2

Lecture 4, Thursday April 10, 2003 A Hidden Markov Model is memory-less At each time step t, the only thing that affects future states is the current state  t P(  t+1 =k | “whatever happened so far”) = P(  t+1 =k |  1,  2, …,  t, x 1, x 2, …, x t )= P(  t+1 =k |  t ) K 1 … 2

Lecture 4, Thursday April 10, 2003 A parse of a sequence Given a sequence x = x 1 ……x N, A parse of x is a sequence of states  =  1, ……,  N 1 2 K … 1 2 K … 1 2 K … … … … 1 2 K … x1x1 x2x2 x3x3 xKxK 2 1 K 2

Lecture 4, Thursday April 10, 2003 Likelihood of a parse Given a sequence x = x 1 ……x N and a parse  =  1, ……,  N, To find how likely is the parse: (given our HMM) P(x,  ) = P(x 1, …, x N,  1, ……,  N ) = P(x N,  N |  N-1 ) P(x N-1,  N-1 |  N-2 )……P(x 2,  2 |  1 ) P(x 1,  1 ) = P(x N |  N ) P(  N |  N-1 ) ……P(x 2 |  2 ) P(  2 |  1 ) P(x 1 |  1 ) P(  1 ) = a 0  1 a  1  2 ……a  N-1  N e  1 (x 1 )……e  N (x N ) 1 2 K … 1 2 K … 1 2 K … … … … 1 2 K … x1x1 x2x2 x3x3 xKxK 2 1 K 2

Lecture 4, Thursday April 10, 2003 Example: the dishonest casino Let the sequence of rolls be: x = 1, 2, 1, 5, 6, 2, 1, 6, 2, 4 Then, what is the likelihood of  = Fair, Fair, Fair, Fair, Fair, Fair, Fair, Fair, Fair, Fair? (say initial probs a 0Fair = ½, a oLoaded = ½) ½  P(1 | Fair) P(Fair | Fair) P(2 | Fair) P(Fair | Fair) … P(4 | Fair) = ½  (1/6) 10  (0.95) 9 = = 0.5  10 -9

Lecture 4, Thursday April 10, 2003 Example: the dishonest casino So, the likelihood the die is fair in all this run is just  OK, but what is the likelihood of  = Loaded, Loaded, Loaded, Loaded, Loaded, Loaded, Loaded, Loaded, Loaded, Loaded? ½  P(1 | Loaded) P(Loaded, Loaded) … P(4 | Loaded) = ½  (1/10) 8  (1/2) 2 (0.95) 9 = = 7.9  Therefore, it is after all 6.59 times more likely that the die is fair all the way, than that it is loaded all the way.

Lecture 4, Thursday April 10, 2003 Example: the dishonest casino Let the sequence of rolls be: x = 1, 6, 6, 5, 6, 2, 6, 6, 3, 6 Now, what is the likelihood  = F, F, …, F? ½  (1/6) 10  (0.95) 9 = 0.5  10 -9, same as before What is the likelihood  = L, L, …, L? ½  (1/10) 4  (1/2) 6 (0.95) 9 = = 0.5  So, it is 100 times more likely the die is loaded

Lecture 4, Thursday April 10, 2003 The three main questions on HMMs 1.Evaluation GIVEN a HMM M, and a sequence x, FIND Prob[ x | M ] 2.Decoding GIVENa HMM M, and a sequence x, FINDthe sequence  of states that maximizes P[ x,  | M ] 3.Learning GIVENa HMM M, with unspecified transition/emission probs., and a sequence x, FINDparameters  = (e i (.), a ij ) that maximize P[ x |  ]

Lecture 4, Thursday April 10, 2003 Let’s not be confused by notation P[ x | M ]: The probability that sequence x was generated by the model The model is: architecture (#states, etc) + parameters  = a ij, e i (.) So, P[ x |  ], and P[ x ] are the same, when the architecture, and the entire model, respectively, are implied Similarly, P[ x,  | M ] and P[ x,  ] are the same In the LEARNING problem we always write P[ x |  ] to emphasize that we are seeking the  that maximizes P[ x |  ]