Skip to content

gradient boosting

Gradient boosting is a machine learning technique that builds a strong predictive model by adding many small decision trees one at a time, with each new tree trained to correct the errors that the trees before it still make. Gradient-boosted trees are a common first choice for supervised learning on tabular, spreadsheet-style data.

Jerome Friedman formalized the method in a 2001 paper in The Annals of Statistics. He framed boosting as gradient descent carried out over functions rather than over model weights. The trees are built in sequence, unlike the independently grown trees of a random forest.

Training starts from a constant guess, such as the mean of the targets. Each round fits a shallow decision tree to the negative gradient of the loss function. For squared error, that gradient is the residual, the gap between each target and the current prediction.

The new tree’s output is scaled by a learning rate, also called shrinkage, before it joins the running sum. A smaller learning rate takes more cautious steps and needs more trees, so the two settings are tuned together as hyperparameters. Scikit-learn’s GradientBoostingRegressor defaults to one hundred trees, each three levels deep, and a learning rate of 0.1.

In the widget below, add trees one at a time to watch each new tree shrink the residuals, and switch the learning rate to see how it changes how many trees the model needs:

Interactive diagram — enable JavaScript to view.

Because every tree chases whatever error remains, extra rounds keep lowering training error after held-out error stops improving, which leads to overfitting. Common guards are early stopping on a validation set, depth limits, and stochastic gradient boosting, Friedman’s 2002 variant that trains each tree on a random fraction of the rows.

Production libraries add speed and regularization to the basic recipe. XGBoost, presented by Tianqi Chen and Carlos Guestrin at KDD 2016, penalizes tree complexity and handles sparse inputs natively. LightGBM and scikit-learn’s histogram-based estimators sort each feature’s values into a few hundred bins, which makes split finding much cheaper on large datasets.

Ranking variants such as LambdaMART apply the same sequential recipe to ordering search results, and both XGBoost and LightGBM ship ranking objectives for that job.

Stochastic Gradient Descent Algorithm With Python and NumPy

Tutorial

Stochastic Gradient Descent Algorithm With Python and NumPy

In this tutorial, you'll learn what the stochastic gradient descent algorithm is, how it works, and how to implement it with Python and NumPy.

advanced algorithms machine-learning numpy

For additional information on related topics, take a look at the following resources:

Have a question about this? Mentor AI can show you examples, compare related terms, and point you to tutorials.


By Martin Breuss • Updated Nov. 17, 2026