Back to M2 — ML Case Labs

ML Case Lab (Selection/CV/Leakage/PR-AUC/SHAP)

Outcome: Tell SHAP + threshold story on churn/LTV Curated video (CodeEmporium): How would a Data Scientist analyze Customer Churn? — https://www.youtube.com/watch?v=6EmjRXUcARc (verified live via yt-dlp 2026-09-24). Pointer: 79-derived items; WE W3-W4 churn/LTV; shell: courses/video-scripts/ds-interview-prep/03.md.

13 minutesVideo LessonPDF notes
🎯 Free Guest Mode: You are learning for free. Sign in to save your completion progress and quiz answers.

Ready to continue?

Mark this lesson as complete when you're ready to proceed.

Key moments

  1. Business Problem Context — The goal is to use machine learning to better inform and predict customer churn.
  2. Defining Actionable Churn — Churn must be converted from a vague concept to a precise, actionable definition using a time frame (X days).
  3. Calculating Churn Threshold (X) — SQL is used to find the 90th percentile of time between orders to set the threshold X for the churn definition.
  4. Model Formulation — The problem is framed as binary classification, predicting the probability of an order in the next 3 months.
  5. Business Impact of Model Choice — Classification is preferred over regression if the resulting marketing action is uniform, highlighting the importance of business context.
  6. Feature Engineering and Verification — Features like 'days since last order' are brainstormed and hunches about their impact are verified using SQL queries.
  7. Data Leakage and Training Set — Training data must be selected historically (e.g., random days) to avoid data leakage and ensure labels are fully realized.
  8. Evaluation Metrics — Precision and Recall are defined in terms of business outcomes to communicate model success to non-technical stakeholders.
PDF notes

Frequently asked questions

Why choose binary classification over regression for churn?

Regression can yield noisier results. If the resulting business action (e.g., marketing email) is the same regardless of the exact churn date, classification is sufficient.

How do I determine the 'X' days threshold for churn?

Use SQL to find the 90th percentile of the average time between orders for existing customers over the last year.

What is the risk of sampling training data only on Mondays?

This introduces a weekly bias into the model, potentially skewing predictions based on weekly cycles rather than true churn indicators.

When should I make predictions?

Run the model weekly or monthly, depending on the frequency required for the resulting business action, such as a marketing campaign.