Math & Statistics FoundationsFoundational17 min read5 questions

Probability & Bayesian Thinking for ML Interviews

The probability questions that separate candidates: base rates, why MLE is just cross-entropy in disguise, MAP as regularisation, and the distribution choices baked into every loss function.

Covers: Bayes theorem, conditional probability, distributions, expectation & variance, MLE vs MAP, sampling

Probability shows up in ML interviews in two disguises. The obvious one is a brainteaser about base rates or a coin. The subtle one — and the one that decides your level — is when the interviewer asks why you used cross-entropy loss, or what your model's 0.9 output actually means.

Every loss function is a likelihood in disguise. Once you see that, cross-entropy, MSE and L1 stop being arbitrary choices and become statements about your noise model. This lesson makes that link explicit.

Filter
0/5 mastered
Foundationalbayesbase-rateimbalanced-dataAsked at Stripe, PayPal

30-second answer

About 1%. Even a 99%-accurate test produces ~100 false positives for every true positive when the base rate is 1 in 10,000. This is exactly why a fraud or rare-disease model with 99.9% accuracy can be useless, and why you report precision/recall at a realistic prevalence rather than accuracy.

Advancedmlemaploss-functionsAsked at Anthropic, Google Brain-lineage teams

30-second answer

MLE picks parameters maximising P(data|θ). MAP maximises P(θ|data) ∝ P(data|θ)P(θ), so it adds a prior. Taking the negative log turns MLE into a loss: a Gaussian noise assumption gives MSE, a Bernoulli/categorical assumption gives cross-entropy. A Gaussian prior on θ under MAP is exactly L2 regularisation; a Laplace prior is L1.

FoundationaldistributionsmodelingAsked at Netflix, Booking.com

30-second answer

Bernoulli/categorical for classification outputs, Gaussian for continuous noise and initialisation, Poisson for counts, Exponential for waiting times, Beta as the conjugate prior for rates (Thompson sampling), and the long-tailed Zipf/power-law for user and token frequency. Knowing which one your data follows tells you which loss and which sampling strategy to use.

Advancedbias-varianceexpectationgeneralizationAsked at Amazon, Microsoft

30-second answer

Expected squared error at a point decomposes into irreducible noise σ², squared bias (how far the average model is from truth), and variance (how much the model moves across training sets). You derive it by adding and subtracting the expected prediction E[f̂(x)] and showing the cross term vanishes.

Expertsamplingmonte-carlorlhfAsked at OpenAI, Netflix

30-second answer

Importance sampling estimates an expectation under distribution p while only being able to sample from q, by reweighting each sample by p(x)/q(x). It appears in off-policy RL and PPO's ratio term, in off-policy evaluation of recommenders and bandits, in negative sampling for embeddings, and in speculative decoding for LLMs.

Showing 5 of 5 questions for probability-for-ml-interviews.

Check your understanding

5 questions · no sign-up, nothing stored

0/5 answered
Question 1

1.A disease affects 1 in 10,000. A 99% sensitive, 99% specific test returns positive. P(disease | positive) is closest to:

Question 2

2.Minimising MSE is equivalent to maximum likelihood under which noise assumption?

Question 3

3.A Laplace prior on model weights under MAP estimation corresponds to:

Question 4

4.In the bias–variance decomposition, 'variance' is the expectation taken over what?

Question 5

5.Your importance-sampling estimator has an effective sample size of 12 out of 10,000 draws. What should you conclude?

Hands-on challenge

Build it — this is what you talk about in a deep-dive round.

Build a calibrated rare-event classifier

Take a 1:2000 imbalanced dataset and show, with numbers, why accuracy misleads and how to fix both the metric and the calibration.

Requirements

  • Train a baseline and report accuracy, ROC-AUC and PR-AUC side by side with a constant-predictor baseline.
  • Train a second model on undersampled negatives; show that its predicted probabilities are miscalibrated at true prevalence.
  • Apply prior correction and/or isotonic calibration; plot reliability curves before and after.
  • Derive the cost-optimal threshold for FN:FP = 250:1 and report the expected cost at that threshold.

Stretch goals

  • Implement a two-stage funnel and quantify the precision improvement at fixed recall.
  • Estimate the counterfactual precision of a different threshold using importance weights from logged scores.