Chapter 5. Hyperparameter Optimization
I remember the first time I encountered a poorly tuned machine learning model in production. It was 2018, and I was working at a bank that had deployed a fraud detection system. The model, a gradient boosting classifier with all the right features, was conceptually sound, but its performance was mediocre at best. The false positive rate was so high that legitimate transactions were being flagged constantly, frustrating customers and incurring costs for the company. The problem wasn’t the algorithm or the data. It was the hyperparameters.
After spending just two days systematically tuning the hyperparameters—using a combination of domain intuition and random search with cross-validation, adjusting the learning rate to 0.05, increasing the number of estimators to 300, and setting the maximum depth to 4—we improved the model’s precision by 15% while maintaining the same recall. The business impact was immediate: false positives dropped by 30%, customer complaints decreased, and the fraud detection system finally delivered on its promise.
This experience crystallized something I’d been learning throughout my career: hyperparameter optimization isn’t just a technical nicety—it’s often the difference between a model that works and one that doesn’t. I’ve seen well-tuned “simple” models consistently outperform poorly tuned complex ones.
A landmark 2018 study by Melis et al., “On the State of the Art of Evaluation in Neural Language Models”, demonstrated ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access