Skip to main content
The W&B Python SDK (wandb) includes a special callback for LightGBM that automatically logs training metrics, feature importance, and model checkpoints to W&B. You can also use the generic logging features of W&B to track large experiments, such as hyperparameter sweeps. Use this integration to monitor gradient boosting model performance, compare runs, and analyze feature contributions without writing custom logging code.
from wandb.integration.lightgbm import wandb_callback, log_summary
import lightgbm as lgb

# Log metrics to W&B
gbm = lgb.train(..., callbacks=[wandb_callback()])

# Log feature importance plot and upload model checkpoint to W&B
log_summary(gbm, save_model_checkpoint=True)
For working code examples, see the repository of examples on GitHub.

Tune your hyperparameters with Sweeps

To get the best performance from models, tune hyperparameters such as tree depth and learning rate. W&B Sweeps is a toolkit that configures, orchestrates, and analyzes large hyperparameter testing experiments. To learn more about these tools and see an example of how to use Sweeps with XGBoost, open the following interactive Colab notebook.
LightGBM performance comparison