Skip to content
Edit on GitHub

LightGBM

DVCLive allows you to add experiment tracking capabilities to your LightGBM projects.

Usage

To start using DVCLive you just need to add a few lines to your training code in any LightGBM project.

You just need to add the DvcLiveCallback to the callbacks list passed to the lightgbm.train call:

+from dvclive.lgbm import DvcLiveCallback

. . .

lightgbm.train(
  param,
  train_data,
  valid_sets=[validation_data],
-   num_round=5)
+   num_round=5,
+   callbacks=[DvcLiveCallback()])

This will generate the outputs as described in the Get Started.

Without requiring additional modifications to your training code, you can use DVCLive alongside DVC. See DVCLive with DVC for more info.

Parameters

  • model_file - (None by default) - The name of the file where the model will be saved at the end of each step.

  • **kwargs - Any additional arguments will be passed to Live.

Examples

  • Using model_file.
lightgbm.train(
    param,
    train_data,
    valid_sets=[validation_data],
    num_round=5,
    callbacks=[DvcLiveCallback(model_file="lgbm_model.txt")])
  • Using **kwargs to customize Live.
lightgbm.train(
    param,
    train_data,
    valid_sets=[validation_data],
    num_round=5,
    callbacks=[DvcLiveCallback(
      model_file="lgbm_model.txt",
      path="custom_path")])
Content

🐛 Found an issue? Let us know! Or fix it:

Edit on GitHub

Have a question? Join our chat, we will help you:

Discord Chat