Presentation is loading. Please wait.

Presentation is loading. Please wait.

Slide 1 EE3J2 Data Mining EE3J2 Data Mining Lecture 14: Introduction to Hidden Markov Models Martin Russell.

Similar presentations


Presentation on theme: "Slide 1 EE3J2 Data Mining EE3J2 Data Mining Lecture 14: Introduction to Hidden Markov Models Martin Russell."— Presentation transcript:

1 Slide 1 EE3J2 Data Mining EE3J2 Data Mining Lecture 14: Introduction to Hidden Markov Models Martin Russell

2 Slide 2 EE3J2 Data Mining Objectives  Limitations of sequence matching  Introduction to hidden Markov models (HMMs)

3 Slide 3 EE3J2 Data Mining Sequence retrieval using DP …… AAGDTDTDTDD AABBCBDAAAAAAA BABABABBCCDF GGGGDDGDGDGDGDTDTD DGDGDGDGD AABCDTAABCDTAABCDTAAB CDCDCDTGGG GGAACDTGGGGGAAA ……. Corpus of sequential data ‘query’ sequence Q …BBCCDDDGDGDGDCDTCDTTDCCC… Dynamic Programming Distance Calculation Calculate ad(S,Q) for each sequence S in corpus

4 Slide 4 EE3J2 Data Mining Limitations of ‘template matching’  This type of analysis is sometimes referred to as template matching  The ‘templates’ are the sequences in the corpus  Can think of each template as representing a ‘class’  Problem is to determine which class best fits the query  Performance will depend on precisely which template is used to represent the class

5 Slide 5 EE3J2 Data Mining Alternative path shapes  The basic units of path considered so far are: substitutioninsertiondeletion  Others are possible and may have advantages, e.g: substitutioninsertiondeletion

6 Slide 6 EE3J2 Data Mining Example

7 Slide 7 EE3J2 Data Mining Hidden Markov Models (HMMs)  One solution is to replace the individual template sequence with an ‘average’ sequence  But what is an ‘average sequence’?  One solution is to use a type of statistical model called a Hidden Markov Model

8 Slide 8 EE3J2 Data Mining HMMs  Suppose the following sequences are in same class: –ABC, YBBC, ABXC, AZ  Compute alignments: Y B B C A B C A B X C A B C A Z A B C

9 Slide 9 EE3J2 Data Mining Finite State Network Representation  The sequence consists of 3 ‘states’ –First state is ‘realised’ as A (twice) or Y (once) –Second state ‘realised’ as B (three times) or X (once) –Second state can be repeated or deleted –Third state can be ‘realised’ as C (twice) or Z (once)

10 Slide 10 EE3J2 Data Mining Network representation  Directed graph representation  Each state associated with a set of probabilities –Called the ‘state emission’ probabilities

11 Slide 11 EE3J2 Data Mining Transition probabilities  Transition probabilities control insertions and deletions of symbols 1 1 0.67 0.33 0.5 a jk =Prob(state k follows state j) Basic rule for drawing transition networks: Connect state j to state k if a jk > 0

12 Slide 12 EE3J2 Data Mining Formal Definition  A Hidden Markov Model (HMM) for the symbols  1,  2, …,  K consists of: –A number of states N –An N  N state transition probability matrix A –For each state k a set of probabilities p k (  1 ), …, p(  K ) - p(  k ) is the probability that  k occurs for state k

13 Slide 13 EE3J2 Data Mining Alignment paths for HMMs  For HMMs, alignment paths are called state sequences Y A B B B X B C A B C

14 Slide 14 EE3J2 Data Mining State-symbol trellis Y A B B B X B C A B C Rule: connect state j at symbol m with state k at symbol m+1 if a jk > 0

15 Slide 15 EE3J2 Data Mining More examples

16 Slide 16 EE3J2 Data Mining Dynamic Programming Y A B B B X B C A B C

17 Slide 17 EE3J2 Data Mining Formal Definition  A Hidden Markov Model (HMM) for the symbols  1,  2, …,  K consists of: –A number of states N –An N  N state transition probability matrix A –For each state k a set of probabilities p k (  1 ), …, p(  K ) - p(  k ) is the probability that  k occurs for state k

18 Slide 18 EE3J2 Data Mining Alignment paths for HMMs  For HMMs, alignment paths are called state sequences Y A B B B X B C A B C State sequence 

19 Slide 19 EE3J2 Data Mining The optimal state sequence  Let M be a HMM and s a sequence  Probability on previous slide depends on the state sequence  and the model, so we write:  By analogy with dynamic programming, the optimal state sequence is the sequence such that:

20 Slide 20 EE3J2 Data Mining Computing the optimal state sequence: The ‘state-symbol’ trellis Y A B B B X B C A B C Rule: connect state j at symbol m with state k at symbol m+1 if a jk > 0

21 Slide 21 EE3J2 Data Mining More examples

22 Slide 22 EE3J2 Data Mining Dynamic Programming a.k.a Viterbi Decoding Y A B B B X B C A B C k 4 K

23 Slide 23 EE3J2 Data Mining Sequence retrieval using HMMs Corpus of pre- build HMMs ‘query’ sequence Q …BBCCDDDGDGDGDCDTCDTTDCCC… Viterbi Decoding Calculate p(Q|M) for each HMM M in corpus

24 Slide 24 EE3J2 Data Mining

25 Slide 25 EE3J2 Data Mining

26 Slide 26 EE3J2 Data Mining

27 Slide 27 EE3J2 Data Mining

28 Slide 28 EE3J2 Data Mining HMM Construction  Suppose we have a set of HMMs, each representing a different class (e.g. protein sequence)  Given an unknown sequence s: –Use Viterbi decoding to compare s with each HMM –Compute  But how do we obtain the HMM in the first place?

29 Slide 29 EE3J2 Data Mining HMM training  Given a set of example sequences S a HMM M can be built such that p(S|M) is locally maximised  Procedure is as follows: –Obtain an initial estimate of a suitable model M 0 –Apply an algorithm – the ‘Baum-Welch’ algorithm – to obtain a new model M 1 such that p(S|M 1 ) ≥ p(S|M 0 ) –Repeat to produce a sequence of HMMs M 0, M 1,…,M n with: p(S|M 0 ) ≤ p(S|M 1 ) ≤ p(S|M 2 ) ≤… ≤ p(S|M n )

30 Slide 30 EE3J2 Data Mining Local optimality M 0 M 1 …M n P(S|M) Local maximum Global maximum

31 Slide 31 EE3J2 Data Mining Summary  Hidden Markov Models  Importance of HMMs for sequence matching  Viterbi decoding  HMM training

32 Slide 32 EE3J2 Data Mining Summary  Review of template matching  Hidden Markov Models  Dynamic programming for HMMs


Download ppt "Slide 1 EE3J2 Data Mining EE3J2 Data Mining Lecture 14: Introduction to Hidden Markov Models Martin Russell."

Similar presentations


Ads by Google