Customer Churn: Logistic Regression & Intervention Matrices
Predicting retention with logistic regression, checking the model with AUC-ROC, and building intervention priority matrices for business action.
Customer Churn Analysis
Logistic regression Machine Learning
Linear regression predicts a continuous number (price, revenue). Logistic regression predicts a probability between 0 and 1, perfect for binary outcomes like "did this customer churn? (yes/no)".
# The sigmoid function: this is the "logistic" part # It maps any number to (0, 1) # probability = 1 / (1 + e^(-score)) # A score of 0 → 50% probability # A score of 2 → ~88% probability # A score of -3 → ~5% probability from sklearn.linear_model import LogisticRegression model = LogisticRegression(max_iter=1000) model.fit(X_train_scaled, y_train) # Get probability of churning (not just yes/no) churn_probability = model.predict_proba(X_test)[:, 1]
Why scale features first? Logistic regression is sensitive to feature scale. Tenure (0–72 months) and monthly charges ($18–$118) are on totally different scales. StandardScaler brings both to mean=0, std=1 so the model treats them fairly.
What the coefficients mean: A positive coefficient means that feature increases churn probability. A negative coefficient means it reduces it. We used the magnitude (absolute value) to rank which features matter most.
Alternative churn models
AUC-ROC: how to measure a classifier Model Evaluation
Accuracy alone is a bad metric for churn models. If 80% of customers don't churn, a model that always predicts "won't churn" has 80% accuracy, but it's completely useless.
AUC (Area Under the ROC Curve) is better. It measures how well the model ranks customers by churn risk, regardless of the threshold you pick.
AUC interpretation
- 0.5 → useless (random)
- 0.7 → acceptable
- 0.8 → good
- 0.834 → good model
- 0.9+ → excellent
ROC curve axes
- X axis: false positive rate
- (non-churners called churners)
- Y axis: true positive rate
- (churners correctly identified)
Intervention priority matrix Business Application
This is the layer that turns a model into a business tool. The model outputs a churn probability for every customer, but not all churners are equally worth saving; a $20/month customer is less urgent than a $100/month one.
The 2×2 matrix scores customers on two axes simultaneously: how likely are they to churn, and how valuable are they? The top-right quadrant (high risk, high value) is where retention spend has the highest ROI.
# Split on medians to create four quadrants risk_cut = df['churn_prob'].median() # 50th percentile value_cut = df['MonthlyCharges'].median() # 50th percentile def quadrant(row): hi_risk = row['churn_prob'] >= risk_cut hi_value = row['MonthlyCharges'] >= value_cut if hi_risk and hi_value: return 'Act Now' elif hi_risk: return 'Monitor' elif hi_value: return 'Retain' else: return 'Low priority'
Why median splits? Cutting at the median means exactly half the customers fall above and below each line, a simple, defensible threshold. In production, cutoffs are tuned based on intervention budget and cost-per-save.
Resources: Retention Analytics
Free PDF. Chapter 4 covers logistic regression in depth with clear math and examples.
Practical ML with real datasets. Good for building intuition.
Decision framework
Choosing the right technique for Retention Analytics.
Accuracy vs interpretability
More complex models (XGBoost, neural nets) are usually more accurate but harder to explain. Use logistic regression when stakeholders need to understand the "why" behind predictions.