Download presentation

Presentation is loading. Please wait.

Published byCelia Tanguay Modified over 3 years ago

1
Three Basic Problems 1.Compute the probability of a text (observation) language modeling – evaluate alternative texts and models P m (W 1,N ) 2.Compute maximum probability tag (state) sequence Tagging/classification arg max T 1,N P m (T 1,N | W 1,N ) 3.Compute maximum likelihood model training / parameter estimation arg max m P m (W 1,N )

2
Compute Text Probability Recall: P(W,T) = i P(t i-1 t i ) P(w i | t i ) Text probability: need to sum P(W,T) over all possible sequences – an exponential number Dynamic programming approach – similar to the Viterbi algorithm Will be used also for estimating model parameters from an untagged corpus

3
Forward Algorithm Define: A i (k) = P(w 1,k, t k = t i ); N t – total num. of tags For i = 1 To N t : A i (1) = m(t 0 t i )m(w 1 | t i ) 1.For k = 2 To N; For j = 1 To N t : i.A j (k) = [ i A i (k-1)m(t i t j ) ] m(w k | t j ) 2.Then: P m (W 1,N ) = i A i (N) Complexity = O(N t 2 N) (like Viterbi, instead of max)

4
Forward Algorithm t1t1 t2t2 t5t5 t4t4 t3t3 w1w1 t1t1 t2t2 t5t5 t4t4 t3t3 w2w2 t1t1 t2t2 t5t5 t4t4 t3t3 w3w3 A 1 (1) A 2 (1) A 5 (1) A 4 (1) A 3 (1) m(t 0 t i ) A 1 (2) A 2 (2) A 5 (2) A 4 (2) A 3 (2) A 1 (3) A 2 (3) A 5 (3) A 4 (3) A 3 (3) m(t 1 t 1 ) m(t 2 t 1 ) m(t 3 t 1 ) m(t 4 t 1 ) m(t 5 t 1 ) m(t 1 t 1 ) m(t 2 t 1 ) m(t 3 t 1 ) m(t 4 t 1 ) m(t 5 t 1 ) P m (W 1,3 )

5
Backward Algorithm Define B i (k) = P(w k+1,N | t k =t i ) 1.For i = 1 To N t : B i (N) = 1 2.For k = N-1 To 1; For j = 1 To N t : i.B j (k) = [ i m(t j t i )m(w k+1 | t i )B i (k+1) ] 3.Then: P m (W 1,N ) = i m(t 0 t i )m(w 1 | t i ) B i (1) Complexity = O(N t 2 N)

6
Backward Algorithm t1t1 t2t2 t5t5 t4t4 t3t3 w1w1 t1t1 t2t2 t5t5 t4t4 t3t3 w2w2 t1t1 t2t2 t5t5 t4t4 t3t3 w3w3 B 1 (1) B 2 (1) B 5 (1) B 4 (1) B 3 (1) m(t 0 t i ) B 1 (2) B 2 (2) B 5 (2) B 4 (2) B 3 (2) B 1 (3) B 2 (3) B 5 (3) B 4 (3) B 3 (3) m(t 1 t 1 ) m(t 2 t 1 ) m(t 3 t 1 ) m(t 4 t 1 ) m(t 5 t 1 ) m(t 1 t 1 ) m(t 2 t 1 ) m(t 3 t 1 ) m(t 4 t 1 ) m(t 5 t 1 ) P m (W 1,3 )

7
Estimation from Untagged Corpus: EM – Expectation-Maximization 1.Start with some initial model 2.Compute the probability of (virtually) each state sequence given the current model 3.Use this probabilistic tagging to produce probabilistic counts for all parameters, and use these probabilistic counts to estimate a revised model, which increases the likelihood of the observed output W in each iteration 4.Repeat until convergence Note: No labeled training required. Initialize by lexicon constraints regarding possible POS for each word (cf. “noisy counting” for PP’s)

8
Notation a ij = Estimate of P(t i t j ) b jk = Estimate of P(w k | t j ) A i (k) = P(w 1,k, t k =t i ) (from Forward algorithm) B i (k) = P(w k+1,N | t k =t i ) (from Backwards algorithm)

9
Estimating transition probabilities Define p k (i,j) as prob. of traversing arc t i t j at time k given the observations: p k (i,j)= P(t k = t i, t k+1 = t j | W) = P(t k = t i, t k+1 = t j,W) / P(W) =

