Inside–outside algorithm

From testwiki
Jump to navigation Jump to search

Template:Short description For parsing algorithms in computer science, the inside–outside algorithm is a way of re-estimating production probabilities in a probabilistic context-free grammar. It was introduced by James K. Baker in 1979 as a generalization of the forward–backward algorithm for parameter estimation on hidden Markov models to stochastic context-free grammars. It is used to compute expectations, for example as part of the expectation–maximization algorithm (an unsupervised learning algorithm).

Inside and outside probabilities

The inside probability βj(p,q) is the total probability of generating words wpwq, given the root nonterminal Nj and a grammar G:[1]

βj(p,q)=P(wpq|Npqj,G)

The outside probability αj(p,q) is the total probability of beginning with the start symbol N1 and generating the nonterminal Npqj and all the words outside wpwq, given a grammar G:[1]

αj(p,q)=P(w1(p1),Npqj,w(q+1)m|G)

Computing inside probabilities

Base Case:

βj(p,p)=P(wp|Nj,G)

General case:

Suppose there is a rule NjNrNs in the grammar, then the probability of generating wpwq starting with a subtree rooted at Nj is:

k=pk=q1P(NjNrNs)βr(p,k)βs(k+1,q)

The inside probability βj(p,q) is just the sum over all such possible rules:

βj(p,q)=Nr,Nsk=pk=q1P(NjNrNs)βr(p,k)βs(k+1,q)

Computing outside probabilities

Base Case:

αj(1,n)={1if j=10otherwise

Here the start symbol is N1.

General case:

Suppose there is a rule NrNjNs in the grammar that generates Nj. Then the left contribution of that rule to the outside probability αj(p,q) is:

k=q+1k=nP(NrNjNs)αr(p,k)βs(q+1,k)

Now suppose there is a rule NrNsNj in the grammar. Then the right contribution of that rule to the outside probability αj(p,q) is:

k=1k=p1P(NrNsNj)αr(k,q)βs(k,p1)

The outside probability αj(p,q) is the sum of the left and right contributions over all such rules:

αj(p,q)=Nr,Nsk=q+1k=nP(NrNjNs)αr(p,k)βs(q+1,k)+Nr,Nsk=1k=p1P(NrNsNj)αr(k,q)βs(k,p1)

References

Template:Reflist