code: def test_lightgbm_binary_with_calibrate_decision_threshold_bagged_refit(
      fit_helper, dataset_loader_helper
  ):
      """Tests that calibrate_decision_threshold works and does not make the validation score worse on the given metric"""
      fit_args = dict(
          hyperparameters={LGBModel: {}},
          num_bag_folds=2,
          calibrate_decision_threshold=True,
      )
      init_args = dict(eval_metric="f1")
      dataset_name = "adult"
  
      directory_prefix = "./datasets/"
      (
          train_data,
          test_data,
          dataset_info,
      ) = dataset_loader_helper.load_dataset(
          name=dataset_name, directory_prefix=directory_prefix
      )
      label = dataset_info["label"]
      predictor = fit_helper.fit_and_validate_dataset(
          dataset_name=dataset_name,
          init_args=init_args,
          fit_args=fit_args,
          delete_directory=False,
          refit_full=True,
      )
  
      assert predictor._decision_threshold is not None
      assert (
          predictor.decision_threshold == predictor._decision_threshold
      )
      optimal_decision_threshold = (
          predictor.calibrate_decision_threshold()
      )
      assert optimal_decision_threshold == predictor.decision_threshold
      og_threshold = predictor.decision_threshold
  
      y_pred_test = predictor.predict(test_data)
  
      scores_predictions = predictor.evaluate_predictions(
          y_true=test_data[label], y_pred=y_pred_test
      )
      scores = predictor.evaluate(test_data)
      scores_05 = predictor.evaluate(test_data, decision_threshold=0.5)
  
      for k in scores_predictions:
          assert scores[k] == scores_predictions[k]
      assert (
          scores["f1"] > scores_05["f1"]
      )  # Calibration should help f1
      assert (
          scores["accuracy"] < scores_05["accuracy"]
      )  # Calibration should harm accuracy
  
      predictor.set_decision_threshold(0.5)
      assert predictor.decision_threshold == 0.5
      assert predictor._decision_threshold == 0.5
      scores_05_native = predictor.evaluate(test_data)
  
      for k in scores_05:
          assert scores_05[k] == scores_05_native[k]
  
      leaderboard_05 = predictor.leaderboard(test_data)
      lb_score_05 = leaderboard_05[
          leaderboard_05["model"] == predictor.model_best
      ].iloc[0]["score_test"]
      assert lb_score_05 == scores_05["f1"]
  
      predictor.set_decision_threshold(og_threshold)
      leaderboard = predictor.leaderboard(test_data)
      lb_score = leaderboard[
          leaderboard["model"] == predictor.model_best
      ].iloc[0]["score_test"]
      assert lb_score == scores["f1"]
  
file_path: autogluon/tabular/tests/unittests/models/test_lightgbm.py
imports: from autogluon.core.constants import BINARY, MULTICLASS, REGRESSION
  from autogluon.core.metrics import METRICS
  from autogluon.tabular.models.lgb.lgb_model import LGBModel
label_desc: Use image node_id 9 for calling a global function with example usage: test_lightgbm_binary_with_calibrate_decision_threshold_bagged_refit(fit_helper, dataset_loader_helper) without return types