Documentation
Search…
XGBoost & LightGBM
Track your trees with W&B.
The wandb library includes special callbacks for both of the most popular libraries for training gradient-boosted machines: XGBoost and LightGBM. It's also easy to use the generic logging features of Weights & Biases to track large experiments, like hyperparameter sweeps.
XGBoost
LightGBM
1
from wandb.xgboost import wandb_callback
2
import xgboost as xgb
3
4
...
5
6
bst = xgb.train(param, train_data, num_round, watchlist,
7
callbacks=[wandb_callback()])
Copied!
1
from wandb.lightgbm import wandb_callback
2
import lightgbm as lgb
3
4
...
5
6
gbm = lgb.train(params, train_data,
7
num_boost_round=20, valid_sets=valid_data,
8
valid_names=('validation'),
9
callbacks=[wandb_callback()])
Copied!
Looking for working code examples? Check out our repository of examples on GitHub or try out a Colab notebook (XGBoost, LightGBM).

Tuning your hyperparameters with Sweeps

Attaining the maximum performance out of models requires tuning hyperparameters, like tree depth and learning rate. Weights & Biases includes Sweeps, a powerful toolkit for configuring, orchestrating, and analyzing large hyperparameter testing experiments.
To learn more about these tools and see an example of how to use Sweeps with XGBoost, check out this interactive Colab notebook.
tl;dr: trees outperform linear learners on this classification dataset.
Last modified 2mo ago