# Bigram probabilistic model

bigram statistics: $$\displaystyle p(l_i| l_{i+1}) = \frac{p(l_i, l_{i+1})}{p(l_i)}$$ we use MLE estimate for this value which is just frequency: $$\displaystyle\frac{count(l_i, l_{i+1})}{count(l_i)}$$ where $l_i$ is $i$th letter in text

likelihood becomes: $$\displaystyle p(x|f) = \Pi_{i=1}^{|x|} \frac{count(f(l_i), f(l_{i+1}))}{count(f(l_i))}$$

so posterior is: $$\displaystyle p(f|x) = \frac{\frac{1}{|A!|} p(x|f)}{p(x)} = \frac{\Pi_{i=1}^{|x|} \frac{count(f(l_i), f(l_{i+1}))}{count(f(l_i))}}{Z}$$ We are looking for the mode of posterior distribution: $$\displaystyle f^∗ = {\operatorname{arg}}\underset{f}{\operatorname{max}} p(f|x)$$



In [0]:




In [ ]: