code: def test_booster(booster, max_error=1e-6):
      assert H2OXGBoostEstimator.available()
  
      # prostate - regression without categoricals
      prostate_data = h2o.import_file(
          pyunit_utils.locate("smalldata/prostate/prostate.csv")
      )
      prostate_train, prostate_test = prostate_data.split_frame(
          ratios=[0.8], seed=1
      )
      prostate_x = ["AGE", "RACE", "DPROS", "DCAPS"]
      prostate_y = "CAPSULE"
      compare_preds(
          prostate_train,
          prostate_test,
          prostate_x,
          prostate_y,
          booster,
          ntrees=20,
          max_depth=3,
          max_error=max_error,
      )
      compare_preds(
          prostate_train,
          prostate_test,
          prostate_x,
          prostate_y,
          booster,
          ntrees=1,
          max_depth=10,
          max_error=max_error,
      )
      compare_preds(
          prostate_train,
          prostate_test,
          prostate_x,
          prostate_y,
          booster,
          ntrees=12,
          max_depth=12,
          max_error=max_error,
      )
  
      # insurance - regression with categoricals
      insurance_train = h2o.import_file(
          pyunit_utils.locate("smalldata/testng/insurance_train1.csv")
      )
      insurance_test = h2o.import_file(
          pyunit_utils.locate(
              "smalldata/testng/insurance_validation1.csv"
          )
      )
      insurance_x = ["Age", "District", "Group", "Holders"]
      insurance_y = "Claims"
      compare_preds(
          insurance_train,
          insurance_test,
          insurance_x,
          insurance_y,
          booster,
          ntrees=20,
          max_depth=3,
          max_error=max_error,
      )
      compare_preds(
          insurance_train,
          insurance_test,
          insurance_x,
          insurance_y,
          booster,
          ntrees=1,
          max_depth=10,
          max_error=max_error,
      )
      compare_preds(
          insurance_train,
          insurance_test,
          insurance_x,
          insurance_y,
          booster,
          ntrees=12,
          max_depth=12,
          max_error=max_error,
      )
  
      # cars classification (binomial)
      cars_data = h2o.import_file(
          path=pyunit_utils.locate("smalldata/junit/cars_20mpg.csv")
      )
      cars_x = [
          "displacement",
          "power",
          "weight",
          "acceleration",
          "year",
      ]
      cars_y1 = "economy_20mpg"
      cars_data[cars_data[cars_y1].isna(), cars_y1] = 0
      cars_data[cars_y1] = cars_data[cars_y1].asfactor()
      cars_train, cars_test = cars_data.split_frame(
          ratios=[0.8], seed=1
      )
      compare_preds(
          cars_train,
          cars_test,
          cars_x,
          cars_y1,
          booster,
          ntrees=1,
          max_depth=12,
          max_error=max_error,
      )
      compare_preds(
          cars_train,
          cars_test,
          cars_x,
          cars_y1,
          booster,
          ntrees=12,
          max_depth=6,
          max_error=max_error,
      )
  
      # cars classification (binomial)
      cars_y2 = "cylinders"
      cars_data[cars_data[cars_y2].isna(), cars_y2] = 0
      cars_data[cars_y2] = cars_data[cars_y2].asfactor()
      cars_train, cars_test = cars_data.split_frame(
          ratios=[0.8], seed=1
      )
      compare_preds(
          cars_train,
          cars_test,
          cars_x,
          cars_y2,
          booster,
          ntrees=1,
          max_depth=12,
          max_error=max_error,
      )
      compare_preds(
          cars_train,
          cars_test,
          cars_x,
          cars_y2,
          booster,
          ntrees=12,
          max_depth=6,
          max_error=max_error,
      )
  
imports: import sys
  import os
  from h2o.estimators.xgboost import *
  from tests import pyunit_utils
label_desc: Use image node_id 2 for calling a global function with example usage: test_booster(booster, max_error) without return types