code: def test_boost_from_existing_model(self) -> None:
      X, _ = tm.load_agaricus(__file__)
      booster = xgb.train({"tree_method": "hist"}, X, num_boost_round=4)
      assert booster.num_boosted_rounds() == 4
      booster.set_param({"tree_method": "approx"})
      assert booster.num_boosted_rounds() == 4
      booster = xgb.train(
          {"tree_method": "hist"},
          X,
          num_boost_round=4,
          xgb_model=booster,
      )
      assert booster.num_boosted_rounds() == 8
      with pytest.warns(UserWarning, match="`updater`"):
          booster = xgb.train(
              {"updater": "prune", "process_type": "update"},
              X,
              num_boost_round=4,
              xgb_model=booster,
          )
      # Trees are moved for update, the rounds is reduced.  This test is
      # written for being compatible with current code (1.0.0).  If the
      # behaviour is considered sub-optimal, feel free to change.
      assert booster.num_boosted_rounds() == 4
  
      booster = xgb.train({"booster": "gblinear"}, X, num_boost_round=4)
      assert booster.num_boosted_rounds() == 4
      booster.set_param({"updater": "coord_descent"})
      assert booster.num_boosted_rounds() == 4
      booster.set_param({"updater": "shotgun"})
      assert booster.num_boosted_rounds() == 4
      booster = xgb.train(
          {"booster": "gblinear"},
          X,
          num_boost_round=4,
          xgb_model=booster,
      )
      assert booster.num_boosted_rounds() == 8
  
imports: import json
  import os
  import tempfile
  import numpy
  import pytest
  import xgboost
  from xgboost import testing
  from xgboost.testing.updater import ResetStrategy
label_desc: Use image node_id 4 for calling the TestModels obj's underlying member method code with example usage: obj.test_boost_from_existing_model() without return types