← Back to Blogs

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.

Retention Analytics

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 analogy: Think of it as a scoring system. Each feature (contract type, tenure, payment method) adds or subtracts points. The total score gets squeezed through a sigmoid function that converts it to a probability between 0% and 100%.
# 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

Random Forest Usually more accurate. Feature importance works differently: it shows how much each feature reduces prediction error across all trees.
XGBoost / LightGBM Best accuracy in practice. Less interpretable. Use SHAP values to explain predictions.
Survival analysis Models when someone will churn, not just whether they will. More powerful for time-based retention analysis.

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.

The analogy: Imagine lining up all 7,000 customers ranked by churn probability. AUC = 0.834 means that if you randomly picked one churner and one non-churner, there's an 83.4% chance the model ranked the churner higher. A perfect model scores 1.0. Random guessing scores 0.5.

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
ISL Chapter 4: Classification

Free PDF. Chapter 4 covers logistic regression in depth with clear math and examples.

Course
Kaggle: Intro to Machine Learning

Practical ML with real datasets. Good for building intuition.

Decision framework

Choosing the right technique for Retention Analytics.

What's my output type?
→
Yes/no prediction → classification. Probability estimation → Logistic regression. Time until churn → survival analysis.
Do I need interpretability?
→
Yes → logistic regression. No → gradient boosting (XGBoost, LightGBM).
Is my target variable imbalanced?
→
≥20% minority class → AUC-ROC is fine. <5% → use Precision-Recall AUC instead.

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.