Natural Language Processing

Size: px
Start display at page:

Download "Natural Language Processing"

Transcription

1 SFU NatLangLab Natural Language Processing Anoop Sarkar anoopsarkar.github.io/nlp-class Simon Fraser University October 20,

2 Natural Language Processing Anoop Sarkar anoopsarkar.github.io/nlp-class Simon Fraser University Part 1: Introducing Hidden Markov Models 1

3 Modelling pairs of sequences Input: sequence of words; Output: sequence of labels Input British left waffles on Falkland Islands Output1 N N V P N N Output2 N V N P N N. N Noun, e.g. islands V Verb, e.g. leave, left P Preposition, e.g. on 2

4 Modelling pairs of sequences Input: sequence of words; Output: sequence of labels Input British left waffles on Falkland Islands Output1 N N V P N N Output2 N V N P N N. 3 states: S = {N, V, P} Input sequence: x 1, x 2,..., x n Output sequence: t 1, t 2,..., t n where t i S How many output sequences? S n 3

5 Modelling pairs of sequences Input: sequence of characters; Output: sequence of labels Input 北京大学生比赛 7 chars Output1 BIBIIBI 7 labels Output2 BIIIBBI 7 labels. 7 labels B Begin word I Inside word BIBIIBI 北京 大学生 比赛 (Beijing student competition) BIIIBBI 北京大学 生 比赛 (Peking University Health Competition) 4

6 Hidden Markov Models Input: x Output space: Y(x) Output: y Y(x) We want to learn a function f such that f (x) = y 5

7 Hidden Markov Models Conditional model Construct function f using a conditional probability: f (x) = arg max p(y x) y Y(x) We can construct this function f using two principles: Discriminative learning: find the best output y given input x Generative modelling: model the joint probability p(x, y) to find p(y x) 6

8 Hidden Markov Models Generative Model Start from the joint probability p(x, y): p(x, y) = p(y)p(x y) Also: p(x, y) = p(x)p(y x) Bayes Rule: p(y x) = p(y)p(x y) p(x) 7

9 Hidden Markov Models Generative Model Bayes Rule: where: p(x) = p(y x) = y Y(x) p(x, y) = p(y)p(x y) p(x) y Y(x) p(y)p(x y) So using a generative model, we can find the best output y using: p(y)p(x y) p(y x) = p(y)p(x y) y Y(x) 8

10 Natural Language Processing Anoop Sarkar anoopsarkar.github.io/nlp-class Simon Fraser University Part 2: Algorithms for Hidden Markov Models 9

11 Hidden Markov Model π i Model θ = a i,j b i (o) p(i): starting at state i p(j i): transition to state i from state j p(o i): output o at state i 10

12 Hidden Markov Model Algorithms HMM as parser: compute the best sequence of states for a given observation sequence. HMM as language model: compute probability of given observation sequence. HMM as learner: given a corpus of observation sequences, learn its distribution, i.e. learn the parameters of the HMM from the corpus. Learning from a set of observations with the sequence of states provided (states are not hidden) [Supervised Learning] Learning from a set of observations without any state information. [Unsupervised Learning] 11

13 HMM as Parser π = A 0.25 N 0.75 a = a i,j A N A N b = b i (o) clown killer problem crazy A N The task: for a given observation sequence find the most likely state sequence. a i,j = p(j i) and b i (o) = p(o i) 12

14 HMM as Parser Find most likely sequence of states for killer clown Score every possible sequence of states: AA, AN, NN, NA P(killer clown, AA) = πa b A (killer) a A,A b A (clown) = 0.0 P(killer clown, AN) = πa b A (killer) a A,N b N (clown) = 0.0 P(killer clown, NN) = π N b N (killer) a N,N b N (clown) = = P(killer clown, NA) = π N b N (killer) a N,A b A (clown) = 0.0 Pick the state sequence with highest probability (NN=0.045). 13

15 HMM as Parser As we have seen, for input of length 2, and a HMM with 2 states there are 2 2 possible state sequences. In general, if we have q states and input of length T there are q T possible state sequences. Using our example HMM, for input killer crazy clown problem we will have 2 4 possible state sequences to score. Our naive algorithm takes exponential time to find the best state sequence for a given input. The Viterbi algorithm uses dynamic programming to provide the best state sequence with a time complexity of q 2 T 14

16 Natural Language Processing Anoop Sarkar anoopsarkar.github.io/nlp-class Simon Fraser University Part 3: Viterbi Algorithm for HMMs 15

17 Viterbi Algorithm for HMMs For input of length T : o 1,..., o T, we want to find the sequence of states s 1,..., s T Each s t in this sequence is one of the states in the HMM. So the task is to find the most likely sequence of states: arg max s 1,...,s T P(o 1,..., o T, s 1,..., s T ) The Viterbi algorithm solves this by creating a table V [s, t] where s is one of the states, and t is an index between 1,..., T. 16

18 Viterbi Algorithm for HMMs Consider the input killer crazy clown problem So the task is to find the most likely sequence of states: arg max P(killer crazy clown problem, s 1, s 2, s 3, s 4 ) s 1,s 2,s 3,s 4 A sub-problem is to find the most likely sequence of states for killer crazy clown: arg max s 1,s 2,s 3 P(killer crazy clown, s 1, s 2, s 3 ) 17

19 Viterbi Algorithm for HMMs In our example there are two possible values for s 4 : max P(killer crazy clown problem, s 1, s 2, s 3, s 4 ) = s 1,...,s 4 { max max P(killer crazy clown problem, s 1, s 2, s 3, N), s 1,s 2,s 3 } max P(killer crazy clown problem, s 1, s 2, s 3, A) s 1,s 2,s 3 Similarly: max P(killer crazy clown, s 1, s 2, s 3 ) = s 1,...,s 3 { max max P(killer crazy clown, s 1, s 2, N), s 1,s 2 } max P(killer crazy clown, s 1, s 2, A) s 1,s 2 18

20 Viterbi Algorithm for HMMs Putting them together: P(killer crazy clown problem, s 1, s 2, s 3, N) = max {P(killer crazy clown, s 1, s 2, N) a N,N b N (problem), P(killer crazy clown, s 1, s 2, A) a A,N b N (problem)} P(killer crazy clown problem, s 1, s 2, s 3, A) = max {P(killer crazy clown, s 1, s 2, N) a N,A b A (problem), P(killer crazy clown, s 1, s 2, A) a A,A b A (problem)} The best score is given by: max P(killer crazy clown problem, s 1, s 2, s 3, s 4 ) = s 1,...,s 4 { max max P(killer crazy clown problem, s 1, s 2, s 3, N), N,A s 1,s 2,s 3 } max P(killer crazy clown problem, s 1, s 2, s 3, A) s 1,s 2,s 3 19

21 Viterbi Algorithm for HMMs Provide an index for each input symbol: 1:killer 2:crazy 3:clown 4:problem V [N, 3] = max P(killer crazy clown, s 1, s 2, N) s 1,s 2 V [N, 4] = max P(killer crazy clown problem, s 1, s 2, s 3, N) s 1,s 2,s 3 Putting them together: V [N, 4] = max {V [N, 3] a N,N b N (problem), V [A, 3] a A,N b N (problem)} V [A, 4] = max {V [N, 3] a N,A b A (problem), V [A, 3] a A,A b A (problem)} The best score for the input is given by: max {V [N, 4], V [A, 4]} To extract the best sequence of states we backtrack (same trick as obtaining alignments from minimum edit distance) 20

22 Viterbi Algorithm for HMMs For input of length T : o 1,..., o T, we want to find the sequence of states s 1,..., s T Each s t in this sequence is one of the states in the HMM. For each state q we initialize our table: V [q, 1] = π q b q (o 1 ) Then compute for t = 1... T 1 for each state q: V [q, t + 1] = max q { V [q, t] a q,q b q (o t+1 ) } After the loop terminates, the best score is max q V [q, T ] 21

