C.W.K.
Stream
Lesson 07 of 07 · published

Gradient Boosting and Tabular Champions

~32 min · gradient-boosting, lightgbm, xgboost

Level 0Scout
0 XP0/48 lessons0/11 achievements
0/120 XP to next level120 XP to go0% complete

Why boosting wins on tabular

Gradient boosting builds trees sequentially, each one fit to the residual errors of the previous ensemble. The result is a strong learner that captures complex interactions while staying interpretable enough for production. LightGBM, XGBoost, and CatBoost dominate Kaggle tabular leaderboards and most enterprise scoring systems.

The three knobs that matter

  • learning_rate — small (0.01-0.05) with many trees and early stopping is the safe play.
  • num_leaves / max_depth — capacity per tree. Start at 31 leaves (lightgbm) or depth 6 (xgboost).
  • min_data_in_leaf / min_child_samples — regularizer. Raise it on small/noisy data.

The honest workflow

Always use a validation set with early stopping. Tune learning rate together with n_estimators (lower lr → more trees). Track CV score and train/val gap; if the gap explodes, regularize more. Save the booster as a JSON or native format so you can inspect it later.

Code

LightGBM with early stopping and CV-style training·python
import lightgbm as lgb

model = lgb.LGBMClassifier(
    n_estimators=2000, learning_rate=0.03,
    num_leaves=63, min_child_samples=30,
    subsample=0.8, colsample_bytree=0.8,
    class_weight="balanced", random_state=7
)
model.fit(
    X_tr, y_tr, eval_set=[(X_val, y_val)],
    eval_metric="average_precision",
    callbacks=[lgb.early_stopping(50), lgb.log_evaluation(100)]
)
XGBoost with histogram method·python
import xgboost as xgb

model = xgb.XGBClassifier(
    n_estimators=2000, learning_rate=0.03, max_depth=6,
    subsample=0.8, colsample_bytree=0.8,
    tree_method="hist", eval_metric="aucpr",
    early_stopping_rounds=50, random_state=7
)
model.fit(X_tr, y_tr, eval_set=[(X_val, y_val)])
CatBoost when categoricals are the main story·python
from catboost import CatBoostClassifier, Pool

cat_idx = [X_tr.columns.get_loc(c) for c in categorical_cols]
model = CatBoostClassifier(
    iterations=2000, learning_rate=0.03, depth=8,
    auto_class_weights="Balanced", random_seed=7, verbose=200
).fit(Pool(X_tr, y_tr, cat_features=cat_idx), eval_set=Pool(X_val, y_val, cat_features=cat_idx), early_stopping_rounds=50)

External links

Exercise

Train a LightGBM classifier with early stopping on your dataset. Compare PR-AUC against your logistic regression baseline. If LightGBM wins by more than 5%, plan the deployment difference (memory, latency, monitoring). If less, ship the simpler one.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.