100% Free Forever
AI-Powered Learning
Industry Expert Content
Certificates & Badges
Learn At Your Own Pace
Machine Learning with Scikit-learn
40 minintermediate

Gradient Boosting — XGBoost and LightGBM

Gradient boosting is the most powerful and widely-used ensemble method for tabular data, consistently topping Kaggle leaderboards and industry benchmarks. Unlike bagging, which builds trees independently in parallel to reduce variance, gradient boosting builds trees sequentially, where each new tree corrects the errors of all previous trees. It is a bias-reduction technique: the ensemble starts with a high-bias predictor and iteratively adds models that specifically target the residual errors, progressively reducing bias while carefully controlling variance through regularisation and learning rates.

XGBoost and LightGBM are the two dominant gradient boosting libraries in production data science, both extending the original gradient boosting framework with hardware-level optimisations, regularisation, and handling of missing values that make them dramatically faster and more accurate than scikit-learn's GradientBoostingClassifier. Understanding gradient boosting's algorithmic core — gradient descent in function space, additive models, residual fitting — and the practical tuning of XGBoost and LightGBM is one of the highest-value skills in applied machine learning.

Analogy🏏Cricket
🏏 Think of it like cricket: A batting coach who teaches only one shot — the forward defensive — gives advice with high bias: it is consistently wrong for deliveries that demand a drive or a pull, regardless of how much practice the batsman does. A coach who memorises every ball of the batsman's training career gives advice with high variance: he predicts each training ball perfectly but fails completely on new balls from a different bowler, because he learned the noise of that specific bowler rather than the underlying principles. The great coach finds the balance — teaching the core principles that generalise, without over-specifying for the particular training environment. Just as great coaching lies between the extremes, great ML models balance bias and variance.
Lesson 20 of 35
0% complete