snowflake.ml.experiment.callback.lightgbm.SnowflakeLightgbmCallback

class snowflake.ml.experiment.callback.lightgbm.SnowflakeLightgbmCallback(experiment_tracking: ExperimentTracking, log_model: bool = True, log_metrics: bool = True, log_params: bool = True, log_every_n_epochs: int = 1, model_name: Optional[str] = None, version_name: Optional[str] = None, model_signature: Optional[ModelSignature] = None)

Bases: _RecordEvaluationCallback

LightGBM callback for automatically logging to a Snowflake ML Experiment.

Creates a new LightGBM callback.

Parameters:
  • experiment_tracking (ExperimentTracking) – The Experiment Tracking instance to use for logging.

  • log_model (bool) – Whether to log the model at the end of training. Default is True.

  • log_metrics (bool) – Whether to log metrics during training. Default is True.

  • log_params (bool) – Whether to log model parameters at the start of training. Default is True.

  • log_every_n_epochs (int) – Frequency with which to log metrics. Must be positive. Default is 1, logging after every iteration.

  • model_name (Optional[str]) – The model name to use when logging the model. If None, the model name will be derived from the experiment name.

  • version_name (Optional[str]) – The model version name to use when logging the model. If None, the version name will be randomly generated.

  • model_signature (Optional[ModelSignature]) – The model signature to use when logging the model. This is required if log_model is set to True.

Raises:

ValueError – When log_every_n_epochs is not a positive integer.