code: def test_multitask_regression_with_xgboost():
      np.random.seed(123)
  
      # prepare dataset
      n_tasks = 4
      tasks = range(n_tasks)
      dataset = load_diabetes()
      X, y = dataset.data, dataset.target
      y = np.reshape(y, (len(y), 1))
      y = np.hstack([y] * n_tasks)
      frac_train = 0.7
      X_train, X_test, y_train, y_test = train_test_split(
          X, y, train_size=frac_train
      )
      train_dataset = dc.data.DiskDataset.from_numpy(X_train, y_train)
      test_dataset = dc.data.DiskDataset.from_numpy(X_test, y_test)
  
      # global setting
      regression_metric = dc.metrics.Metric(dc.metrics.mae_score)
      params = {"early_stopping_rounds": 25}
  
      # xgboost test
      def xgboost_builder(model_dir):
          xgb_model = xgboost.XGBRegressor(
              n_estimators=50, seed=123, verbose=False
          )
          return dc.models.GBDTModel(xgb_model, model_dir, **params)
  
      model = dc.models.SingletaskToMultitask(tasks, xgboost_builder)
      # fit trained model
      model.fit(train_dataset)
      model.save()
      # eval model on test
      scores = model.evaluate(test_dataset, [regression_metric])
      score = scores[regression_metric.name]
      assert score < 55
  
file_path: deepchem/deepchem/models/tests/test_gbdt_model.py
imports: import tempfile
  import unittest
  import numpy
  from sklearn.datasets import load_diabetes, load_digits
  from sklearn.model_selection import train_test_split
  import deepchem
label_desc: Use image node_id 3 for calling a global function with example usage: test_multitask_regression_with_xgboost() and returns: dc