code: def learn_model(draw, X, y, task, learner, n_estimators, n_targets):
      # for lgbm or xgb return the booster or sklearn object?
      use_sklearn_estimator = draw(st.booleans())
      if learner == "xgb":
          assume(has_xgboost())
          if task == "regression":
              objective = draw(
                  st.sampled_from(
                      ["reg:squarederror", "reg:pseudohubererror"]
                  )
              )
              model = xgb.XGBRegressor(
                  n_estimators=n_estimators,
                  tree_method="gpu_hist",
                  objective=objective,
                  enable_categorical=True,
                  verbosity=0,
              ).fit(X, y)
          elif task == "classification":
              valid_objectives = [
                  "binary:logistic",
                  "binary:hinge",
                  "binary:logitraw",
                  "count:poisson",
              ]
              if n_targets > 2:
                  valid_objectives += [
                      "rank:pairwise",
                      "rank:ndcg",
                      "rank:map",
                      "multi:softmax",
                      "multi:softprob",
                  ]
  
              objective = draw(st.sampled_from(valid_objectives))
              model = xgb.XGBClassifier(
                  n_estimators=n_estimators,
                  tree_method="gpu_hist",
                  objective=objective,
                  enable_categorical=True,
                  verbosity=0,
              ).fit(X, y)
          pred = model.predict(X, output_margin=True)
          if not use_sklearn_estimator:
              model = model.get_booster()
          return model, pred
      elif learner == "rf":
          predict_model = "GPU " if y.dtype == np.float32 else "CPU"
          if task == "regression":
              model = cuml.ensemble.RandomForestRegressor(
                  n_estimators=n_estimators
              )
              model.fit(X, y)
              pred = model.predict(X, predict_model=predict_model)
          elif task == "classification":
              model = cuml.ensemble.RandomForestClassifier(
                  n_estimators=n_estimators
              )
              model.fit(X, y)
              pred = model.predict_proba(X)
          return model, pred
      elif learner == "skl_rf":
          assume(has_sklearn())
          if task == "regression":
              model = sklrfr(n_estimators=n_estimators)
              model.fit(X, y)
              pred = model.predict(X)
          elif task == "classification":
              model = sklrfc(n_estimators=n_estimators)
              model.fit(X, y)
              pred = model.predict_proba(X)
          return model, pred
      elif learner == "lgbm":
          assume(has_lightgbm())
          if task == "regression":
              model = lgb.LGBMRegressor(n_estimators=n_estimators).fit(
                  X, y
              )
          elif task == "classification":
              model = lgb.LGBMClassifier(n_estimators=n_estimators).fit(
                  X, y
              )
          pred = model.predict(X, raw_score=True)
          if not use_sklearn_estimator:
              model = model.booster_
          return model, pred
  
imports: from cuml.testing.utils import as_type
  import cuml
  from cuml.ensemble import RandomForestClassifier
  from cuml.ensemble import RandomForestRegressor
  from cuml.common.exceptions import NotFittedError
  from cuml.internals.import_utils import has_sklearn
  from cuml.internals.import_utils import has_lightgbm, has_shap
  from cuml.explainer.tree_shap import TreeExplainer
  from hypothesis import given, settings, assume, HealthCheck, strategies
  from cuml.internals.safe_imports import gpu_only_import
  import json
  import pytest
  import treelite
  from cuml.internals.safe_imports import cpu_only_import
label_desc: Use image node_id 17 for calling a global function with example usage: learn_model(draw, X, y, task, learner, n_estimators, n_targets) and returns: model,  pred, model,  pred, model,  pred, model,  pred