code: def log_summary(
      model: Booster,
      feature_importance: bool = True,
      save_model_checkpoint: bool = False,
  ) -> None:
      """Log useful metrics about lightgbm model after training is done.
  
      Arguments:
          model: (Booster) is an instance of lightgbm.basic.Booster.
          feature_importance: (boolean) if True (default), logs the feature importance plot.
          save_model_checkpoint: (boolean) if True saves the best model and upload as W&B artifacts.
  
      Using this along with `wandb_callback` will:
  
      - log `best_iteration` and `best_score` as `wandb.summary`.
      - log feature importance plot.
      - save and upload your best trained model to Weights & Biases Artifacts (when `save_model_checkpoint = True`)
  
      Example:
          ```python
          params = {
              "boosting_type": "gbdt",
              "objective": "regression",
          }
          gbm = lgb.train(
              params,
              lgb_train,
              num_boost_round=10,
              valid_sets=lgb_eval,
              valid_names=("validation"),
              callbacks=[wandb_callback()],
          )
  
          log_summary(gbm)
          ```
      """
      if wandb.run is None:
          raise wandb.Error(
              "You must call wandb.init() before WandbCallback()"
          )
  
      if not isinstance(model, Booster):
          raise wandb.Error(
              "Model should be an instance of lightgbm.basic.Booster"
          )
  
      wandb.run.summary["best_iteration"] = model.best_iteration
      wandb.run.summary["best_score"] = model.best_score
  
      # Log feature importance
      if feature_importance:
          _log_feature_importance(model)
  
      if save_model_checkpoint:
          _checkpoint_artifact(
              model, model.best_iteration, aliases=["best"]
          )
  
      with wb_telemetry.context() as tel:
          tel.feature.lightgbm_log_summary = True
  
file_path: wandb/wandb/integration/lightgbm/__init__.py
imports: from pathlib import Path
  from typing import TYPE_CHECKING, Callable
  import lightgbm
  from lightgbm import Booster
  import wandb
  from wandb.sdk.lib import telemetry
label_desc: Use image node_id 5 for calling a global function with example usage: log_summary(model, feature_importance, save_model_checkpoint) without return types