PracHub
QuestionsPremiumLearningGuidesInterview PrepNEWCoaches
|Home/Machine Learning/Other

Contrast L1 and L2 regularization effects

Last updated: Mar 29, 2026

Quick Overview

This question evaluates a candidate's understanding of regularization techniques in supervised learning, covering the geometric intuition behind L1 versus L2 penalties, sparsity and bias–variance trade-offs, behavior under multicollinearity and elastic net considerations, algorithmic solution differences, and the penalized logistic regression objective and tuning. It is commonly asked in the Machine Learning domain to assess both conceptual understanding and practical application of model regularization, numerical stability, and reproducible hyperparameter selection, and the expected level spans conceptual reasoning and implementation-aware details.

  • hard
  • Other
  • Machine Learning
  • Data Scientist

Contrast L1 and L2 regularization effects

Company: Other

Role: Data Scientist

Category: Machine Learning

Difficulty: hard

Interview Round: Onsite

Compare Ridge (L2) vs Lasso (L1) in linear and logistic regression. (a) Explain shrinkage geometry and why L1 induces sparsity. (b) Are penalized estimates unbiased? Provide a derivation or counterexample and discuss bias–variance trade-offs. (c) Under strong multicollinearity, which penalty is preferable and why? (d) Describe coordinate descent and path algorithms; explain why solutions may differ across libraries due to penalty scaling, standardization, and grid choices. (e) For logistic regression, write the penalized log-likelihood and gradient for L2; discuss how you would select λ with nested cross-validation.

Quick Answer: This question evaluates a candidate's understanding of regularization techniques in supervised learning, covering the geometric intuition behind L1 versus L2 penalties, sparsity and bias–variance trade-offs, behavior under multicollinearity and elastic net considerations, algorithmic solution differences, and the penalized logistic regression objective and tuning. It is commonly asked in the Machine Learning domain to assess both conceptual understanding and practical application of model regularization, numerical stability, and reproducible hyperparameter selection, and the expected level spans conceptual reasoning and implementation-aware details.

Related Interview Questions

  • Derive and regularize logistic regression - Other (hard)
  • Design anomaly detection and handle imbalanced logistic regression - Other (Medium)
  • Extract companies from noisy text - Other (hard)
  • Evaluate and select K in K-means - Other (medium)
  • Explain SVM kernels and complexity - Other (hard)
Other logo
Other
Oct 13, 2025, 9:49 PM
Data Scientist
Onsite
Machine Learning
2
0

Ridge (L2) vs Lasso (L1) in Linear and Logistic Regression

Context: You are comparing L2 (Ridge) and L1 (Lasso) regularization for linear and logistic regression. Assume predictors are columns of X, response is y, and the intercept is not penalized unless stated. We write optimization in penalized form (minimize loss + penalty).

(a) Shrinkage geometry and sparsity

  • Explain the geometric intuition of L1 vs L2 constraints/penalties and why L1 tends to yield exact zeros (sparse solutions), while L2 rarely does.

(b) Bias of penalized estimates

  • Are L1/L2 penalized estimators unbiased? Provide a derivation or counterexample and discuss the bias–variance trade-off.

(c) Multicollinearity

  • Under strong multicollinearity, which penalty is preferable and why? Briefly mention when elastic net might be better.

(d) Algorithms and library differences

  • Describe coordinate descent and solution path algorithms (e.g., LARS). Explain why solutions can differ across libraries due to: penalty scaling choices, standardization/centering, intercept treatment, and λ-grid construction and tolerance.

(e) Logistic regression with L2

  • Write the penalized (negative) log-likelihood to minimize and its gradient for L2-penalized logistic regression (intercept unpenalized). Describe how you would select λ using nested cross-validation, including key guardrails to avoid leakage.

Solution

Show

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Machine Learning•More Other•More Data Scientist•Other Data Scientist•Other Machine Learning•Data Scientist Machine Learning
PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.