Gradient boosting (XGBoost, LightGBM)
Supervised · Classification & regression Gradient boosting also uses many small decision trees, but builds them one after another. Each new tree focuses on the mistakes the previous trees still make, and its correction is added to the running prediction. Popular versions include XGBoost, LightGBM and CatBoost.
Everyday analogy
A student who, after each mock test, studies only the questions they got wrong. Test by test, the remaining mistakes shrink.
Example
Used for: credit scoring, sales and demand forecasting, insurance pricing, ranking search results. It's a favourite for spreadsheet-style data and data science competitions.
Each tree adds a correction
How it works, step by step
- Start with a very simple prediction, such as the average of all past values.
- Calculate the error for every example: actual value minus prediction.
- Train a small tree to predict those errors.
- Add a small part of that tree's correction to the prediction. This step size is called the learning rate.
- Repeat hundreds of times, each tree fixing what is still wrong.
Worked example
A food app predicts delivery time. The average is 30 minutes. Tree 1 learns that rain adds about 8 minutes, tree 2 that dinner peak adds 5, tree 3 that long distances add 4. For a long-distance order on a rainy evening at peak time: 30 + 8 + 5 + 4 = 47 minutes.
✓ Good for
- Often the most accurate choice for tables and spreadsheet data
- Handles mixed numbers and categories
- Fast, well-tested libraries are freely available
⚠ Watch out for
- Needs careful tuning (number of trees, learning rate, depth)
- Can overfit if it runs too long
- Harder to explain than a single tree
Try it yourself
About 10 minCorrect the mistakes step by step
- Guess a friend's monthly spending.
- Hear the real number, then adjust your guess with a rule (e.g. add 20% for weekends).
- Repeat with another rule and note how the error shrinks.
What you should see: Each new step fixes the leftover error of the previous ones, like boosting.
Use any free AI chatbot (ChatGPT, Claude, Gemini or Copilot). Never paste private or confidential information.