code: def run_training_continuation(
      self, xgb_params_01, xgb_params_02, xgb_params_03
  ):
      from sklearn.datasets import load_digits
      from sklearn.metrics import mean_squared_error
  
      digits_2class = load_digits(n_class=2)
      digits_5class = load_digits(n_class=5)
  
      X_2class = digits_2class["data"]
      y_2class = digits_2class["target"]
  
      X_5class = digits_5class["data"]
      y_5class = digits_5class["target"]
  
      dtrain_2class = xgb.DMatrix(X_2class, label=y_2class)
      dtrain_5class = xgb.DMatrix(X_5class, label=y_5class)
  
      gbdt_01 = xgb.train(
          xgb_params_01, dtrain_2class, num_boost_round=10
      )
      ntrees_01 = len(gbdt_01.get_dump())
      assert ntrees_01 == 10
  
      gbdt_02 = xgb.train(
          xgb_params_01, dtrain_2class, num_boost_round=0
      )
      gbdt_02.save_model("xgb_tc.json")
  
      gbdt_02a = xgb.train(
          xgb_params_01,
          dtrain_2class,
          num_boost_round=10,
          xgb_model=gbdt_02,
      )
      gbdt_02b = xgb.train(
          xgb_params_01,
          dtrain_2class,
          num_boost_round=10,
          xgb_model="xgb_tc.json",
      )
      ntrees_02a = len(gbdt_02a.get_dump())
      ntrees_02b = len(gbdt_02b.get_dump())
      assert ntrees_02a == 10
      assert ntrees_02b == 10
  
      res1 = mean_squared_error(
          y_2class, gbdt_01.predict(dtrain_2class)
      )
      res2 = mean_squared_error(
          y_2class, gbdt_02a.predict(dtrain_2class)
      )
      assert res1 == res2
  
      res1 = mean_squared_error(
          y_2class, gbdt_01.predict(dtrain_2class)
      )
      res2 = mean_squared_error(
          y_2class, gbdt_02b.predict(dtrain_2class)
      )
      assert res1 == res2
  
      gbdt_03 = xgb.train(
          xgb_params_01, dtrain_2class, num_boost_round=3
      )
      gbdt_03.save_model("xgb_tc.json")
  
      gbdt_03a = xgb.train(
          xgb_params_01,
          dtrain_2class,
          num_boost_round=7,
          xgb_model=gbdt_03,
      )
      gbdt_03b = xgb.train(
          xgb_params_01,
          dtrain_2class,
          num_boost_round=7,
          xgb_model="xgb_tc.json",
      )
      ntrees_03a = len(gbdt_03a.get_dump())
      ntrees_03b = len(gbdt_03b.get_dump())
      assert ntrees_03a == 10
      assert ntrees_03b == 10
  
      os.remove("xgb_tc.json")
  
      res1 = mean_squared_error(
          y_2class, gbdt_03a.predict(dtrain_2class)
      )
      res2 = mean_squared_error(
          y_2class, gbdt_03b.predict(dtrain_2class)
      )
      assert res1 == res2
  
      gbdt_04 = xgb.train(
          xgb_params_02, dtrain_2class, num_boost_round=3
      )
      res1 = mean_squared_error(
          y_2class, gbdt_04.predict(dtrain_2class)
      )
      res2 = mean_squared_error(
          y_2class,
          gbdt_04.predict(
              dtrain_2class,
              iteration_range=(0, gbdt_04.num_boosted_rounds()),
          ),
      )
      assert res1 == res2
  
      gbdt_04 = xgb.train(
          xgb_params_02,
          dtrain_2class,
          num_boost_round=7,
          xgb_model=gbdt_04,
      )
      res1 = mean_squared_error(
          y_2class, gbdt_04.predict(dtrain_2class)
      )
      res2 = mean_squared_error(
          y_2class,
          gbdt_04.predict(
              dtrain_2class,
              iteration_range=(0, gbdt_04.num_boosted_rounds()),
          ),
      )
      assert res1 == res2
  
      gbdt_05 = xgb.train(
          xgb_params_03, dtrain_5class, num_boost_round=7
      )
      gbdt_05 = xgb.train(
          xgb_params_03,
          dtrain_5class,
          num_boost_round=3,
          xgb_model=gbdt_05,
      )
  
      res1 = gbdt_05.predict(dtrain_5class)
      res2 = gbdt_05.predict(
          dtrain_5class,
          iteration_range=(0, gbdt_05.num_boosted_rounds()),
      )
      np.testing.assert_almost_equal(res1, res2)
  
file_path: xgboost/tests/python/test_training_continuation.py
imports: import os
  import tempfile
  import numpy
  import pytest
  import xgboost
  from xgboost import testing
label_desc: Use image node_id 2 for calling the TestTrainingContinuation obj's underlying member method code with example usage: obj.run_training_continuation(xgb_params_01, xgb_params_02, xgb_params_03) without return types