The interview problem

Practice prompt

Use a Dirichlet prior to estimate category proportions from a small multinomial sample.

Original practice, not a reported company interview. Scenarios and numbers are illustrative. Interview date: not applicable. Sources retrieved October 1, 2026.

1. Scope and worked approach

Assume independent draws from one fixed categorical distribution and an explicit prior vector alpha. Add observed category counts to alpha; normalize posterior parameters to obtain posterior mean probabilities. Keep posterior uncertainty rather than treating pseudocounts as observed data. Check that category definitions are exhaustive and mutually exclusive. This conjugate update is appropriate for a stationary toy model, not automatically for a changing event stream.

2. Trace the design or derivation

Choose prior
  → count categories
  → add parameters
  → normalize means
  → inspect uncertainty

The posterior predictive probability of the next category equals its posterior mean under this model. The variance of that probability is not the variance of a single categorical outcome. Keeping those distinct prevents a common mistake: claiming that a confident estimate makes individual future draws predictable.

3. Calculate the example

With prior (1,1,1) and counts (6,3,0), posterior parameters are (7,4,1), totaling 12. Posterior means are 7/12, 1/3 and 1/12. The unseen category retains positive probability rather than being declared impossible.

4. Failure cases and trade-offs

A strong prior can dominate sparse evidence; exchangeability fails when source populations differ. Adding a new category after fitting changes the model and prior mass allocation. A flat prior is a modeling choice, not absence of assumptions. Use sensitivity checks for decisions near a threshold.

5. Validation, follow-ups and self-review

Verify probabilities sum to one and explore larger prior concentration at the same mean. Follow-up: how would separate customer populations be partially pooled? Self-review: distinguish prior counts, observed counts and posterior uncertainty.

Sources and related practice

Technical reference: docs.scipy.org — Dirichlet distribution parameters and moments.

Source publication/update: Not established. Retrieved October 1, 2026. The workflow, calculations and review exercises are original; this reference is not evidence that a company asked this question.

Continue with Update a conversion probability with a beta prior; Reason about base rates and diagnostic evidence.

Continue your preparation

Choose a connected learning path or browse more ML fundamentals questions. Read our editorial method and attribution policy.