Smoothing gives a small amount of probability to events that were never seen in training.
Let's say our training text is 2 sentences:
the cat satthe dog sat
Problem
- n-gram probabilities are learned by counting, which is maximum likelihood estimation
- so it counts
the dogonce andthe catonce - maximum likelihood gives all the mass to observed events, so anything unseen like
the birdgets a probability of - so
P(bird|the)= = - one unseen n-gram makes the probability of the whole sentence , even when the sentence is completely normal and correct
Solution: Smoothing
- it moves a little mass from the seen events to the unseen ones
- meaning we add 1 to every count before dividing
- so the count of
the birdgoes from to - the denominator grows too, so the pairs we really saw did lose a bit of probability
the birdnow gets a small probability instead of- the model can then score the sentence
The zero probability problem it fixes comes from the counting step in N-gram Language Models.
Add-one smoothing is used outside language models too, because Naive Bayes (NB) applies it to word counts for the same reason.