Which probability distributions matter most in ML, and when do you use each?
Written by the mlprep team · Updated
Walk me through the probability distributions you encounter most often in ML engineering — not just what they are, but where they show up in real systems and why they matter for modeling decisions.
Every ML model implicitly or explicitly assumes a distribution over the data. Choosing the wrong distribution means your model optimizes for the wrong thing. Here are the distributions that actually matter in practice:
Normal (Gaussian) — continuous data with symmetric noise#
Where it appears:
- Measurement noise in sensors, user ratings, financial returns (approximately)
- The loss function in linear regression (MSE = maximum likelihood under Gaussian noise)
- Weight initialization in neural networks (Xavier and He init draw from Gaussians)
- The Central Limit Theorem: means of large samples are approximately normal regardless of the underlying distribution
When it matters in ML: if you use MSE loss, you're assuming Gaussian-distributed residuals. If your data has heavy tails (outliers are common), MSE overweights outliers. Switch to MAE (Laplace assumption) or Huber loss.
Bernoulli — binary outcomes#
Where it appears:
- Click / no click
- Churn / retain
- Fraud / legitimate
- Any binary classification target
When it matters: binary cross-entropy loss = negative log-likelihood under Bernoulli. The sigmoid output of your classifier is literally the parameter p of a Bernoulli distribution. If you're predicting click probability, your model is fitting a Bernoulli distribution conditioned on features.
Categorical (Multinoulli) — multi-class outcomes#
The generalization of Bernoulli to K outcomes. Softmax outputs are categorical distribution parameters. Cross-entropy loss = negative log-likelihood under categorical distribution.
Poisson — count data#
Where it appears:
- Number of events in a time window: ad impressions per hour, errors per day, support tickets per week
- Any time you're predicting "how many" (counts ≥ 0, no upper bound)
When it matters: if you're predicting counts and use MSE loss (Gaussian assumption), you implicitly allow negative predictions and assume symmetric errors. Poisson regression (use a log link function and Poisson log-likelihood) respects that counts are non-negative and that variance equals the mean. For overdispersed counts (variance > mean), use Negative Binomial instead.
Exponential / Weibull — time-to-event#
Where it appears:
- Time until next purchase
- Time until churn
- Session duration
- Any "survival analysis" problem
When it matters: predicting "when will this user churn" is fundamentally different from predicting "will this user churn." Survival models (Cox proportional hazards, parametric survival with Weibull) handle censored data — users who haven't churned yet. Standard classification ignores this temporal structure.
Beta — probability of probability#
Where it appears:
- Prior distribution over probabilities (click-through rates, conversion rates)
- Bayesian A/B testing: each arm has a Beta posterior
- Thompson sampling: sample from Beta to decide which arm to pull
When it matters: when you have small samples and need to estimate a rate. With 3 clicks out of 5 impressions, the MLE is 60% — absurdly high. A Beta(1,1) prior (uniform) gives a posterior mean of 4/7 = 57%, Beta(2,20) prior (informed by typical CTRs) gives something much more reasonable.
Log-Normal — positive continuous data with multiplicative effects#
Where it appears:
- Income, prices, stock returns, file sizes, durations
- Anything that's always positive and has a long right tail
When it matters: if you're predicting revenue per user and use MSE, you're heavily penalized by a few whales while ignoring the mass of regular users. Predicting log(revenue) with MSE, or using a log-normal likelihood, properly weights the bulk of the distribution.
You mentioned that using MSE assumes Gaussian residuals. In practice, most real-world data isn't perfectly Gaussian. How much does this assumption violation actually matter, and when should you switch to a different loss function?
In practice, mild departures from Gaussianity don't matter much for prediction. The Central Limit Theorem helps: even if individual observations aren't Gaussian, the mean of a batch of residuals tends toward normality. For prediction tasks, MSE works fine even with moderately non-Gaussian residuals.
When it breaks down#
-
Heavy tails (outliers): if 1% of your data has values 100x larger than typical, MSE goes haywire. Those 1% of points dominate the loss, pulling the model toward accommodating outliers at the expense of the 99%.
- Symptom: model has reasonable accuracy on most examples but terrible predictions on "normal" examples because it's distorted by outliers
- Fix: use Huber loss (MSE for small errors, MAE for large errors), or MAE (L1 loss, which has Laplace distribution assumption)
- Alternative: clip or winsorize outliers, then use MSE
-
Asymmetric errors: weather forecasting, demand prediction, risk scoring — overestimates and underestimates have different costs. A Gaussian assumption says +10 and -10 errors are equally bad.
- Fix: use quantile regression or asymmetric loss:
loss = α × error if error > 0 else (1-α) × |error|
- Fix: use quantile regression or asymmetric loss:
-
Bounded or strictly positive targets: if you're predicting probability [0,1] with MSE on raw outputs, the model can predict -0.3 or 1.5. If predicting counts (≥0), the model can predict -2.
- Fix: apply appropriate link functions (sigmoid for probabilities, exp for counts) and use the corresponding likelihood (BCE, Poisson NLL)
-
Heteroscedastic noise: the noise level varies with the input. Urban areas have noisier real estate prices than suburban areas. A single MSE assumes constant noise everywhere.
- Fix: predict both mean and variance — the model outputs μ(x) and σ²(x). Loss becomes the Gaussian NLL:
log(σ²) + (y - μ)² / σ². This naturally upweights clean examples and downweights noisy ones.
- Fix: predict both mean and variance — the model outputs μ(x) and σ²(x). Loss becomes the Gaussian NLL:
Rule of thumb: start with MSE. Look at the residual distribution. If it's roughly symmetric and light-tailed, MSE is fine. If you see heavy tails, use Huber. If you see asymmetry, use quantile loss. If the target is bounded/positive, use the appropriate distribution.
The key takeaway unlocks after you reveal an expert answer.
Key Takeaway
Every ML loss function implies a distributional assumption: MSE→Gaussian, BCE→Bernoulli, CE→Categorical, Poisson NLL→Poisson. Choosing the right distribution means your model optimizes for the right thing. Key patterns: Gaussian for symmetric continuous data, Poisson for counts, Exponential/Weibull for time-to-event, Beta for rates with small samples, LogNormal for positive heavy-tailed data. When assumptions break down (outliers, asymmetry, bounded targets), switch to the loss function that matches your data's actual distribution.
Follow-up Questions to Test Yourself
Interviewers often pivot here once you cover the core concept.
- How would you decide between Poisson regression and Negative Binomial regression for count data? What diagnostic tells you which is appropriate?
- Explain how the reparameterization trick in VAEs relates to probability distributions — what problem does it solve?
- Your team wants to predict "time until user returns to the app." Why is standard regression inappropriate, and what distribution/model family would you use?
How confident do you feel explaining this?
Track your understanding or flag it to revisit before your next loop.
Related Questions
Walk me through how you'd design and analyze an A/B test
Explain Bayesian vs. frequentist thinking — when does each matter in ML?
Why does the Central Limit Theorem matter for ML and statistics?
What is model calibration and how do you fix a miscalibrated model?