KatInterview

Production Pipeline for Predicting Subscriber Cancellation Within a Week

Machine LearningModel answer
MediumModel answerMachine Learningml-pipelinechurn-predictiondata-leakage

Last updated

Design, evaluate, monitor and roll out a weekly-horizon churn model on a shaky data foundation, covering leakage, time-aware validation, drift detection, retraining rules and fairness.

You take over a model that estimates, for each user, the probability of leaving within the next 7 days. Its input data is unreliable, and the team suspects that feature distributions have shifted over time. You are asked to put the system on solid footing. Answer each part below.

Part 1: Pipeline design

  • How do you split time into a feature window and a label window?
  • Which controls keep information from after the prediction moment out of training data?
  • Which validation scheme suits time-ordered data?
  • How do you make sure features computed for training match the ones used at serving time?

Part 2: Metrics and decision threshold

  • Which offline metrics do you track (for example ROC-AUC, PR-AUC, calibration error)?
  • Which business metrics show whether targeted interventions actually improve retention?
  • How do you pick a score cutoff when a missed churner and a wasted intervention have different costs?

Part 3: Monitoring

  • Describe concrete checks for missingness, schema, and training-serving skew.
  • Describe feature drift detection using PSI or JS divergence, with alert levels (for instance, PSI above 0.25 is severe).
  • Explain how you would tell a change in input distributions apart from a change in the target caused by a product update.

Part 4: Deployment and lifecycle

  • Lay out a rollout using shadow scoring, a canary, live monitoring, and rollback conditions.
  • Define explicit retraining triggers (for example, a scheduled weekly retrain when PSI stays at a moderate level two weeks running, or when a business KPI falls by X%).
  • Explain how you would check fairness across at least two sensitive cohorts and what you would do about any gaps found.

State your assumptions (user volume, base rate, intervention capacity) and discuss trade-offs.

Hints

Hint 1

Anchor everything to a prediction timestamp t: features may use only data that had actually arrived before t (think ingestion time, not just event time), and labels come from the 7 days after t. Then ask what a validation split must do so that no label window overlaps a training feature window.

Hint 2

For thresholding, write the expected value of treating one user as probability of churn times the chance the treatment saves them times the value of a saved user, minus the treatment cost. Treat when that is positive, and remember that capacity limits and a randomized holdout group change how you apply and verify the cutoff.

Hint 3

For drift, separate three questions: did the inputs move, did the base rate move, or did the relationship between inputs and outcome move? Matured labels, calibration by score bin, and the release/experiment calendar each help answer a different one. Also weight alerts by feature importance so you page on what matters.