23 Learning from Fully Observed Data π = A 0.25 N 0.75 a = a i,j A N A N b = b i (o) clown killer problem crazy A N Viterbi algorithm: V killer:1 crazy:2 clown:3 problem:4 A N 22

24 Learning from Fully Observed Data π = A 0.25 N 0.75 a = a i,j A N A N b = b i (o) clown killer problem crazy A N Viterbi algorithm: V killer:1 crazy:2 clown:3 problem:4 A N

25 Probability models of language Question π = V 0.25 N 0.75 b = a = b i (o) time flies can V N a i,j V N V N What is the best sequence of tags for each string below: 1. time 2. time flies 3. time flies can 24

26 Natural Language Processing Anoop Sarkar anoopsarkar.github.io/nlp-class Simon Fraser University Part 4: HMM as a Language Model 25

27 Hidden Markov Model π i Model θ = a i,j b i (o) probability of starting at state i probability of transition from state i to state j probability of output o at state i 26

28 Hidden Markov Model Algorithms HMM as parser: compute the best sequence of states for a given observation sequence. HMM as language model: compute probability of given observation sequence. HMM as learner: given a corpus of observation sequences, learn its distribution, i.e. learn the parameters of the HMM from the corpus. Learning from a set of observations with the sequence of states provided (states are not hidden) [Supervised Learning] Learning from a set of observations without any state information. [Unsupervised Learning] 27

29 HMM as a Language Model Find P(killer clown) = y P(y, killer clown) P(killer clown) = P(AA, killer clown) + P(AN, killer clown) + P(NN, killer clown) + P(NA, killer clown) 28

30 HMM as a Language Model Consider the input killer crazy clown problem So the task is to find the sum over all sequences of states: s 1,s 2,s 3,s 4 P(killer crazy clown problem, s 1, s 2, s 3, s 4 ) A sub-problem is to find the most likely sequence of states for killer crazy clown: s 1,s 2,s 3 P(killer crazy clown, s 1, s 2, s 3 ) 29

31 HMM as a Language Model In our example there are two possible values for s 4 : s 1,...,s 4 P(killer crazy clown problem, s 1, s 2, s 3, s 4 ) = s 1,s 2,s 3 P(killer crazy clown problem, s 1, s 2, s 3, N) + s 1,s 2,s 3 P(killer crazy clown problem, s 1, s 2, s 3, A) Very similar to the Viterbi algorithm. Sum instead of max, and that s the only difference! 30

32 HMM as a Language Model Provide an index for each input symbol: 1:killer 2:crazy 3:clown 4:problem V [N, 3] = s 1,s 2 P(killer crazy clown, s 1, s 2, N) V [N, 4] = Putting them together: s 1,s 2,s 3 P(killer crazy clown problem, s 1, s 2, s 3, N) V [N, 4] = V [N, 3] a N,N b N (problem) + V [A, 3] a A,N b N (problem) V [A, 4] = V [N, 3] a N,A b A (problem) + V [A, 3] a A,A b A (problem) The best score for the input is given by: V [N, 4] + V [A, 4] 31

33 HMM as a Language Model For input of length T : o 1,..., o T, we want to find P(o 1,..., o T ) = y 1,...,y T P(y 1,..., y T, o 1,..., o T ) Each y t in this sequence is one of the states in the HMM. For each state q we initialize our table: V [q, 1] = π q b q (o 1 ) Then compute recursively for t = 1... T 1 for each state q: V [q, t + 1] = q { V [q, t] a q,q b q (o t+1 ) } After the loop terminates, the best score is q V [q, T ] So: Viterbi with sum instead of max gives us an algorithm for HMM as a language model. This algorithm is sometimes called the forward algorithm. 32

34 Natural Language Processing Anoop Sarkar anoopsarkar.github.io/nlp-class Simon Fraser University Part 5: Supervised Learning for HMMs 33

35 Hidden Markov Model Algorithms HMM as parser: compute the best sequence of states for a given observation sequence. HMM as language model: compute probability of given observation sequence. HMM as learner: given a corpus of observation sequences, learn its distribution, i.e. learn the parameters of the HMM from the corpus. Learning from a set of observations with the sequence of states provided (states are not hidden) [Supervised Learning] Learning from a set of observations without any state information. [Unsupervised Learning] 34

36 Hidden Markov Model π i Model θ = a i,j b i (o) probability of starting at state i probability of transition from state i to state j probability of output o at state i Constraints : i π i = 1, j a i,j = 1, o b i (o) = 1 35

37 HMM Learning from Labeled Data The task: to find the values for the parameters of the HMM: π A, π N a A,A, a A,N, a N,N, a N,A b A (killer), b A (crazy), b A (clown), b A (problem) bn (killer), b N (crazy), b N (clown), b N (problem) 36

38 Learning from Fully Observed Data Labeled Data L x1,y1: killer/n clown/n (x1 = killer,clown; y1 = N,N) x2,y2: killer/n problem/n (x2 = killer,problem; y2 = N,N) x3,y3: crazy/a problem/n... x4,y4: crazy/a clown/n x5,y5: problem/n crazy/a clown/n x6,y6: clown/n crazy/a killer/n 37

39 Learning from Fully Observed Data Let s say we have m labeled examples: L = (x 1, y 1 ),..., (x m, y m ) Each (x l, y l ) = {o 1,..., o T, s 1,..., s T } For each (x l, y l ) we can compute the probability using the HMM: (x 1 = killer, clown; y 1 = N, N) : P(x 1, y 1 ) = π N b N (killer) a N,N b N (clown) (x2 = killer, problem; y 2 = N, N) : P(x 2, y 2 ) = π N b N (killer) a N,N b N (problem) (x3 = crazy, problem; y 3 = A, N) : P(x 3, y 3 ) = π A b A (crazy) a A,N b N (problem) (x 4 = crazy, clown; y 4 = A, N) : P(x 4, y 4 ) = π A b A (crazy) a A,N b N (clown) (x5 = problem, crazy, clown; y 5 = N, A, N) : P(x 5, y 5 ) = π N b N (problem) a N,A b A (crazy) a A,N b N (clown) (x6 = clown, crazy, killer; y 6 = N, A, N) : P(x 6, y 6 ) = π N b N (clown) a N,A b A (crazy) a A,N b N (killer) l P(x l, y l ) = π N 4 π A2 a N,N 2 a N,A2 a A,N 4 a A,A0 b N (killer) 3 b N (clown) 4 b N (problem) 3 b A (crazy) 4 38

40 Learning from Fully Observed Data We can easily collect frequency of observing a word with a state (tag) f (i, x, y) = number of times i is the initial state in (x, y) f (i, j, x, y) = number of times j follows i in (x, y) f (i, o, x, y) = number of times i is paired with observation o Then according to our HMM the probability of x, y is: P(x, y) = π f (i,x,y) i a f (i,j,x,y) i,j b i (o) f (i,o,x,y) i i,j i,o 39

41 Learning from Fully Observed Data According to our HMM the probability of x, y is: P(x, y) = π f (i,x,y) i a f (i,j,x,y) i,j b i (o) f (i,o,x,y) i i,j i,o For the labeled data L = (x 1, y 1 ),..., (x l, y l ),..., (x m, y m ) P(L) = = m P(x l, y l ) l=1 m i l=1 π f (i,x l,y l ) i i,j a f (i,j,x l,y l ) i,j b i (o) f (i,o,x l,y l ) i,o 40

42 Learning from Fully Observed Data According to our HMM the probability of x, y is: m P(L) = b i (o) f (i,o,x l,y l ) l=1 i π f (i,x l,y l ) i i,j a f (i,j,x l,y l ) i,j The log probability of the labeled data (x 1, y 1 ),..., (x m, y m ) according to HMM with parameters θ is: m L(θ) = log P(x l, y l ) = l=1 i,o m f (i, x l, y l ) log π i + l=1 i f (i, j, x l, y l ) log a i,j + i,j f (i, o, x l, y l ) log b i (o) i,o 41

