Markov Models PA154 Jazykové modelovaní (5.1) Pavel Rychlý pary (9fi.muni.cz March 30, 2021 Source: Introduction to Natural Language Processing (600.465) Jan Hajic, CS Dept., Johns Hopkins Univ. www.cs.jhu.edu/~hajic Review: Markov Process Bayes formula (chain rule): P{W) = P(wi, 1/1/2, W/T) = n/=i..rp(w/ I ffllfflfy/.f, Wi-n+i 1 '' J n-gram language models: ► Markov process (chain) of the order n-1: l) P(W) = P(wi, w2..., i/i/t) = ri/=i..rp(w/ | w/_n+i, w/_,,+25 • w;-i) Using just one distribution (Ex.: trigram model: p{w; | i/i/;_2, vv/-i)) Positions: 12 34 56 7 8 9 10 11 12 13 14 15 16 and within hours Bob 's can Words: My car broke down , broke down , too . p(,| broke down) = p(w$ | 1/1/3. W4) = p(wu | W12, w/13) PA154 Jazykové modelování (5.1) Markov Models 2/15 Markov Properties ■ Generalize to any process (not just words/LM): ► Sequence of random variables: X = (Xl, X2,..., X7-) ► Sample space S (states), size N: S = (So, Si, S2,..., S/v) 1. Limited History (Context, Horizon): V/ G 1..T; P(X(- I Xi, ..,X/_i) = (X; I X/_i) 17379067 04 5 17 3 7 9 0 6 3 4 5 Time invariance (M.C. is stationary, homogenous) V/ G 1..T, Vy,x e S; P(X, = y | X,-_i = x) = p(y !0[I]lY]l1]O6lz]L1]45--- x) ok... same distribution PA154 Jazykové modelování (5.1) Markov Models 3/15 Long History Possible What if we want trigrams: 1 7 3 7 9 0 r^T] |T1 4 5 Formally, use transformation: Define new variables Q;, suchthatX; = (?,-: Then P(Xi I X;_i) = P((?/_i, Qi I Qi-2, Qi Predicting (X/) 1 7 3 7 [ÖT| 6 7 3 4 5... t T TT \ T T T T T History (X/ = {Q,_2,Q;-i}): Markov Models Graph Representation: State Diagram ■ S = {so, si, S2,..., sn}: states ■ Distribution P(X; | X/_i): ► transitions (as arcs) with probabilities attached to them: Bigram case: PA154 Jazykové modelování (5.1) p(toe) = .6 x .88 x 1 = .528 Markov Models 5/15 The Trigram Case p(toe) = .6 x .88 x .07 = .037 p(one) PA154 Jazykové modelování (5.1) Markov Models Finite State Automaton States ~ symbols of the [input/output] alphabet ► pairs (or more): last element of the n-tuple Arcs ~ transitions (sequence of states) [Classical FSA: alphabet symbols on arcs: ► transformation: arcs