Choosing a method¶
Start from the shape of your data and what you need the estimates for.
| Your situation | Methods | Key parameters |
|---|---|---|
| Relative frequencies, no smoothing | MLE |
— |
| A simple, robust default that never returns zero | Laplace, Lidstone, ELE |
bins, gamma |
| Smoothing framed as a prior belief | Bayesian |
alpha |
| Heavy-tailed counts with many rare elements | SimpleGoodTuring |
p_value, bins |
| A parameter-free estimate of the unseen mass | WittenBell |
bins |
| n-gram language models | KneserNey, ModifiedKneserNey |
discount |
| Bigram discounting with back-off to unigrams | AbsoluteDiscounting, PitmanYor |
discount, strength |
| Bigram back-off, normalized or fast | KatzBackoff, StupidBackoff |
k, alpha |
| Combining a specific and a general model | Interpolated, JelinekMercer |
lambda_weight |
| Reserving mass by how fully the support is covered (experimental) | CertaintyDegree |
bins |
| A non-informative baseline | Uniform, Random |
— |
By data characteristics:
| Vocabulary | Data | A good default |
|---|---|---|
| Small | dense: most elements seen often | MLE or Laplace |
| Large | sparse: many rare or unseen elements | SimpleGoodTuring, or Lidstone with a small gamma |
| Sequence contexts (n-grams) | any | KneserNey or ModifiedKneserNey |
| Any | a trusted background model is available | Interpolated |
Notes¶
Know the number of possible elements. The additive methods and Witten–Bell
spread the reserved mass over the bins possible elements, and with the
default (bins equal to the observed vocabulary) they reserve less than you
might expect. See Choose bins.
Prefer Simple Good–Turing for heavy tails. When many elements are seen once or twice, the number of singletons is direct evidence of how much mass is missing, and SGT uses it. It needs a spread of low counts to fit.
Use the n-gram methods for conditional probabilities. Kneser–Ney, absolute discounting and back-off model \(P(\text{word} \mid \text{context})\) from bigram counts. For a flat distribution over n-grams as elements, any of the other methods applies.
Compare on held-out data. The evaluation metrics score each candidate on data it was not fitted to; that, not the shape of the estimates, is the best guide.
The References page gives the published source of each method.