ML and Statistics Fundamentals: A Rapid-Fire Concept Review
Machine LearningModel answerLast updated
Answer a broad set of statistics and ML fundamentals questions, from moment generating functions to attention, then sketch a system that finds relevant users.
You are in a fast-paced technical screen for a machine learning role. The interviewer moves quickly through a series of conceptual questions and expects a short, correct answer to each, with more depth if they probe. Answer all of them.
Probability and statistics
- What is a moment generating function, and what is it used for?
- Compare the exponential and Poisson distributions. How are they related?
- What is the difference between statistical distance and statistical difference (significance)?
- Walk through the steps of a hypothesis test.
- State the Law of Large Numbers and explain why it matters in practice.
Classical ML
- What assumptions do machine-learning models commonly make?
- How does multicollinearity affect a Random Forest compared with XGBoost?
- How does the number of trees affect performance in each?
- Define overfitting and list ways to prevent it.
Deep learning
- Which deep-learning model families do you know well?
- Compare an RNN and an LSTM. What are the weaknesses of a plain RNN, and how is an LSTM built?
- What is an autoencoder, and where is it used?
- How does the attention mechanism work?
- Describe the architecture of a CNN.
Causality and design
- Explain the basic principles of causal inference.
- Design an ML system that identifies the most relevant users for some purpose (for example, for a campaign, a recommendation or an outreach). State your assumptions.
Keep each answer to a few sentences, include formulas where they help, and mention trade-offs and common pitfalls.
Hints
Hint 1
For distributions and tests, anchor on definitions and one formula each: the MGF is E[e^{tX}], Poisson counts events while exponential measures waiting time, and a test ends with a decision plus an effect size, not just a p-value.
Hint 2
For tree ensembles, think about how each method builds trees: bagging builds them independently and in parallel, boosting builds them sequentially to fix residuals. That difference drives both the multicollinearity and the number-of-trees answers.
Hint 3
For the system design question, start by clarifying what 'relevant' means and what label or proxy you have, then walk through data, candidate generation, ranking, evaluation (offline and online), and monitoring.
Model answer
Hard Try it yourself first — then compare your approach, complexity and edge cases.
Probability and statistics
Moment generating function. M_X(t) = E[e^{tX}], defined for t near 0.
- The n-th derivative at 0 equals E[Xⁿ], so E[X] = M'(0) and Var(X) = M''(0) − M'(0)².
- If two MGFs exist and agree near 0, the distributions are identical.
- For independent X, Y: M_{X+Y}(t) = M_X(t)·M_Y(t). This shows, for example, that a sum of independent Poissons is Poisson.
- It underlies proofs of the CLT and Chernoff-style tail bounds.
Exponential vs. Poisson. Both describe a Poisson process with rate λ. Poisson is the count of events in a window (discrete, mean and variance both λt). Exponential is the waiting time between events (continuous, mean 1/λ, variance 1/λ²). The exponential is memoryless: P(X > s+t | X > s) = P(X > t).
Statistical distance vs. statistical difference. Distance measures how far apart two distributions are: KL (asymmetric, so not a true metric), Jensen–Shannon, total variation, Wasserstein, Hellinger, the KS statistic. Use them for drift detection and comparing model outputs. Statistical difference asks whether an observed gap between samples is unlikely under "no difference," which is a hypothesis-testing question. A large distance can be insignificant with small samples, and a trivial one significant with huge samples, so always report effect size too.
Hypothesis test steps.
- State H₀ and H₁ (one- or two-sided).
- Fix α and desired power, then compute the sample size.
- Choose a test (t, z, χ², Mann–Whitney, permutation) and check its assumptions.
- Compute the statistic and p-value, which is P(data at least this extreme | H₀).
- Reject if p < α, otherwise fail to reject. Never "accept" H₀.
- Report effect size and a confidence interval, and correct for multiple comparisons (Bonferroni, Benjamini–Hochberg).
Law of Large Numbers. For i.i.d. variables with finite mean μ, the sample mean converges to μ (weak: in probability; strong: almost surely). It justifies Monte Carlo estimation and using empirical risk as a proxy for true risk. Do not confuse it with the CLT, which says the sample mean is approximately normal with standard error σ/√n.
Classical ML
Common assumptions.
- General: i.i.d. samples, train and serving distributions match (no covariate or concept shift), labels are accurate, and no leakage of features unavailable at inference.
- Linear regression: linear in parameters, independent homoscedastic errors, little multicollinearity. Logistic regression: linear log-odds.
- Naive Bayes: conditional independence. k-NN: meaningful, scaled distances.
Multicollinearity in RF vs. XGBoost. Predictions are mostly unaffected for both, since trees don't invert a matrix. Interpretation suffers. In a Random Forest, correlated features alternate across random feature subsets, so importance is diluted among them. In XGBoost, greedy sequential fitting lets one feature absorb the signal and leaves little for its twin, so importance concentrates on one arbitrary feature and may change between runs. Remedies: drop or cluster correlated features, use grouped permutation importance, and read SHAP with care.
Number of trees. Random Forest: more trees lower variance and then plateau; they do not cause overfitting, only cost compute and latency. Boosting: more trees keep reducing training loss and eventually overfit. Number of trees trades off against learning rate, so tune them together with early stopping on a validation set.
Overfitting. The model fits noise: low training error, high validation error (high variance). Prevention: more data or augmentation; simpler models or limits on depth and leaf size; L1/L2 regularization and dropout; early stopping; bagging; cross-validation for honest model selection; feature selection.
Deep learning
Families to name (only those you can defend): MLPs, CNNs (ResNet), RNN/LSTM/GRU, Transformers (BERT, GPT-style), autoencoders/VAEs, GANs, graph neural networks, two-tower recommenders.
RNN vs. LSTM. An RNN updates h_t = tanh(W h_{t−1} + U x_t + b). Drawbacks: vanishing or exploding gradients through repeated Jacobian products (clipping fixes only explosion), poor long-range memory, and sequential computation that resists parallelism. An LSTM adds a cell state with forget, input and output gates: c_t = f_t ⊙ c_{t−1} + i_t ⊙ c̃_t and h_t = o_t ⊙ tanh(c_t). The additive cell update gives gradients a path that does not shrink multiplicatively. GRU is a lighter two-gate variant.
Autoencoder. An encoder compresses input to a bottleneck z; a decoder reconstructs it; training minimizes reconstruction loss. Uses: nonlinear dimensionality reduction, anomaly detection (high reconstruction error on unseen patterns), denoising, representation pretraining, and generation (VAEs).
Attention. Each token is projected to a query, key and value. Attention(Q,K,V) = softmax(QKᵀ/√d_k)·V. Each output is a weighted average of values, with weights from query-key similarity. The √d_k scaling keeps softmax from saturating. Multi-head attention runs this in parallel subspaces. Cost is O(n²) in sequence length, and positional encodings are needed because attention is order-agnostic.
CNN architecture. Stacked convolution layers with shared, local filters (translation equivariance and few parameters), nonlinearity (ReLU), normalization, pooling or strided convolutions for downsampling, then fully connected or global-pooling layers and a softmax or regression head. Early layers learn edges, later layers learn parts and objects. Residual connections enable depth.
Causal inference
Correlation is not causation because of confounders, reverse causation and selection bias. The goal is to estimate the effect of a treatment, framed through potential outcomes (ATE = E[Y(1) − Y(0)]). Randomized experiments are the gold standard because randomization breaks confounding. With observational data you need assumptions (ignorability, overlap) and methods such as matching, propensity-score weighting, regression adjustment, difference-in-differences, instrumental variables or regression discontinuity. DAGs help decide what to control for; avoid conditioning on colliders or mediators.
Design: identify relevant users
- Clarify. What does relevant mean (likely to convert, engage, churn, or be a fit)? What is the action, scale and latency need (batch vs. real time)? Is the goal prediction or incremental uplift?
- Labels. Use historical outcomes as labels. Beware selection bias if past targeting was non-random. Prefer a randomized holdout for unbiased labels.
- Features. User profile, behavioral history, recency/frequency aggregates, context, and embeddings. Build them point-in-time correct to avoid leakage, via a feature store shared by training and serving.
- Model. Start with gradient-boosted trees as a baseline. Move to a two-tower or deep model if there is rich sequence or content data. Use uplift modeling when the target is incremental impact.
- Serving. Cheap candidate generation (rules or embedding retrieval) followed by a ranker; daily batch scoring if freshness allows, with online scoring for real-time cases.
- Evaluation. Offline: AUC, precision/recall at K, calibration, with time-based splits. Online: A/B test against a baseline on the business metric plus guardrails (fatigue, opt-outs, fairness across segments).
- Monitoring. Feature and score drift (PSI, KS), label delay, retraining cadence, and feedback-loop checks.
Common mistakes: random instead of temporal splits, leaking post-outcome features, treating p < 0.05 as proof of importance, claiming more trees overfit a Random Forest, and optimizing a proxy metric that diverges from the business goal.