KatInterview

Spot and Fix Feature Leakage in a Churn Model

Machine LearningModel answer
EasyModel answerMachine Learningmachine learningfeature engineeringdata leakage

Last updated

Identify subtle data leakage in a customer churn prediction pipeline and explain how to fix it without sacrificing model utility.

Scenario

You are a junior ML engineer joining a team that built a binary classification model to predict whether a subscription customer will churn within the next 30 days. The model was trained on 12 months of historical data and achieved 94% AUC on a held-out test set — an unusually strong result.

During a code review, a senior engineer flags the feature list and raises concerns. The features used are:

FeatureDescription
days_since_signupDays between signup date and prediction date
avg_session_duration_30dAverage session length over the past 30 days
num_support_tickets_30dNumber of support tickets opened in the past 30 days
cancellation_page_visits_30dNumber of visits to the cancellation page in the past 30 days
plan_downgrade_flag1 if the customer downgraded their plan in the past 30 days
num_logins_30dNumber of logins in the past 30 days
final_nps_scoreNPS survey score collected at the moment the customer churned or at month-end for active users

The label is churned_in_next_30d (1 = churned, 0 = did not churn).

What is expected

  1. Identify which feature(s) contain leakage and explain precisely why.
  2. Describe the real-world failure mode: what happens when this model is deployed?
  3. Explain how to fix each leaky feature — either by removing it, transforming it, or replacing it with a leak-free alternative.
  4. Briefly describe how you would catch this kind of leakage earlier in the ML development process.

Hints

Hint 1

Think carefully about the timestamp at which each feature value would actually be known in production at prediction time — before the 30-day window begins.

Hint 2

The NPS score description contains a subtle timing issue. Ask yourself: when is that score collected for customers who churn?

Hint 3

High AUC alone is not evidence of a good model. What other signals — besides raw metric scores — should make you suspicious of a new model?