10
Expected transitions Define g i (k) = P(t k = t i | W), then: g i (k) = Now note that: –Expected number of transitions from tag i = –Expected transitions from tag i to tag j =

11
Re-estimation of Maximum Likelihood Parameters a’ ij = = b’ ik = =

12
EM Algorithm 1.Choose initial model = 2.Repeat until results don’t improve (much): 1.Compute p k based on current model, using Forward & Backwards algorithms to compute A and B (Expectation for counts) 2.Compute new model (Maximization of parameters) Note: Output likelihood is guaranteed to increase in each iteration, but might converge to a local maximum!

13
Initialize Model by Dictionary Constraints Training should be directed to correspond to the linguistic perception of POS (recall local max) Achieved by a dictionary with possible POS for each word Word-based initialization: –P(w|t) = 1 / #of listed POS for w, for the listed POS; and 0 for unlisted POS Class-based initialization (Kupiec, 1992): –Group all words with the same possible POS into a ‘metaword’ –Estimate parameters and perform tagging for metawords –Frequent words are handled individually

14
Some extensions for HMM POS tagging Higher-order models: trigrams, possibly interpolated with bigrams Incorporating text features: –Output prob = P(w i,f j | t k ) where f is a vector of features (capitalized, ends in –d, etc.) –Features useful to handle unknown words Combining labeled and unlabeled training (initialize with labeled then do EM)

15
Transformational Based Learning (TBL) for Tagging Introduced by Brill (1995) Can exploit a wider range of lexical and syntactic regularities via transformation rules – triggering environment and rewrite rule Tagger: –Construct initial tag sequence for input – most frequent tag for each word –Iteratively refine tag sequence by applying “transformation rules” in rank order Learner: –Construct initial tag sequence for the training corpus –Loop until done: Try all possible rules and compare to known tags, apply the best rule r* to the sequence and add it to the rule ranking

16
Some examples 1. Change NN to VB if previous is TO –to/TO conflict/NN with VB 2. Change VBP to VB if MD in previous three –might/MD vanish/VBP VB 3. Change NN to VB if MD in previous two –might/MD reply/NN VB 4. Change VB to NN if DT in previous two –the/DT reply/VB NN

17
Transformation Templates Specify which transformations are possible For example: change tag A to tag B when: 1.The preceding (following) tag is Z 2.The tag two before (after) is Z 3.One of the two previous (following) tags is Z 4.One of the three previous (following) tags is Z 5.The preceding tag is Z and the following is W 6.The preceding (following) tag is Z and the tag two before (after) is W

18
Lexicalization New templates to include dependency on surrounding words (not just tags): Change tag A to tag B when: 1.The preceding (following) word is w 2.The word two before (after) is w 3.One of the two preceding (following) words is w 4.The current word is w 5.The current word is w and the preceding (following) word is v 6.The current word is w and the preceding (following) tag is X (Notice: word-tag combination) 7.etc…

19
Initializing Unseen Words How to choose most likely tag for unseen words? Transformation based approach: –Start with NP for capitalized words, NN for others –Learn “morphological” transformations from: Change tag from X to Y if: 1.Deleting prefix (suffix) x results in a known word 2.The first (last) characters of the word are x 3.Adding x as a prefix (suffix) results in a known word 4.Word W ever appears immediately before (after) the word 5.Character Z appears in the word

20
Unannotated Input Text Annotated Text Ground Truth for Input Text Rules Setting Initial State Learning Algorithm TBL Learning Scheme

21
Greedy Learning Algorithm Initial tagging of training corpus – most frequent tag per word At each iteration: –Compute “error reduction” for each transformation rule: #errors fixed - #errors introduced –Find best rule; If error reduction greater than a threshold (to avoid overfitting): Apply best rule to training corpus Append best rule to ordered list of transformations

22
Morphological Richness Parts of speech really include features: –NN2 Noun(type=common,num=plural) This is more visible in other languages with richer morphology: –Hebrew nouns: number, gender, possession –German nouns: number, gender, case, … –And so on…

Similar presentations

OK

S. Salzberg CMSC 828N 1 Three classic HMM problems 2.Decoding: given a model and an output sequence, what is the most likely state sequence through the.

S. Salzberg CMSC 828N 1 Three classic HMM problems 2.Decoding: given a model and an output sequence, what is the most likely state sequence through the.

© 2019 SlidePlayer.com Inc.

All rights reserved.

To make this website work, we log user data and share it with processors. To use this website, you must agree to our Privacy Policy, including cookie policy.

Ads by Google