class_docstr: This is a wrapper over xgboost algorithm.
code: def __init__(self, params):
      super(XgbAlgorithm, self).__init__(params)
      self.library_version = xgb.__version__
  
      self.explain_level = params.get("explain_level", 0)
      self.boosting_rounds = additional.get("max_rounds", 10000)
      self.max_iters = 1
      self.early_stopping_rounds = additional.get(
          "early_stopping_rounds", 50
      )
      self.learner_params = {
          "tree_method": "hist",
          "booster": "gbtree",
          "objective": self.params.get("objective"),
          "eval_metric": self.params.get("eval_metric"),
          "eta": self.params.get("eta", 0.01),
          "max_depth": self.params.get("max_depth", 1),
          "min_child_weight": self.params.get("min_child_weight", 1),
          "subsample": self.params.get("subsample", 0.8),
          "colsample_bytree": self.params.get("colsample_bytree", 0.8),
          "n_jobs": self.params.get("n_jobs", -1),
          # "silent": self.params.get("silent", 1),
          "seed": self.params.get("seed", 1),
          "verbosity": 0,
      }
  
      if "lambda" in self.params:
          self.learner_params["lambda"] = self.params["lambda"]
      if "alpha" in self.params:
          self.learner_params["alpha"] = self.params["alpha"]
  
      # check https://github.com/dmlc/xgboost/issues/5637
      if self.learner_params["seed"] > 2147483647:
          self.learner_params["seed"] = (
              self.learner_params["seed"] % 2147483647
          )
      if "num_class" in self.params:  # multiclass classification
          self.learner_params["num_class"] = self.params.get(
              "num_class"
          )
  
      if "max_rounds" in self.params:
          self.boosting_rounds = self.params["max_rounds"]
  
      self.custom_eval_metric = None
      if self.params.get("eval_metric", "") == "r2":
          self.custom_eval_metric = xgboost_eval_metric_r2
      elif self.params.get("eval_metric", "") == "spearman":
          self.custom_eval_metric = xgboost_eval_metric_spearman
      elif self.params.get("eval_metric", "") == "pearson":
          self.custom_eval_metric = xgboost_eval_metric_pearson
      elif self.params.get("eval_metric", "") == "f1":
          self.custom_eval_metric = xgboost_eval_metric_f1
      elif self.params.get("eval_metric", "") == "average_precision":
          self.custom_eval_metric = (
              xgboost_eval_metric_average_precision
          )
      elif self.params.get("eval_metric", "") == "accuracy":
          self.custom_eval_metric = xgboost_eval_metric_accuracy
      elif self.params.get("eval_metric", "") == "mse":
          self.custom_eval_metric = xgboost_eval_metric_mse
      elif self.params.get("eval_metric", "") == "user_defined_metric":
          self.custom_eval_metric = xgboost_eval_metric_user_defined
  
      logger.debug("XgbLearner __init__")
  
imports: import copy
  import logging
  import os
  import time
  from inspect import signature
  import numpy
  import pandas
  import xgboost
  from sklearn.base import ClassifierMixin, RegressorMixin
  from supervised.algorithms.algorithm import BaseAlgorithm
  from supervised.algorithms.registry import BINARY_CLASSIFICATION, MULTICLASS_CLASSIFICATION, REGRESSION, AlgorithmsRegistry
  from supervised.utils.config import LOG_LEVEL
  from supervised.utils.metric import 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
  import tempfile
label_desc: Use image node_id 1 to create a new XgbAlgorithm object from inherited base classes: BaseAlgorithm with example: obj = XgbAlgorithm(params)