04.11 Lesson 11 of 16

1 h

Boosting for Tabular Data

Understand gradient boosting as a stage-wise additive model and tune its capacity and learning rate carefully.

By the end of this lesson

You will be able to

  • Distinguish bagging from boosting.
  • Explain additive learners and residual or gradient correction.
  • Describe learning rate, estimator count and tree depth.
  • Recognize overfitting and early-stopping signals.

Boosting builds an additive sequence

Bagging trains many models independently and averages them. Boosting adds learners sequentially: each new learner is trained to improve the current ensemble, often by following the negative gradient of a chosen loss. In gradient boosting, a model starts with a simple prediction and adds shallow trees that correct remaining errors. The learning rate scales each contribution, while the number of estimators controls how many additions are made.

from sklearn.ensemble import GradientBoostingClassifier

boosted = GradientBoostingClassifier(
    n_estimators=150,
    learning_rate=0.05,
    max_depth=2,
    random_state=42,
)

Learning rate and tree depth control the fit

A smaller learning rate usually requires more trees but makes each update more conservative. Deeper trees can capture complex interactions but may overfit. Tune learning_rate, n_estimators, max_depth and leaf-size controls together using a suitable validation strategy. Histogram-based gradient boosting can be more efficient on larger datasets. Libraries such as XGBoost, LightGBM and CatBoost extend the family with different engineering and regularization choices; this module focuses on the algorithmic idea rather than one library-specific API.

Apply what you learned

Exercise

Compare bagging with boosting

Compare a random forest and a gradient-boosted tree model using the same split, preprocessing and scoring metric.

  1. Choose a classification dataset and create a fixed training/validation split.
  2. Fit a random forest and a gradient-boosting classifier.
  3. Compare training and validation metrics and training time.
  4. Change the boosted model's learning rate while adjusting estimator count.
  5. Explain when you would prefer bagging or boosting.
Done when

The comparison uses held-out data, records settings and describes independent aggregation versus sequential error correction.

Free references

Study resources

2 links
  1. 01
    Gradient Boost Part 1: Regression Main Ideas Video

    Watch the individual first part for the additive boosting idea. Use the documentation for classifier-specific details.

  2. 02
    Ensemble Methods Article

    Read the Gradient Boosting section and compare the sequential process with Random Forests.

Check your understanding

Self-test

2 questions
  1. Question 1

    What is the key difference between bagging and boosting?

  2. Question 2

    What does the learning rate control in gradient boosting?

Completion check

Move on when

You can describe additive boosting, identify its main capacity controls and compare it fairly with a random forest.

Quick find

Search Michi

Type to search every stage, section, unit, topic and resource.

Enter opens the first result Esc closes

Reference

Keyboard shortcuts

n
Continue to the first unit not passed
j / k
Next / previous unit
1 2 3
Toggle learned, practised, passed
/
Open search
?
Show this help
Esc
Close open panels