43 Learning from Fully Observed Data m L(θ) = l=1 f (i, x l, y l ) log π i + i,j i f (i, j, x l, y l ) log a i,j + i,o f (i, o, x l, y l ) log b i (o) θ = (π, a, b) L(θ) is the log probability of the labeled data (x 1, y 1 ),..., (x m, y m ) We want to find a θ that will give us the maximum value of L(θ) Find the θ such that dl(θ) dθ = 0 42

44 Learning from Fully Observed Data m L(θ) = l=1 f (i, x l, y l ) log π i + i i,j f (i, j, x l, y l ) log a i,j + i,o f (i, o, x l, y l ) log b i (o) The values of π i, a i,j, b i (o) that maximize L(θ) are: l π i = f (i, x l, y l ) l k f (k, x l, y l ) l a i,j = f (i, j, x l, y l ) l k f (i, k, x l, y l ) l b i (o) = f (i, o, x l, y l ) l o V f (i, o, x l, y l ) 43

45 Learning from Fully Observed Data Labeled Data: x1,y1: killer/n clown/n x2,y2: killer/n problem/n x3,y3: crazy/a problem/n x4,y4: crazy/a clown/n x5,y5: problem/n crazy/a clown/n x6,y6: clown/n crazy/a killer/n 44

46 Learning from Fully Observed Data The values of π i that maximize L(θ) are: l π i = f (i, x l, y l ) l k f (k, x l, y l ) π N = 2 3 and π A = 1 3 because: f (N, x l, y l ) = 4 l f (A, x l, y l ) = 2 l 45

47 Learning from Fully Observed Data The values of a i,j that maximize L(θ) are: l a i,j = f (i, j, x l, y l ) l k f (i, k, x l, y l ) a N,N = 1 2 ; a N,A = 1 2 ; a A,N = 1 and a A,A = 0 because: f (N, N, x l, y l ) = 2 l f (N, A, x l, y l ) = 2 l f (A, N, x l, y l ) = 4 l f (A, A, x l, y l ) = 0 l 46

48 Learning from Fully Observed Data The values of b i (o) that maximize L(θ) are: l b i (o) = f (i, o, x l, y l ) l o V f (i, o, x l, y l ) b N (killer) = 3 10 ; b N(clown) = 4 10 ; b N(problem) = 3 10 and b A (crazy) = 1 because: f (N, killer, x l, y l ) = 3 l f (N, clown, x l, y l ) = 4 l f (N, crazy, x l, y l ) = 0 l f (N, problem, x l, y l ) = 3 l f (A, killer, x l, y l ) = 0 l f (A, clown, x l, y l ) = 0 l f (A, crazy, x l, y l ) = 4 l f (A, problem, x l, y l ) = 0 l 47

49 Learning from Fully Observed Data x1,y1: killer/n clown/n x2,y2: killer/n problem/n x3,y3: crazy/a problem/n x4,y4: crazy/a clown/n x5,y5: problem/n crazy/a clown/n x6,y6: clown/n crazy/a killer/n π = A 0.25 N 0.75 b = a = a i,j A N A N b i (o) clown killer problem crazy A N

50 Natural Language Processing Anoop Sarkar anoopsarkar.github.io/nlp-class Simon Fraser University Part 6: Lagrange Multipliers 49

51 Hidden Markov Model π i Model θ = a i,j b i (o) probability of starting at state i probability of transition from state i to state j probability of output o at state i Constraints : i π i = 1, j a i,j = 1, o b i (o) = 1 50

52 Learning from Fully Observed Data m L(θ) = l=1 f (i, x l, y l ) log π i + i,j i f (i, j, x l, y l ) log a i,j + i,o f (i, o, x l, y l ) log b i (o) θ = (π, a, b) L(θ) is the log probability of the labeled data (x 1, y 1 ),..., (x m, y m ) We want to find a θ that will give us the maximum value of L(θ) Find the θ such that dl(θ) dθ = 0 51

53 Learning from Fully Observed Data m L(θ) = l=1 f (i, x l, y l ) log π i + i i,j f (i, j, x l, y l ) log a i,j + i,o f (i, o, x l, y l ) log b i (o) Find the θ such that dl(θ) dθ = 0 and θ = (π, a, b) Split up L(θ) into L(π), L(a), L(b) Let L = i, j, o : L(π) π i, L(a) a i,j, L(b) b i (o) We must also obey constraints: k π k = 1, k a i,k = 1, o b i(o) = 1 52

54 Learning from Fully Observed Data m L(π) = f (i, x l, y l ) log π i l=1 i Let us focus on L(π) (the other two: a and b are similar) For the constraint k π k = 1 we introduce a new variable into our search for a maximum: L(π, λ) = L(π) + λ(1 k π k ) λ is called the Lagrange multiplier λ penalizes any solution that does not obey the constraint The constraint ensures that π is a probability distribution 53

55 Learning from Fully Observed Data L(π) π i = π i m f (i, x l, y l ) log π i l=1 }{{} the only part with variable π i + m f (j, x l, y l ) log π j l=1 j:j i } {{ } no π i so derivative is 0 We want a value of π i such that L(π,λ) π i = 0 ( m f (i, x l, y l ) log π i + λ(1 π i l=1 k π i m f (i, x l, y l ) log π }{{} i l=1 = f (i,x l,y l ) π i π i +λ λπ i }{{} π i =λ π k ) ) = 0 λ π j ) = 0 j:j i 54

