Episode 16: Phase 5: LightGBM Didn't Win the Way I Expected. It Won Differently.
Act 1 — The Setup
Phase 4 ended with LR + SMOTE as the model to beat. Churn recall of 0.80. ROC-AUC of 0.839. A logistic regression — the simplest model in the toolkit — holding the top spot after four phases of work.
Phase 5 is where gradient boosting enters. LightGBM, RandomizedSearchCV over 30 iterations, 5-fold cross-validation, tuning across learning rate, tree depth, number of leaves, subsampling, and class weight simultaneously.
I expected LightGBM to clearly dominate. The results were more interesting than that.
Act 2 — What the Numbers Said
| Metric | LR + SMOTE | LightGBM + SMOTE (tuned) |
|---|---|---|
| ROC-AUC | 0.839 | 0.843 |
| Churn Recall | 0.80 | 0.64 |
| Churn Precision | 0.50 | 0.57 |
| Churn F1 | 0.62 | 0.60 |
LightGBM didn't beat LR + SMOTE on recall. It made a different tradeoff entirely.
Precision recovered from 0.50 → 0.57. Recall came down from 0.80 → 0.64. The ROC curves landed at almost identical AUC values — 0.84 for both. Which means both models have the same underlying discrimination ability. They just sit at different default operating points on the curve.
LightGBM is more conservative. It flags a churner only when it's more confident. LR + SMOTE casts a wider net. Neither is objectively better — it depends entirely on what the business is optimising for.
The feature importance plot settled something the EDA had only suggested.
tenure dominates — by a wide margin. MonthlyCharges is second. TotalCharges third. Then the categorical features start appearing: electronic check payment, month-to-month contract, no online security, no tech support — every signal the EDA flagged in Phase 1 shows up in the top 20, in roughly the order expected.
This is the feedback loop that makes EDA worth doing properly. The features you spent time understanding in Phase 1 are the features the model actually learned to use.
Act 3 — What Gradient Boosting Actually Taught Me
The result exposes something important about model selection on tabular data.
LightGBM is a more powerful model than Logistic Regression. More parameters, more capacity, more ability to model non-linear interactions. But on this dataset — where the signal is relatively clean, the features are well-engineered, and the pipeline already handles imbalance — that additional power translated into a precision gain, not a recall gain.
RandomizedSearchCV found the best parameters it could across 30 iterations and 5-fold CV. This isn't an untuned model. It's LightGBM at close to its optimum on this data. And at its optimum, it trades recall for precision compared to the simpler baseline.
The practical lesson: more complex models don't always win on every metric. They win on the metric the search was optimised for — in this case, ROC-AUC. And on ROC-AUC, LightGBM does edge ahead, just not by the margin you'd expect.
For a churn use case where missing a churner costs more than a false alarm, LR + SMOTE might still be the deployment choice. For a use case where precision matters — targeted high-cost retention campaigns with limited budget — LightGBM's conservative predictions are more valuable.
The model isn't just a number. It's a decision.
Next up: Phase 6 — final evaluation, model comparison, SHAP values, and closing out the ml-from-scratch series.
One phase left.
About the author
- A learner building ML algorithms from scratch to actually understand what's happening under the hood. Writing about the math, the mistakes, and the process and not just the results.
Comments
Join the discussionNo comments yet. Be the first to comment.

