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 wp⋯wq, given the root nonterminal Nj and a grammar G:
β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 wp⋯wq, given a grammar G:
αj(p,q)=P(w1(p−1),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 Nj→NrNs in the grammar, then the probability of generating wp⋯wq starting with a subtree rooted at Nj is: ∑k=pk=q−1P(Nj→NrNs)β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,Ns∑k=pk=q−1P(Nj→NrNs)β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 Nr→NjNs 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(Nr→NjNs)αr(p,k)βs(q+1,k) Now suppose there is a rule Nr→NsNj in the grammar. Then the right contribution of that rule to the outside probability αj(p,q) is: ∑k=1k=p−1P(Nr→NsNj)αr(k,q)βs(k,p−1) The outside probability αj(p,q) is the sum of the left and right contributions over all such rules: αj(p,q)=∑Nr,Ns∑k=q+1k=nP(Nr→NjNs)αr(p,k)βs(q+1,k)+∑Nr,Ns∑k=1k=p−1P(Nr→NsNj)αr(k,q)βs(k,p−1)
References
J. Baker (1979): Trainable grammars for speech recognition. In J. J. Wolf and D. H. Klatt, editors, Speech communication papers presented at the 97th meeting of the Acoustical Society of America, pages 547–550, Cambridge, MA, June 1979. MIT. Karim Lari, Steve J. Young (1990): The estimation of stochastic context-free grammars using the inside–outside algorithm. Computer Speech and Language, 4:35–56. Karim Lari, Steve J. Young (1991): Applications of stochastic context-free grammars using the Inside–Outside algorithm. Computer Speech and Language, 5:237–257. Fernando Pereira, Yves Schabes (1992): Inside–outside reestimation from partially bracketed corpora. Proceedings of the 30th annual meeting on Association for Computational Linguistics, Association for Computational Linguistics, 128–135.
External links Inside-outside algorithm - Fei Xia The Inside-Outside Algorithm - Michael Collins