The interview problem

Practice prompt

A new feature has few conversion observations. Use a beta prior to estimate its probability, explain the posterior and distinguish uncertainty in the rate from variability of future outcomes.

Original practice, not a reported company interview. All scenarios and worked numbers are illustrative. Interview date: not applicable. Sources retrieved September 30, 2026.

1. Scope and assumptions

Assume conditionally independent Bernoulli outcomes with a stable common probability p. A convenient conjugate model does not justify pooling different populations or ignoring experiment assignment.

2. Worked approach

With prior Beta(a,b), multiply its density by the likelihood p^s(1−p)^f. The posterior is Beta(a+s,b+f). The posterior mean is (a+s)/(a+b+s+f), while a single future Bernoulli success has that same posterior predictive probability.

Choose the prior before inspecting the target results and document its interpretation. For multiple future outcomes, integrate over the shared uncertain p; they are not marginally independent after that integration. Use posterior quantiles for a credible interval rather than calling the posterior mean a confidence bound.

3. Calculate the example

Start with Beta(2,8), mean 0.2 and concentration 10. After 3 successes and 7 failures, the posterior is Beta(5,15), with mean 0.25 and variance 5×15/(20²×21)=1/112 ≈ 0.008929. The raw observed rate is 0.3. For four future trials, predictive mean successes is 1; beta-binomial variance is 4×5×15×24/(20²×21)=6/7 ≈ 0.8571, larger than the binomial variance 4×0.25×0.75=0.75 using a fixed p.

4. Failure cases and trade-offs

Repeated observations from the same user violate the independence assumption. A changing conversion process makes old evidence less relevant. A highly concentrated prior can dominate a small dataset even if described casually as weak.

Conjugacy gives transparent updates but limits the model. Hierarchical or time-varying models handle different groups or drift at more complexity. A posterior decision still needs a utility function and an experimental design if the question is causal.

5. Validate the result

Recover the prior when no data arrive, verify posterior parameters after sequential versus batched updates, and compare prior sensitivity. Simulate predictive counts to check overdispersion relative to the plug-in binomial.

6. Interview follow-ups and self-review

What if all observations are failures? Is a 95% credible interval a repeated-sampling coverage promise?

Reward the density update, exact arithmetic, prior sensitivity and parameter-versus-predictive uncertainty.

Sources and related practice

Technical reference: docs.scipy.org — Beta distribution reference; conjugate derivation and predictive example are original.

Exact publication/update date not established in this review. Retrieved September 30, 2026. This reference supports the named technical concept; the proposed workflow and examples are original, not a documented vendor implementation or interview report.

Continue with Reason about base rates and diagnostic evidence; Interpret uncertainty and confidence intervals in model evaluation.

Continue your preparation

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