PracHub
QuestionsCoachesLearningGuidesInterview Prep
|Home/Machine Learning/Boston Consulting Group

Detect Data Leakage in Supervised Learning Pipelines

Last updated: Mar 29, 2026

Quick Overview

This interview question evaluates core ML concepts, assumptions, math intuition, training/evaluation trade-offs, and practical failure modes in a realistic interview setting. A strong answer for Detect Data Leakage in Supervised Learning Pipelines states assumptions, handles edge cases, explains trade-offs, and shows how to validate the result clearly.

  • hard
  • Boston Consulting Group
  • Machine Learning
  • Data Scientist

Detect Data Leakage in Supervised Learning Pipelines

Company: Boston Consulting Group

Role: Data Scientist

Category: Machine Learning

Difficulty: hard

Interview Round: Take-home Project

##### Scenario Company screens ML engineers with a 90-minute CodeSignal test containing conceptual MCQs and Python modeling tasks. ##### Question State and interpret the bias and variance terms in the bias–variance decomposition. Which regularization technique(s) can shrink linear-model coefficients exactly to zero and why? Name two practical approaches for detecting data leakage in a supervised learning pipeline. Given dataframe df(user_id, event_time, event_type, purchase), build a binary classifier predicting whether a user will purchase within the next 7 days and report AUC on a held-out set. Implement logistic regression with gradient descent using only numpy; provide convergence diagnostics. ##### Hints Discuss bias-variance trade-off, L1 geometry, validation splits, temporal leakage checks, and write clean, vectorized Python.

Quick Answer: This interview question evaluates core ML concepts, assumptions, math intuition, training/evaluation trade-offs, and practical failure modes in a realistic interview setting. A strong answer for Detect Data Leakage in Supervised Learning Pipelines states assumptions, handles edge cases, explains trade-offs, and shows how to validate the result clearly.

Related Interview Questions

  • Design and sample for credit default prediction - Boston Consulting Group (Medium)
  • Explain AUC, imbalance, losses, and networks - Boston Consulting Group (medium)
  • Build and evaluate imbalanced binary classifier - Boston Consulting Group (medium)
  • Reduce overfitting under constraints - Boston Consulting Group (hard)
  • Achieve 0.95 precision via thresholding - Boston Consulting Group (medium)
|Home/Machine Learning/Boston Consulting Group

Detect Data Leakage in Supervised Learning Pipelines

Boston Consulting Group logo
Boston Consulting Group
Aug 4, 2025, 10:55 AM
hardData ScientistTake-home ProjectMachine Learning
6
0

Detect Data Leakage in Supervised Learning Pipelines

ML Take‑home: Bias–Variance, Regularization, Leakage, and From‑scratch Logistic Regression

Context

You are given user event logs in a Pandas dataframe df with columns:

  • user_id: unique user identifier
  • event_time: timestamp of the event
  • event_type: categorical event name (e.g., view, click, add_to_cart, purchase)
  • purchase: indicator (0/1) if the event is a purchase

Your goal is to build a leakage‑free binary classifier that predicts whether a user will purchase within the next 7 days, then evaluate AUC on a held‑out set.

Tasks

  1. Bias–variance decomposition
    • State the bias and variance terms and interpret them in the bias–variance decomposition.
  2. Regularization and sparsity
    • Which regularization technique(s) can shrink linear‑model coefficients exactly to zero, and why?
  3. Detecting data leakage
    • Name two practical approaches for detecting data leakage in a supervised learning pipeline.
  4. Modeling: Logistic regression from scratch
    • Using df(user_id, event_time, event_type, purchase), build a binary classifier to predict whether a user will purchase within the next 7 days.
    • Use a temporally correct split and report AUC on a held‑out set.
    • Implement logistic regression with gradient descent using only numpy for the model (pandas allowed for data prep). Provide basic convergence diagnostics.

Implementation requirements

  • Ensure no temporal leakage: features must use data up to an anchor time; labels look forward 7 days after the anchor.
  • Clean, vectorized Python; no sklearn for the model or metrics (implement AUC yourself).

Constraints & Assumptions

  • Preserve the scope, facts, inputs, and requested outputs from the prompt above.
  • If the prompt leaves a detail unspecified, state a reasonable assumption before relying on it.
  • Keep the answer interview-ready: concise enough to present, but concrete enough to implement or evaluate.

Clarifying Questions to Ask

  • Clarify the task, data shape, labels, constraints, and evaluation metric.
  • State assumptions behind the math or modeling technique you choose.
  • Connect theory to practical training, debugging, and deployment implications.

What a Strong Answer Covers

  • Correct definitions and formulas where the prompt requires them.
  • A practical explanation of how the method behaves on real data.
  • Trade-offs, failure modes, diagnostics, and mitigation strategies.
  • Evaluation choices that match the product or modeling objective.

Follow-up Questions

  • How would noisy labels, class imbalance, or distribution shift affect the answer?
  • What would you monitor after deployment?
  • Which baseline would you compare against first?
Loading comments...

Browse More Questions

More Machine Learning•More Boston Consulting Group•More Data Scientist•Boston Consulting Group Data Scientist•Boston Consulting Group Machine Learning•Data Scientist Machine Learning

Write your answer

Your first approved answer each day earns 20 XP.

Sign in to write your answer.
PracHub

Master your tech interviews with 8,000+ 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
  • AI Coding 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.