Random Forest binary classifier predicting which telecom customers will cancel their subscription within 30 days — giving the retention team enough lead time to intervene. Built with SMOTE for class imbalance and 22 engineered features.
Threshold = 0.45 · Test set = 20% hold-out · SMOTE applied to training set only
Month-to-month customers churn at 14× the rate of two-year contract holders
Mean Decrease in Impurity · Amber bars = engineered features · Blue bars = original dataset features
Monthly charge ÷ (tenure + 1) — captures billing shock for new customers. Our highest-value engineered feature.
Months with the company. Customers in the first 12 months churn at 2–3× the average rate.
Electronic check payers churn at 2× the rate of auto-pay customers. Manual payments = higher bill awareness.
Assumptions: $65 avg monthly revenue · 6 months retained per successful intervention · $25 cost per outreach call.
| Challenge | Solution |
|---|---|
| Hidden nulls in TotalCharges | str.strip() → pd.to_numeric(errors='coerce') → fillna(0) |
| 26.5% class imbalance | SMOTE on training set + class_weight='balanced' + threshold 0.45 |
| Overfitting (100% train accuracy) | max_depth=12, min_samples_leaf=2 via GridSearchCV |
| "82% accuracy" means nothing | Report Recall + Precision + AUC + business impact instead |
| Stakeholders wanted "why" | Feature importance chart + plain-English business impact report |
XGBoost gave +0.008 AUC improvement at the cost of 4× hyperparameter complexity and harder-to-explain feature importance. For a retention team that needs to act on the model's output, interpretability wins.
The complete runnable Jupyter notebook, preprocessing scripts, feature engineering module, and model evaluation code are all on GitHub. The notebook auto-generates synthetic data so you can run it end-to-end without downloading anything.