Snapchat · ML & AI Fundamentals
Derive logistic regression and thresholds
TrueInterview
October 7, 2026 · 1 min read
- Define the logistic (sigmoid) function and write the Bernoulli log-likelihood for binary logistic regression. Derive the gradient and Hessian with respect to for L2-regularized logistic regression, and explain why the objective is convex.
- With a single feature , and , compute ; report the odds and the odds ratio for a one-unit increase in .
- If the positive class base rate is 2% and a false negative costs 10 times as much as a false positive, compute the Bayes-optimal decision threshold and explain how you would calibrate probabilities (e.g., Platt scaling vs isotonic regression).
- Give numerically stable formulas for and , and explain why they avoid overflow/underflow.
- Explain how severe class imbalance affects maximum likelihood estimates and which regularization or reweighting you would use; justify analytically.
Overview: This question tests logistic regression knowledge and related skills: deriving the Bernoulli log-likelihood, computing the gradient and Hessian for L2-regularized models, reasoning about convexity, calibrating probabilities and setting decision thresholds under asymmetric costs, using numerically stable log-sigmoid expressions, and analyzing class imbalance effects. It falls under Statistics & Math for data scientist roles and is frequently asked because it blends conceptual/theoretical derivations with practical application, assessing both mathematical reasoning (derivations and convexity proofs) and applied understanding of thresholds, calibration, numerical stability, and regularization.