code: def test_dart(self):
      dtrain, dtest = tm.load_agaricus(__file__)
      param = {
          "max_depth": 5,
          "objective": "binary:logistic",
          "eval_metric": "logloss",
          "booster": "dart",
          "verbosity": 1,
      }
      # specify validations set to watch performance
      watchlist = [(dtest, "eval"), (dtrain, "train")]
      num_round = 2
      bst = xgb.train(param, dtrain, num_round, watchlist)
      # this is prediction
      preds = bst.predict(dtest, iteration_range=(0, num_round))
      labels = dtest.get_label()
      err = sum(
          1
          for i in range(len(preds))
          if int(preds[i] > 0.5) != 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.dmatrix")
          model_path = os.path.join(tmpdir, "xgboost.model.dart.ubj")
          # save dmatrix into binary buffer
          dtest.save_binary(dtest_path)
          model_path = model_path
          # save model
          bst.save_model(model_path)
          # load model and data in
          bst2 = xgb.Booster(params=param, model_file=model_path)
          dtest2 = xgb.DMatrix(dtest_path)
  
      preds2 = bst2.predict(dtest2, iteration_range=(0, num_round))
  
      # assert they are the same
      assert np.sum(np.abs(preds2 - preds)) == 0
  
      def my_logloss(preds, dtrain):
          labels = dtrain.get_label()
          return "logloss", np.sum(
              np.log(np.where(labels, preds, 1 - preds))
          )
  
      # check whether custom evaluation metrics work
      bst = xgb.train(
          param, dtrain, num_round, watchlist, feval=my_logloss
      )
      preds3 = bst.predict(dtest, iteration_range=(0, num_round))
      assert all(preds3 == preds)
  
      # check whether sample_type and normalize_type work
      num_round = 50
      param["learning_rate"] = 0.1
      param["rate_drop"] = 0.1
      preds_list = []
      for p in [
          [p0, p1]
          for p0 in ["uniform", "weighted"]
          for p1 in ["tree", "forest"]
      ]:
          param["sample_type"] = p[0]
          param["normalize_type"] = p[1]
          bst = xgb.train(param, dtrain, num_round, watchlist)
          preds = bst.predict(dtest, iteration_range=(0, num_round))
          err = sum(
              1
              for i in range(len(preds))
              if int(preds[i] > 0.5) != labels[i]
          ) / float(len(preds))
          assert err < 0.1
          preds_list.append(preds)
  
      for ii in range(len(preds_list)):
          for jj in range(ii + 1, len(preds_list)):
              assert np.sum(np.abs(preds_list[ii] - preds_list[jj])) > 0
  
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 2 for calling the TestModels obj's underlying member method code with example usage: obj.test_dart() and returns: str,  np