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 ) {\displaystyle \beta _{j}(p,q)} is the total probability of generating words w p ⋯ w q {\displaystyle w_{p}\cdots w_{q}} , given the root nonterminal N j {\displaystyle N^{j}} and a grammar G {\displaystyle G} :
β j ( p , q ) = P ( w p q | N p q j , G ) {\displaystyle \beta _{j}(p,q)=P(w_{pq}|N_{pq}^{j},G)}
The outside probability α j ( p , q ) {\displaystyle \alpha _{j}(p,q)} is the total probability of beginning with the start symbol N 1 {\displaystyle N^{1}} and generating the nonterminal N p q j {\displaystyle N_{pq}^{j}} and all the words outside w p ⋯ w q {\displaystyle w_{p}\cdots w_{q}} , given a grammar G {\displaystyle G} :
α j ( p , q ) = P ( w 1 ( p − 1 ) , N p q j , w ( q + 1 ) m | G ) {\displaystyle \alpha _{j}(p,q)=P(w_{1(p-1)},N_{pq}^{j},w_{(q+1)m}|G)}
Computing inside probabilities Base Case:
β j ( p , p ) = P ( w p | N j , G ) {\displaystyle \beta _{j}(p,p)=P(w_{p}|N^{j},G)}
General case: Suppose there is a rule N j → N r N s {\displaystyle N_{j}\rightarrow N_{r}N_{s}} in the grammar, then the probability of generating w p ⋯ w q {\displaystyle w_{p}\cdots w_{q}} starting with a subtree rooted at N j {\displaystyle N_{j}} is:
∑ k = p k = q − 1 P ( N j → N r N s ) β r ( p , k ) β s ( k + 1 , q ) {\displaystyle \sum _{k=p}^{k=q-1}P(N_{j}\rightarrow N_{r}N_{s})\beta _{r}(p,k)\beta _{s}(k+1,q)}
The inside probability β j ( p , q ) {\displaystyle \beta _{j}(p,q)} is just the sum over all such possible rules:
… excerpt ends here. Continue reading the full article.
