code: def __call__(self, trial):
      param = {
          "objective": self.objective,
          "eval_metric": self.eval_metric_name,
          "tree_method": "hist",
          "booster": "gbtree",
          "eta": trial.suggest_categorical(
              "eta", [0.0125, 0.025, 0.05, 0.1]
          ),
          "max_depth": trial.suggest_int("max_depth", 2, 12),
          "lambda": trial.suggest_float("lambda", EPS, 10.0, log=True),
          "alpha": trial.suggest_float("alpha", EPS, 10.0, log=True),
          "colsample_bytree": min(
              trial.suggest_float("colsample_bytree", 0.3, 1.0 + EPS),
              1.0,
          ),
          "subsample": min(
              trial.suggest_float("subsample", 0.3, 1.0 + EPS), 1.0
          ),
          "min_child_weight": trial.suggest_int(
              "min_child_weight", 1, 100
          ),
          "n_jobs": self.n_jobs,
          "seed": self.seed,
          "verbosity": 0,
      }
      if self.custom_eval_metric is not None:
          del param["eval_metric"]
  
      if self.num_class is not None:
          param["num_class"] = self.num_class
      try:
          pruning_callback = optuna.integration.XGBoostPruningCallback(
              trial, f"validation-{self.eval_metric_name}"
          )
          bst = xgb.train(
              param,
              self.dtrain,
              self.rounds,
              evals=[(self.dvalidation, "validation")],
              early_stopping_rounds=self.early_stopping_rounds,
              callbacks=[pruning_callback],
              verbose_eval=False,
              feval=self.custom_eval_metric,
          )
          preds = bst.predict(
              self.dvalidation, iteration_range=(0, bst.best_iteration)
          )
          score = self.eval_metric(self.y_validation, preds)
          if Metric.optimize_negative(self.eval_metric.name):
              score *= -1.0
      except optuna.exceptions.TrialPruned as e:
          raise e
      except Exception as e:
          print("Exception in XgboostObjective", str(e))
          return None
  
      return score
  
file_path: mljar-supervised/supervised/tuner/optuna/xgboost.py
imports: import numpy
  import optuna
  import xgboost
  from supervised.algorithms.registry import BINARY_CLASSIFICATION, MULTICLASS_CLASSIFICATION, REGRESSION
  from supervised.algorithms.xgboost import xgboost_eval_metric, xgboost_objective
  from supervised.utils.metric import Metric, xgboost_eval_metric_accuracy, xgboost_eval_metric_average_precision, xgboost_eval_metric_f1, xgboost_eval_metric_mse, xgboost_eval_metric_pearson, xgboost_eval_metric_r2, xgboost_eval_metric_spearman, xgboost_eval_metric_user_defined
label_desc: Use image node_id 2 for calling the XgboostObjective obj's underlying member method code with example usage: obj.__call__(trial) and returns: score, None