code: def test_multiclass(self):
      dtrain, dtest = tm.load_agaricus(__file__)
      param = {"max_depth": 2, "eta": 1, "num_class": 2}
      # specify validations set to watch performance
      watchlist = [(dtest, "eval"), (dtrain, "train")]
      num_round = 2
      bst = xgb.train(param, dtrain, num_round, evals=watchlist)
      # this is prediction
      preds = bst.predict(dtest)
      labels = dtest.get_label()
      err = sum(
          1 for i in range(len(preds)) if preds[i] != labels[i]
      ) / float(len(preds))
      # error must be smaller than 10%
      assert err < 0.1
  
      with tempfile.TemporaryDirectory() as tmpdir:
          dtest_path = os.path.join(tmpdir, "dtest.buffer")
          model_path = os.path.join(tmpdir, "model.ubj")
          # save dmatrix into binary buffer
          dtest.save_binary(dtest_path)
          # save model
          bst.save_model(model_path)
          # load model and data in
          bst2 = xgb.Booster(model_file=model_path)
          dtest2 = xgb.DMatrix(dtest_path)
          preds2 = bst2.predict(dtest2)
          # assert they are the same
          assert np.sum(np.abs(preds2 - preds)) == 0
  
imports: import json
  import os
  import pathlib
  import tempfile
  from pathlib import Path
  import numpy
  import pytest
  import xgboost
  from xgboost import testing
label_desc: Use image node_id 4 for calling the TestBasic obj's underlying member method code with example usage: obj.test_multiclass() without return types