56 Learning from Fully Observed Data L(π) π i = π i m f (i, x l, y l ) log π i l=1 }{{} the only part with variable π i + m f (j, x l, y l ) log π j l=1 j:j i } {{ } no π i so derivative is 0 We can obtain a value of π i wrt λ: L(π, λ) m f (i, x l, y l ) = λ = 0 π i π i l=1 }{{} see previous slide m l=1 π i = f (i, x l, y l ) λ Combine π i s from Eqn (1) with constraint k π k = 1 (1) λ = k m f (k, x l, y l ) l=1 55

57 Learning from Fully Observed Data L(π) π i = π i m f (i, x l, y l ) log π i l=1 }{{} the only part with variable π i + m f (j, x l, y l ) log π j l=1 j:j i } {{ } no π i so derivative is 0 The value of π i for which L(π,λ) π i = 0 is Eqn (2) which can be combined with the value of λ from Eqn (3). m l=1 π i = f (i, x l, y l ) (2) λ λ = m f (k, x l, y l ) (3) k l=1 m l=1 π i = f (i, x l, y l ) m k l=1 f (k, x l, y l ) 56

58 Learning from Fully Observed Data m L(θ) = l=1 f (i, x l, y l ) log π i + i i,j f (i, j, x l, y l ) log a i,j + i,o f (i, o, x l, y l ) log b i (o) The values of π i, a i,j, b i (o) that maximize L(θ) are: l π i = f (i, x l, y l ) l k f (k, x l, y l ) l a i,j = f (i, j, x l, y l ) l k f (i, k, x l, y l ) l b i (o) = f (i, o, x l, y l ) l o V f (i, o, x l, y l ) 57

59 Natural Language Processing Anoop Sarkar anoopsarkar.github.io/nlp-class Simon Fraser University Part 7: Unsupervised Learning for HMMs 58

60 Hidden Markov Model π i Model θ = a i,j b i (o) probability of starting at state i probability of transition from state i to state j probability of output o at state i 59

61 Hidden Markov Model Algorithms HMM as parser: compute the best sequence of states for a given observation sequence. HMM as language model: compute probability of given observation sequence. HMM as learner: given a corpus of observation sequences, learn its distribution, i.e. learn the parameters of the HMM from the corpus. Learning from a set of observations with the sequence of states provided (states are not hidden) [Supervised Learning] Learning from a set of observations without any state information. [Unsupervised Learning] 60

62 Learning from Unlabeled Data Unlabeled Data U = x 1,..., x m : x1: killer clown x2: killer problem x3: crazy problem x4: crazy clown y1, y2, y3, y4 are unknown. But we can enumerate all possible values for y1, y2, y3, y4 For example, for x1: killer clown x1,y1,1: killer/a clown/a p 1 = π A b A (killer) a A,A b A (clown) x1,y1,2: killer/a clown/n p 2 = π A b A (killer) a A,N b N (clown) x1,y1,3: killer/n clown/n p 3 = π N b N (killer) a N,N b N (clown) x1,y1,4: killer/n clown/a p 4 = π N b N (killer) a N,A b A (clown) 61

63 Learning from Unlabeled Data Assume some values for θ = π, a, b We can compute P(y x l, θ) for any y for a given x l P(y x l, θ) = P(x, y θ) y P(x, y θ) For example, we can compute P(NN killer clown, θ) as follows: π N b N (killer) a N,N b N (clown) i,j π i b i (killer) a i,j b j (clown) P(y x l, θ) is called the posterior probability 62

64 Learning from Unlabeled Data Compute the posterior for all possible outputs for each example in training: For x1: killer clown x1,y1,1: killer/a clown/a P(AA killer clown, θ) x1,y1,2: killer/a clown/n P(AN killer clown, θ) x1,y1,3: killer/n clown/n P(NN killer clown, θ) x1,y1,4: killer/n clown/a P(NA killer clown, θ) For x2: killer problem x2,y2,1: killer/a problem/a P(AA killer problem, θ) x2,y2,2: killer/a problem/n P(AN killer problem, θ) x2,y2,3: killer/n problem/n P(NN killer problem, θ) x2,y2,4: killer/n problem/a P(NA killer problem, θ) Similarly for x3: crazy problem And x4: crazy clown 63

65 Learning from Unlabeled Data For unlabeled data, the log probability of the data given θ is: L(θ) = = m log P(x l, y θ) l=1 y m log P(y x l, θ) P(x l θ) y l=1 Unlike the fully observed case there is no simple solution to finding θ to maximize L(θ) We instead initialize θ to some values, and then iteratively find better values of θ: θ 0, θ 1,... using the following formula: θ t = arg max Q(θ, θ t 1 ) = θ m P(y x l, θ t 1 ) log P(x l, y θ) l=1 y 64

66 Learning from Unlabeled Data Q(θ, θ t 1 ) = = θ t = arg max Q(θ, θ t 1 ) θ m P(y x l, θ t 1 ) log P(x l, y θ) l=1 y m P(y x l, θ t 1 ) l=1 ( y i + i,j + i,o f (i, x l, y) log π i f (i, j, x l, y) log a i,j f (i, o, x l, y) log b i (o) 65

67 Learning from Unlabeled Data g(i, x l ) = y g(i, j, x l ) = y g(i, o, x l ) = y P(y x l, θ t 1 ) f (i, x l, y) P(y x l, θ t 1 ) f (i, j, x l, y) P(y x l, θ t 1 ) f (i, o, x l, y) θ t = arg max π,a,b m g(i, x l ) log π i l=1 i + i,j g(i, j, x l ) log a i,j + i,o g(i, o, x l ) log b j (o) 66

68 Learning from Unlabeled Data m Q(θ, θ t 1 ) = l=1 g(i, x l ) log π i + i i,j g(i, j, x l ) log a i,j + i,o g(i, o, x l ) log b i (o) The values of π i, a i,j, b i (o) that maximize L(θ) are: l π i = g(i, x l) l k g(k, x l) l a i,j = g(i, j, x l) l k g(i, k, x l) l b i (o) = g(i, o, x l) l o V g(i, o, x l ) 67

69 EM Algorithm for Learning HMMs Initialize θ 0 at random. Let t = 0. The EM Algorithm: E-step: compute expected values of y, P(y x, θ) and calculate g(i, x), g(i, j, x), g(i, o, x) M-step: compute θ t = arg max θ Q(θ, θ t 1 ) Stop if L(θ t ) did not change much since last iteration. Else continue. The above algorithm is guaranteed to improve likelihood of the unlabeled data. In other words, L(θ t ) L(θ t 1 ) But it all depends on θ 0! 68

70 Acknowledgements Many slides borrowed or inspired from lecture notes by Michael Collins, Chris Dyer, Kevin Knight, Philipp Koehn, Adam Lopez, Graham Neubig and Luke Zettlemoyer from their NLP course materials. All mistakes are my own. A big thank you to all the students who read through these notes and helped me improve them. 69

Natural Language Processing

Natural Language Processing SFU NatLangLab Natural Language Processing Anoop Sarkar anoopsarkar.github.io/nlp-class Simon Fraser University October 9, 2018 0 Natural Language Processing Anoop Sarkar anoopsarkar.github.io/nlp-class

More information

Hidden Markov Models

Hidden Markov Models CS769 Spring 2010 Advanced Natural Language Processing Hidden Markov Models Lecturer: Xiaojin Zhu jerryzhu@cs.wisc.edu 1 Part-of-Speech Tagging The goal of Part-of-Speech (POS) tagging is to label each

More information

Sequence Modelling with Features: Linear-Chain Conditional Random Fields. COMP-599 Oct 6, 2015

Sequence Modelling with Features: Linear-Chain Conditional Random Fields. COMP-599 Oct 6, 2015 Sequence Modelling with Features: Linear-Chain Conditional Random Fields COMP-599 Oct 6, 2015 Announcement A2 is out. Due Oct 20 at 1pm. 2 Outline Hidden Markov models: shortcomings Generative vs. discriminative

More information

Lecture 12: Algorithms for HMMs

Lecture 12: Algorithms for HMMs Lecture 12: Algorithms for HMMs Nathan Schneider (some slides from Sharon Goldwater; thanks to Jonathan May for bug fixes) ENLP 17 October 2016 updated 9 September 2017 Recap: tagging POS tagging is a

More information

Statistical Methods for NLP

Statistical Methods for NLP Statistical Methods for NLP Information Extraction, Hidden Markov Models Sameer Maskey Week 5, Oct 3, 2012 *many slides provided by Bhuvana Ramabhadran, Stanley Chen, Michael Picheny Speech Recognition

More information

CS838-1 Advanced NLP: Hidden Markov Models

CS838-1 Advanced NLP: Hidden Markov Models CS838-1 Advanced NLP: Hidden Markov Models Xiaojin Zhu 2007 Send comments to jerryzhu@cs.wisc.edu 1 Part of Speech Tagging Tag each word in a sentence with its part-of-speech, e.g., The/AT representative/nn

More information

Recap: HMM. ANLP Lecture 9: Algorithms for HMMs. More general notation. Recap: HMM. Elements of HMM: Sharon Goldwater 4 Oct 2018.

Recap: HMM. ANLP Lecture 9: Algorithms for HMMs. More general notation. Recap: HMM. Elements of HMM: Sharon Goldwater 4 Oct 2018. Recap: HMM ANLP Lecture 9: Algorithms for HMMs Sharon Goldwater 4 Oct 2018 Elements of HMM: Set of states (tags) Output alphabet (word types) Start state (beginning of sentence) State transition probabilities

More information

Lecture 12: Algorithms for HMMs

Lecture 12: Algorithms for HMMs Lecture 12: Algorithms for HMMs Nathan Schneider (some slides from Sharon Goldwater; thanks to Jonathan May for bug fixes) ENLP 26 February 2018 Recap: tagging POS tagging is a sequence labelling task.

More information

Basic math for biology

Basic math for biology Basic math for biology Lei Li Florida State University, Feb 6, 2002 The EM algorithm: setup Parametric models: {P θ }. Data: full data (Y, X); partial data Y. Missing data: X. Likelihood and maximum likelihood

More information

A brief introduction to Conditional Random Fields

A brief introduction to Conditional Random Fields A brief introduction to Conditional Random Fields Mark Johnson Macquarie University April, 2005, updated October 2010 1 Talk outline Graphical models Maximum likelihood and maximum conditional likelihood

More information

Conditional Random Field

Conditional Random Field Introduction Linear-Chain General Specific Implementations Conclusions Corso di Elaborazione del Linguaggio Naturale Pisa, May, 2011 Introduction Linear-Chain General Specific Implementations Conclusions

More information

CISC 889 Bioinformatics (Spring 2004) Hidden Markov Models (II)

CISC 889 Bioinformatics (Spring 2004) Hidden Markov Models (II) CISC 889 Bioinformatics (Spring 24) Hidden Markov Models (II) a. Likelihood: forward algorithm b. Decoding: Viterbi algorithm c. Model building: Baum-Welch algorithm Viterbi training Hidden Markov models

More information

Sequence Labeling: HMMs & Structured Perceptron

Sequence Labeling: HMMs & Structured Perceptron Sequence Labeling: HMMs & Structured Perceptron CMSC 723 / LING 723 / INST 725 MARINE CARPUAT marine@cs.umd.edu HMM: Formal Specification Q: a finite set of N states Q = {q 0, q 1, q 2, q 3, } N N Transition

More information

Statistical Methods for NLP

Statistical Methods for NLP Statistical Methods for NLP Sequence Models Joakim Nivre Uppsala University Department of Linguistics and Philology joakim.nivre@lingfil.uu.se Statistical Methods for NLP 1(21) Introduction Structured

More information

More on HMMs and other sequence models. Intro to NLP - ETHZ - 18/03/2013

More on HMMs and other sequence models. Intro to NLP - ETHZ - 18/03/2013 More on HMMs and other sequence models Intro to NLP - ETHZ - 18/03/2013 Summary Parts of speech tagging HMMs: Unsupervised parameter estimation Forward Backward algorithm Bayesian variants Discriminative

More information

6.864: Lecture 5 (September 22nd, 2005) The EM Algorithm

6.864: Lecture 5 (September 22nd, 2005) The EM Algorithm 6.864: Lecture 5 (September 22nd, 2005) The EM Algorithm Overview The EM algorithm in general form The EM algorithm for hidden markov models (brute force) The EM algorithm for hidden markov models (dynamic

More information

Part of Speech Tagging: Viterbi, Forward, Backward, Forward- Backward, Baum-Welch. COMP-599 Oct 1, 2015

Part of Speech Tagging: Viterbi, Forward, Backward, Forward- Backward, Baum-Welch. COMP-599 Oct 1, 2015 Part of Speech Tagging: Viterbi, Forward, Backward, Forward- Backward, Baum-Welch COMP-599 Oct 1, 2015 Announcements Research skills workshop today 3pm-4:30pm Schulich Library room 313 Start thinking about

More information

Log-Linear Models, MEMMs, and CRFs

Log-Linear Models, MEMMs, and CRFs Log-Linear Models, MEMMs, and CRFs Michael Collins 1 Notation Throughout this note I ll use underline to denote vectors. For example, w R d will be a vector with components w 1, w 2,... w d. We use expx

More information

Brief Introduction of Machine Learning Techniques for Content Analysis

Brief Introduction of Machine Learning Techniques for Content Analysis 1 Brief Introduction of Machine Learning Techniques for Content Analysis Wei-Ta Chu 2008/11/20 Outline 2 Overview Gaussian Mixture Model (GMM) Hidden Markov Model (HMM) Support Vector Machine (SVM) Overview

More information

Lecture 13: Structured Prediction

Lecture 13: Structured Prediction Lecture 13: Structured Prediction Kai-Wei Chang CS @ University of Virginia kw@kwchang.net Couse webpage: http://kwchang.net/teaching/nlp16 CS6501: NLP 1 Quiz 2 v Lectures 9-13 v Lecture 12: before page

More information

Parametric Unsupervised Learning Expectation Maximization (EM) Lecture 20.a

Parametric Unsupervised Learning Expectation Maximization (EM) Lecture 20.a Parametric Unsupervised Learning Expectation Maximization (EM) Lecture 20.a Some slides are due to Christopher Bishop Limitations of K-means Hard assignments of data points to clusters small shift of a

More information

Sequence labeling. Taking collective a set of interrelated instances x 1,, x T and jointly labeling them

Sequence labeling. Taking collective a set of interrelated instances x 1,, x T and jointly labeling them HMM, MEMM and CRF 40-957 Special opics in Artificial Intelligence: Probabilistic Graphical Models Sharif University of echnology Soleymani Spring 2014 Sequence labeling aking collective a set of interrelated

More information

p(d θ ) l(θ ) 1.2 x x x

p(d θ ) l(θ ) 1.2 x x x p(d θ ).2 x 0-7 0.8 x 0-7 0.4 x 0-7 l(θ ) -20-40 -60-80 -00 2 3 4 5 6 7 θ ˆ 2 3 4 5 6 7 θ ˆ 2 3 4 5 6 7 θ θ x FIGURE 3.. The top graph shows several training points in one dimension, known or assumed to

More information

A gentle introduction to Hidden Markov Models

A gentle introduction to Hidden Markov Models A gentle introduction to Hidden Markov Models Mark Johnson Brown University November 2009 1 / 27 Outline What is sequence labeling? Markov models Hidden Markov models Finding the most likely state sequence

More information

Empirical Methods in Natural Language Processing Lecture 11 Part-of-speech tagging and HMMs

Empirical Methods in Natural Language Processing Lecture 11 Part-of-speech tagging and HMMs Empirical Methods in Natural Language Processing Lecture 11 Part-of-speech tagging and HMMs (based on slides by Sharon Goldwater and Philipp Koehn) 21 February 2018 Nathan Schneider ENLP Lecture 11 21

More information

Midterm sample questions

Midterm sample questions Midterm sample questions CS 585, Brendan O Connor and David Belanger October 12, 2014 1 Topics on the midterm Language concepts Translation issues: word order, multiword translations Human evaluation Parts

More information

10/17/04. Today s Main Points

10/17/04. Today s Main Points Part-of-speech Tagging & Hidden Markov Model Intro Lecture #10 Introduction to Natural Language Processing CMPSCI 585, Fall 2004 University of Massachusetts Amherst Andrew McCallum Today s Main Points

More information

10 : HMM and CRF. 1 Case Study: Supervised Part-of-Speech Tagging

10 : HMM and CRF. 1 Case Study: Supervised Part-of-Speech Tagging 10-708: Probabilistic Graphical Models 10-708, Spring 2018 10 : HMM and CRF Lecturer: Kayhan Batmanghelich Scribes: Ben Lengerich, Michael Kleyman 1 Case Study: Supervised Part-of-Speech Tagging We will

More information

CMSC 723: Computational Linguistics I Session #5 Hidden Markov Models. The ischool University of Maryland. Wednesday, September 30, 2009

CMSC 723: Computational Linguistics I Session #5 Hidden Markov Models. The ischool University of Maryland. Wednesday, September 30, 2009 CMSC 723: Computational Linguistics I Session #5 Hidden Markov Models Jimmy Lin The ischool University of Maryland Wednesday, September 30, 2009 Today s Agenda The great leap forward in NLP Hidden Markov

More information

Hidden Markov Models

Hidden Markov Models 10-601 Introduction to Machine Learning Machine Learning Department School of Computer Science Carnegie Mellon University Hidden Markov Models Matt Gormley Lecture 22 April 2, 2018 1 Reminders Homework

More information

Dynamic Approaches: The Hidden Markov Model

Dynamic Approaches: The Hidden Markov Model Dynamic Approaches: The Hidden Markov Model Davide Bacciu Dipartimento di Informatica Università di Pisa bacciu@di.unipi.it Machine Learning: Neural Networks and Advanced Models (AA2) Inference as Message

More information

What s an HMM? Extraction with Finite State Machines e.g. Hidden Markov Models (HMMs) Hidden Markov Models (HMMs) for Information Extraction

What s an HMM? Extraction with Finite State Machines e.g. Hidden Markov Models (HMMs) Hidden Markov Models (HMMs) for Information Extraction Hidden Markov Models (HMMs) for Information Extraction Daniel S. Weld CSE 454 Extraction with Finite State Machines e.g. Hidden Markov Models (HMMs) standard sequence model in genomics, speech, NLP, What

More information

Lecture 11: Hidden Markov Models

Lecture 11: Hidden Markov Models Lecture 11: Hidden Markov Models Cognitive Systems - Machine Learning Cognitive Systems, Applied Computer Science, Bamberg University slides by Dr. Philip Jackson Centre for Vision, Speech & Signal Processing

More information

Intelligent Systems (AI-2)

Intelligent Systems (AI-2) Intelligent Systems (AI-2) Computer Science cpsc422, Lecture 19 Oct, 24, 2016 Slide Sources Raymond J. Mooney University of Texas at Austin D. Koller, Stanford CS - Probabilistic Graphical Models D. Page,

More information

Computational Genomics and Molecular Biology, Fall

Computational Genomics and Molecular Biology, Fall Computational Genomics and Molecular Biology, Fall 2011 1 HMM Lecture Notes Dannie Durand and Rose Hoberman October 11th 1 Hidden Markov Models In the last few lectures, we have focussed on three problems

More information

CSCI 5832 Natural Language Processing. Today 2/19. Statistical Sequence Classification. Lecture 9

CSCI 5832 Natural Language Processing. Today 2/19. Statistical Sequence Classification. Lecture 9 CSCI 5832 Natural Language Processing Jim Martin Lecture 9 1 Today 2/19 Review HMMs for POS tagging Entropy intuition Statistical Sequence classifiers HMMs MaxEnt MEMMs 2 Statistical Sequence Classification

More information

Hidden Markov Models

Hidden Markov Models Hidden Markov Models CI/CI(CS) UE, SS 2015 Christian Knoll Signal Processing and Speech Communication Laboratory Graz University of Technology June 23, 2015 CI/CI(CS) SS 2015 June 23, 2015 Slide 1/26 Content

More information

Natural Language Processing

Natural Language Processing SFU NatLangLab Natural Language Processing Anoop Sarkar anoopsarkar.github.io/nlp-class Simon Fraser University October 20, 2017 0 Natural Language Processing Anoop Sarkar anoopsarkar.github.io/nlp-class

More information

Hidden Markov Models The three basic HMM problems (note: change in notation) Mitch Marcus CSE 391

Hidden Markov Models The three basic HMM problems (note: change in notation) Mitch Marcus CSE 391 Hidden Markov Models The three basic HMM problems (note: change in notation) Mitch Marcus CSE 391 Parameters of an HMM States: A set of states S=s 1, s n Transition probabilities: A= a 1,1, a 1,2,, a n,n

More information

Machine Learning for natural language processing

Machine Learning for natural language processing Machine Learning for natural language processing Hidden Markov Models Laura Kallmeyer Heinrich-Heine-Universität Düsseldorf Summer 2016 1 / 33 Introduction So far, we have classified texts/observations

More information

Hidden Markov Model. Ying Wu. Electrical Engineering and Computer Science Northwestern University Evanston, IL 60208

Hidden Markov Model. Ying Wu. Electrical Engineering and Computer Science Northwestern University Evanston, IL 60208 Hidden Markov Model Ying Wu Electrical Engineering and Computer Science Northwestern University Evanston, IL 60208 http://www.eecs.northwestern.edu/~yingwu 1/19 Outline Example: Hidden Coin Tossing Hidden

More information

Text Mining. March 3, March 3, / 49

Text Mining. March 3, March 3, / 49 Text Mining March 3, 2017 March 3, 2017 1 / 49 Outline Language Identification Tokenisation Part-Of-Speech (POS) tagging Hidden Markov Models - Sequential Taggers Viterbi Algorithm March 3, 2017 2 / 49

More information

Hidden Markov Models

Hidden Markov Models CS 2750: Machine Learning Hidden Markov Models Prof. Adriana Kovashka University of Pittsburgh March 21, 2016 All slides are from Ray Mooney Motivating Example: Part Of Speech Tagging Annotate each word

More information

Basic Text Analysis. Hidden Markov Models. Joakim Nivre. Uppsala University Department of Linguistics and Philology

Basic Text Analysis. Hidden Markov Models. Joakim Nivre. Uppsala University Department of Linguistics and Philology Basic Text Analysis Hidden Markov Models Joakim Nivre Uppsala University Department of Linguistics and Philology joakimnivre@lingfiluuse Basic Text Analysis 1(33) Hidden Markov Models Markov models are

More information

Conditional Random Fields and beyond DANIEL KHASHABI CS 546 UIUC, 2013

Conditional Random Fields and beyond DANIEL KHASHABI CS 546 UIUC, 2013 Conditional Random Fields and beyond DANIEL KHASHABI CS 546 UIUC, 2013 Outline Modeling Inference Training Applications Outline Modeling Problem definition Discriminative vs. Generative Chain CRF General

More information

Hidden Markov Modelling

Hidden Markov Modelling Hidden Markov Modelling Introduction Problem formulation Forward-Backward algorithm Viterbi search Baum-Welch parameter estimation Other considerations Multiple observation sequences Phone-based models

More information

STA 414/2104: Machine Learning

STA 414/2104: Machine Learning STA 414/2104: Machine Learning Russ Salakhutdinov Department of Computer Science! Department of Statistics! rsalakhu@cs.toronto.edu! http://www.cs.toronto.edu/~rsalakhu/ Lecture 9 Sequential Data So far

More information

Hidden Markov Models. By Parisa Abedi. Slides courtesy: Eric Xing

Hidden Markov Models. By Parisa Abedi. Slides courtesy: Eric Xing Hidden Markov Models By Parisa Abedi Slides courtesy: Eric Xing i.i.d to sequential data So far we assumed independent, identically distributed data Sequential (non i.i.d.) data Time-series data E.g. Speech

More information

Machine Learning & Data Mining Caltech CS/CNS/EE 155 Hidden Markov Models Last Updated: Feb 7th, 2017

Machine Learning & Data Mining Caltech CS/CNS/EE 155 Hidden Markov Models Last Updated: Feb 7th, 2017 1 Introduction Let x = (x 1,..., x M ) denote a sequence (e.g. a sequence of words), and let y = (y 1,..., y M ) denote a corresponding hidden sequence that we believe explains or influences x somehow

More information

CSCE 471/871 Lecture 3: Markov Chains and

CSCE 471/871 Lecture 3: Markov Chains and and and 1 / 26 sscott@cse.unl.edu 2 / 26 Outline and chains models (s) Formal definition Finding most probable state path (Viterbi algorithm) Forward and backward algorithms State sequence known State

More information

Hidden Markov Models. Ivan Gesteira Costa Filho IZKF Research Group Bioinformatics RWTH Aachen Adapted from:

Hidden Markov Models. Ivan Gesteira Costa Filho IZKF Research Group Bioinformatics RWTH Aachen Adapted from: Hidden Markov Models Ivan Gesteira Costa Filho IZKF Research Group Bioinformatics RWTH Aachen Adapted from: www.ioalgorithms.info Outline CG-islands The Fair Bet Casino Hidden Markov Model Decoding Algorithm

More information

Statistical Machine Learning from Data

Statistical Machine Learning from Data Samy Bengio Statistical Machine Learning from Data Statistical Machine Learning from Data Samy Bengio IDIAP Research Institute, Martigny, Switzerland, and Ecole Polytechnique Fédérale de Lausanne (EPFL),

More information

Introduction to Machine Learning

Introduction to Machine Learning Introduction to Machine Learning Brown University CSCI 1950-F, Spring 2012 Prof. Erik Sudderth Lecture 20: Expectation Maximization Algorithm EM for Mixture Models Many figures courtesy Kevin Murphy s

More information

Intelligent Systems (AI-2)

Intelligent Systems (AI-2) Intelligent Systems (AI-2) Computer Science cpsc422, Lecture 19 Oct, 23, 2015 Slide Sources Raymond J. Mooney University of Texas at Austin D. Koller, Stanford CS - Probabilistic Graphical Models D. Page,

More information

Hidden Markov Models. Aarti Singh Slides courtesy: Eric Xing. Machine Learning / Nov 8, 2010

Hidden Markov Models. Aarti Singh Slides courtesy: Eric Xing. Machine Learning / Nov 8, 2010 Hidden Markov Models Aarti Singh Slides courtesy: Eric Xing Machine Learning 10-701/15-781 Nov 8, 2010 i.i.d to sequential data So far we assumed independent, identically distributed data Sequential data

More information

Statistical Pattern Recognition

Statistical Pattern Recognition Statistical Pattern Recognition Expectation Maximization (EM) and Mixture Models Hamid R. Rabiee Jafar Muhammadi, Mohammad J. Hosseini Spring 2014 http://ce.sharif.edu/courses/92-93/2/ce725-2 Agenda Expectation-maximization

More information

Lecture 4: Hidden Markov Models: An Introduction to Dynamic Decision Making. November 11, 2010

Lecture 4: Hidden Markov Models: An Introduction to Dynamic Decision Making. November 11, 2010 Hidden Lecture 4: Hidden : An Introduction to Dynamic Decision Making November 11, 2010 Special Meeting 1/26 Markov Model Hidden When a dynamical system is probabilistic it may be determined by the transition

More information

Stephen Scott.

Stephen Scott. 1 / 27 sscott@cse.unl.edu 2 / 27 Useful for modeling/making predictions on sequential data E.g., biological sequences, text, series of sounds/spoken words Will return to graphical models that are generative

More information

Statistical NLP for the Web Log Linear Models, MEMM, Conditional Random Fields

Statistical NLP for the Web Log Linear Models, MEMM, Conditional Random Fields Statistical NLP for the Web Log Linear Models, MEMM, Conditional Random Fields Sameer Maskey Week 13, Nov 28, 2012 1 Announcements Next lecture is the last lecture Wrap up of the semester 2 Final Project

More information

Page 1. References. Hidden Markov models and multiple sequence alignment. Markov chains. Probability review. Example. Markovian sequence

Page 1. References. Hidden Markov models and multiple sequence alignment. Markov chains. Probability review. Example. Markovian sequence Page Hidden Markov models and multiple sequence alignment Russ B Altman BMI 4 CS 74 Some slides borrowed from Scott C Schmidler (BMI graduate student) References Bioinformatics Classic: Krogh et al (994)

More information

Posterior Regularization

Posterior Regularization Posterior Regularization 1 Introduction One of the key challenges in probabilistic structured learning, is the intractability of the posterior distribution, for fast inference. There are numerous methods

More information

Hidden Markov Models (I)

Hidden Markov Models (I) GLOBEX Bioinformatics (Summer 2015) Hidden Markov Models (I) a. The model b. The decoding: Viterbi algorithm Hidden Markov models A Markov chain of states At each state, there are a set of possible observables

More information

Hidden Markov Models. Three classic HMM problems

Hidden Markov Models. Three classic HMM problems An Introduction to Bioinformatics Algorithms www.bioalgorithms.info Hidden Markov Models Slides revised and adapted to Computational Biology IST 2015/2016 Ana Teresa Freitas Three classic HMM problems

More information

Introduction to Machine Learning CMU-10701

Introduction to Machine Learning CMU-10701 Introduction to Machine Learning CMU-10701 Hidden Markov Models Barnabás Póczos & Aarti Singh Slides courtesy: Eric Xing i.i.d to sequential data So far we assumed independent, identically distributed

More information

Natural Language Processing CS Lecture 06. Razvan C. Bunescu School of Electrical Engineering and Computer Science

Natural Language Processing CS Lecture 06. Razvan C. Bunescu School of Electrical Engineering and Computer Science Natural Language Processing CS 6840 Lecture 06 Razvan C. Bunescu School of Electrical Engineering and Computer Science bunescu@ohio.edu Statistical Parsing Define a probabilistic model of syntax P(T S):

More information

Machine Learning for Structured Prediction

Machine Learning for Structured Prediction Machine Learning for Structured Prediction Grzegorz Chrupa la National Centre for Language Technology School of Computing Dublin City University NCLT Seminar Grzegorz Chrupa la (DCU) Machine Learning for

More information

6.047/6.878/HST.507 Computational Biology: Genomes, Networks, Evolution. Lecture 05. Hidden Markov Models Part II

6.047/6.878/HST.507 Computational Biology: Genomes, Networks, Evolution. Lecture 05. Hidden Markov Models Part II 6.047/6.878/HST.507 Computational Biology: Genomes, Networks, Evolution Lecture 05 Hidden Markov Models Part II 1 2 Module 1: Aligning and modeling genomes Module 1: Computational foundations Dynamic programming:

More information

Hidden Markov Models Hamid R. Rabiee

Hidden Markov Models Hamid R. Rabiee Hidden Markov Models Hamid R. Rabiee 1 Hidden Markov Models (HMMs) In the previous slides, we have seen that in many cases the underlying behavior of nature could be modeled as a Markov process. However

More information

Data Mining in Bioinformatics HMM

Data Mining in Bioinformatics HMM Data Mining in Bioinformatics HMM Microarray Problem: Major Objective n Major Objective: Discover a comprehensive theory of life s organization at the molecular level 2 1 Data Mining in Bioinformatics

More information

Sequential Supervised Learning

Sequential Supervised Learning Sequential Supervised Learning Many Application Problems Require Sequential Learning Part-of of-speech Tagging Information Extraction from the Web Text-to to-speech Mapping Part-of of-speech Tagging Given

More information

Hidden Markov Models and Gaussian Mixture Models

Hidden Markov Models and Gaussian Mixture Models Hidden Markov Models and Gaussian Mixture Models Hiroshi Shimodaira and Steve Renals Automatic Speech Recognition ASR Lectures 4&5 23&27 January 2014 ASR Lectures 4&5 Hidden Markov Models and Gaussian

More information

A.I. in health informatics lecture 8 structured learning. kevin small & byron wallace

A.I. in health informatics lecture 8 structured learning. kevin small & byron wallace A.I. in health informatics lecture 8 structured learning kevin small & byron wallace today models for structured learning: HMMs and CRFs structured learning is particularly useful in biomedical applications:

More information

Directed Probabilistic Graphical Models CMSC 678 UMBC

Directed Probabilistic Graphical Models CMSC 678 UMBC Directed Probabilistic Graphical Models CMSC 678 UMBC Announcement 1: Assignment 3 Due Wednesday April 11 th, 11:59 AM Any questions? Announcement 2: Progress Report on Project Due Monday April 16 th,

More information

Hidden Markov Models

Hidden Markov Models Hidden Markov Models Slides revised and adapted to Bioinformática 55 Engª Biomédica/IST 2005 Ana Teresa Freitas Forward Algorithm For Markov chains we calculate the probability of a sequence, P(x) How

More information

Expectation Maximization (EM)

Expectation Maximization (EM) Expectation Maximization (EM) The Expectation Maximization (EM) algorithm is one approach to unsupervised, semi-supervised, or lightly supervised learning. In this kind of learning either no labels are

More information

CS 136a Lecture 7 Speech Recognition Architecture: Training models with the Forward backward algorithm

CS 136a Lecture 7 Speech Recognition Architecture: Training models with the Forward backward algorithm + September13, 2016 Professor Meteer CS 136a Lecture 7 Speech Recognition Architecture: Training models with the Forward backward algorithm Thanks to Dan Jurafsky for these slides + ASR components n Feature

More information

Lecture 13: Discriminative Sequence Models (MEMM and Struct. Perceptron)

Lecture 13: Discriminative Sequence Models (MEMM and Struct. Perceptron) Lecture 13: Discriminative Sequence Models (MEMM and Struct. Perceptron) Intro to NLP, CS585, Fall 2014 http://people.cs.umass.edu/~brenocon/inlp2014/ Brendan O Connor (http://brenocon.com) 1 Models for

More information

Hidden Markov Models in Language Processing

Hidden Markov Models in Language Processing Hidden Markov Models in Language Processing Dustin Hillard Lecture notes courtesy of Prof. Mari Ostendorf Outline Review of Markov models What is an HMM? Examples General idea of hidden variables: implications

More information

Hidden Markov Models

Hidden Markov Models 10-601 Introduction to Machine Learning Machine Learning Department School of Computer Science Carnegie Mellon University Hidden Markov Models Matt Gormley Lecture 19 Nov. 5, 2018 1 Reminders Homework

More information

Graphical models for part of speech tagging

Graphical models for part of speech tagging Indian Institute of Technology, Bombay and Research Division, India Research Lab Graphical models for part of speech tagging Different Models for POS tagging HMM Maximum Entropy Markov Models Conditional

More information

Classification: Naïve Bayes. Nathan Schneider (slides adapted from Chris Dyer, Noah Smith, et al.) ENLP 19 September 2016

Classification: Naïve Bayes. Nathan Schneider (slides adapted from Chris Dyer, Noah Smith, et al.) ENLP 19 September 2016 Classification: Naïve Bayes Nathan Schneider (slides adapted from Chris Dyer, Noah Smith, et al.) ENLP 19 September 2016 1 Sentiment Analysis Recall the task: Filled with horrific dialogue, laughable characters,

More information

Undirected Graphical Models

Undirected Graphical Models Outline Hong Chang Institute of Computing Technology, Chinese Academy of Sciences Machine Learning Methods (Fall 2012) Outline Outline I 1 Introduction 2 Properties Properties 3 Generative vs. Conditional

More information

Data-Intensive Computing with MapReduce

Data-Intensive Computing with MapReduce Data-Intensive Computing with MapReduce Session 8: Sequence Labeling Jimmy Lin University of Maryland Thursday, March 14, 2013 This work is licensed under a Creative Commons Attribution-Noncommercial-Share

More information

Logistic Regression. Machine Learning Fall 2018

Logistic Regression. Machine Learning Fall 2018 Logistic Regression Machine Learning Fall 2018 1 Where are e? We have seen the folloing ideas Linear models Learning as loss minimization Bayesian learning criteria (MAP and MLE estimation) The Naïve Bayes

More information

Markov Chains and Hidden Markov Models. COMP 571 Luay Nakhleh, Rice University

Markov Chains and Hidden Markov Models. COMP 571 Luay Nakhleh, Rice University Markov Chains and Hidden Markov Models COMP 571 Luay Nakhleh, Rice University Markov Chains and Hidden Markov Models Modeling the statistical properties of biological sequences and distinguishing regions

More information

ACS Introduction to NLP Lecture 2: Part of Speech (POS) Tagging

ACS Introduction to NLP Lecture 2: Part of Speech (POS) Tagging ACS Introduction to NLP Lecture 2: Part of Speech (POS) Tagging Stephen Clark Natural Language and Information Processing (NLIP) Group sc609@cam.ac.uk The POS Tagging Problem 2 England NNP s POS fencers

More information

Hidden Markov Models

Hidden Markov Models Hidden Markov Models Slides mostly from Mitch Marcus and Eric Fosler (with lots of modifications). Have you seen HMMs? Have you seen Kalman filters? Have you seen dynamic programming? HMMs are dynamic

More information

Lecture 15. Probabilistic Models on Graph

Lecture 15. Probabilistic Models on Graph Lecture 15. Probabilistic Models on Graph Prof. Alan Yuille Spring 2014 1 Introduction We discuss how to define probabilistic models that use richly structured probability distributions and describe how

More information

Hidden Markov Models: Maxing and Summing

Hidden Markov Models: Maxing and Summing Hidden Markov Models: Maxing and Summing Introduction to Natural Language Processing Computer Science 585 Fall 2009 University of Massachusetts Amherst David Smith 1 Markov vs. Hidden Markov Models Fed

More information

Statistical Sequence Recognition and Training: An Introduction to HMMs

Statistical Sequence Recognition and Training: An Introduction to HMMs Statistical Sequence Recognition and Training: An Introduction to HMMs EECS 225D Nikki Mirghafori nikki@icsi.berkeley.edu March 7, 2005 Credit: many of the HMM slides have been borrowed and adapted, with

More information

Example: The Dishonest Casino. Hidden Markov Models. Question # 1 Evaluation. The dishonest casino model. Question # 3 Learning. Question # 2 Decoding

Example: The Dishonest Casino. Hidden Markov Models. Question # 1 Evaluation. The dishonest casino model. Question # 3 Learning. Question # 2 Decoding Example: The Dishonest Casino Hidden Markov Models Durbin and Eddy, chapter 3 Game:. You bet $. You roll 3. Casino player rolls 4. Highest number wins $ The casino has two dice: Fair die P() = P() = P(3)

More information

STA 4273H: Statistical Machine Learning

STA 4273H: Statistical Machine Learning STA 4273H: Statistical Machine Learning Russ Salakhutdinov Department of Statistics! rsalakhu@utstat.toronto.edu! http://www.utstat.utoronto.ca/~rsalakhu/ Sidney Smith Hall, Room 6002 Lecture 11 Project

More information

INF4820: Algorithms for Artificial Intelligence and Natural Language Processing. Hidden Markov Models

INF4820: Algorithms for Artificial Intelligence and Natural Language Processing. Hidden Markov Models INF4820: Algorithms for Artificial Intelligence and Natural Language Processing Hidden Markov Models Murhaf Fares & Stephan Oepen Language Technology Group (LTG) October 27, 2016 Recap: Probabilistic Language

More information

Natural Language Processing

Natural Language Processing Natural Language Processing Global linear models Based on slides from Michael Collins Globally-normalized models Why do we decompose to a sequence of decisions? Can we directly estimate the probability

More information

Lecture 3: ASR: HMMs, Forward, Viterbi

Lecture 3: ASR: HMMs, Forward, Viterbi Original slides by Dan Jurafsky CS 224S / LINGUIST 285 Spoken Language Processing Andrew Maas Stanford University Spring 2017 Lecture 3: ASR: HMMs, Forward, Viterbi Fun informative read on phonetics The

More information

Graphical Models for Collaborative Filtering

Graphical Models for Collaborative Filtering Graphical Models for Collaborative Filtering Le Song Machine Learning II: Advanced Topics CSE 8803ML, Spring 2012 Sequence modeling HMM, Kalman Filter, etc.: Similarity: the same graphical model topology,

More information

Lecture 4. Generative Models for Discrete Data - Part 3. Luigi Freda. ALCOR Lab DIAG University of Rome La Sapienza.

Lecture 4. Generative Models for Discrete Data - Part 3. Luigi Freda. ALCOR Lab DIAG University of Rome La Sapienza. Lecture 4 Generative Models for Discrete Data - Part 3 Luigi Freda ALCOR Lab DIAG University of Rome La Sapienza October 6, 2017 Luigi Freda ( La Sapienza University) Lecture 4 October 6, 2017 1 / 46 Outline

More information

Probabilistic Models for Sequence Labeling

Probabilistic Models for Sequence Labeling Probabilistic Models for Sequence Labeling Besnik Fetahu June 9, 2011 Besnik Fetahu () Probabilistic Models for Sequence Labeling June 9, 2011 1 / 26 Background & Motivation Problem introduction Generative

More information

LECTURER: BURCU CAN Spring

LECTURER: BURCU CAN Spring LECTURER: BURCU CAN 2017-2018 Spring Regular Language Hidden Markov Model (HMM) Context Free Language Context Sensitive Language Probabilistic Context Free Grammar (PCFG) Unrestricted Language PCFGs can

More information

Lecture 7 Sequence analysis. Hidden Markov Models

Lecture 7 Sequence analysis. Hidden Markov Models Lecture 7 Sequence analysis. Hidden Markov Models Nicolas Lartillot may 2012 Nicolas Lartillot (Universite de Montréal) BIN6009 may 2012 1 / 60 1 Motivation 2 Examples of Hidden Markov models 3 Hidden

More information