code: def run_eta_decay_leaf_output(
      self, tree_method: str, objective: str
  ) -> None:
      # check decay has effect on leaf output.
      num_round = 4
      scheduler = xgb.callback.LearningRateScheduler
  
      dtrain, dtest = tm.load_agaricus(__file__)
      watchlist = [(dtest, "eval"), (dtrain, "train")]
  
      param = {
          "max_depth": 2,
          "objective": objective,
          "eval_metric": "error",
          "tree_method": tree_method,
      }
      if objective == "reg:quantileerror":
          param["quantile_alpha"] = 0.3
  
      def eta_decay_0(i):
          return num_round / (i + 1)
  
      bst0 = xgb.train(
          param,
          dtrain,
          num_round,
          evals=watchlist,
          callbacks=[scheduler(eta_decay_0)],
      )
  
      def eta_decay_1(i: int) -> float:
          if i > 1:
              return 5.0
          return num_round / (i + 1)
  
      bst1 = xgb.train(
          param,
          dtrain,
          num_round,
          evals=watchlist,
          callbacks=[scheduler(eta_decay_1)],
      )
      bst_json0 = bst0.save_raw(raw_format="json")
      bst_json1 = bst1.save_raw(raw_format="json")
  
      j0 = json.loads(bst_json0)
      j1 = json.loads(bst_json1)
  
      tree_2th_0 = j0["learner"]["gradient_booster"]["model"]["trees"][
          2
      ]
      tree_2th_1 = j1["learner"]["gradient_booster"]["model"]["trees"][
          2
      ]
      assert tree_2th_0["base_weights"] == tree_2th_1["base_weights"]
      assert (
          tree_2th_0["split_conditions"]
          == tree_2th_1["split_conditions"]
      )
  
      tree_3th_0 = j0["learner"]["gradient_booster"]["model"]["trees"][
          3
      ]
      tree_3th_1 = j1["learner"]["gradient_booster"]["model"]["trees"][
          3
      ]
      assert tree_3th_0["base_weights"] != tree_3th_1["base_weights"]
      assert (
          tree_3th_0["split_conditions"]
          != tree_3th_1["split_conditions"]
      )
  
imports: import json
  import os
  import tempfile
  from typing import Union
  import pytest
  import xgboost
  from xgboost import testing
label_desc: Use image node_id 12 for calling the TestCallbacks obj's underlying member method code with example usage: obj.run_eta_decay_leaf_output(tree_method, objective) and returns: unknown, unknown, int