class_docstr: XGBoost model
  
  Parameters
  ----------
  extractor : FeatureExtractor
      The feature extractor for the model.
  config : XGBConfig
      The XGBoost model config.
  num_warmup_samples : int
      The number of samples that are used for warmup, i.e., the first few samples are predicted
      with random results.
  early_stopping_rounds : int
      The number of rounds for early stopping.
  verbose_eval : int
      The verbose level when doing evaluation.
  average_peak_n : int
      The number to calculate average peak score.
  adaptive_training : bool
      Whether use adaptive training to reduce tuning time.
class_docstr_tok: ["XGBoost","model","Parameters","--","--","--","--","--","extractor",":","FeatureExtractor","The","feature","extractor","for","the","model",".","config",":","XGBConfig","The","XGBoost","model","config",".","num_warmup_samples",":","int","The","number","of","samples","that","are","used","for","warmup",",","i.e.",",","the","first","few","samples","are","predicted","with","random","results",".","early_stopping_rounds",":","int","The","number","of","rounds","for","early","stopping",".","verbose_eval",":","int","The","verbose","level","when","doing","evaluation",".","average_peak_n",":","int","The","number","to","calculate","average","peak","score",".","adaptive_training",":","bool","Whether","use","adaptive","training","to","reduce","tuning","time","."]
code: def __init__(
      self,
      *,
      # feature extractor
      extractor: FeatureExtractor.FeatureExtractorType = "per-store-feature",
      # xgboost model config
      config: XGBConfig = XGBConfig(),
      # random result before enough samples
      num_warmup_samples: int = 100,
      # evaluation
      early_stopping_rounds: int = 50,
      verbose_eval: int = 25,
      average_peak_n: int = 32,
      adaptive_training: bool = True,
      num_tuning_cores: Optional[int] = None,
      tree_method: Optional[
          Literal["auto", "exact", "approx", "hist", "gpu_hist"]
      ] = None,
  ):
      super().__init__()
      if not isinstance(extractor, FeatureExtractor):
          extractor = FeatureExtractor.create(extractor)
      # feature extractor
      self.extractor = extractor
      # model-related
      if config.nthread is None:
          # use physical core number
          if num_tuning_cores is None:
              config = config._replace(nthread=cpu_count(logical=False))
          else:
              config = config._replace(nthread=num_tuning_cores)
  
      if tree_method is not None:
          config._replace(tree_method=tree_method)
  
      self.config = config
      # behavior of randomness
      self.num_warmup_samples = num_warmup_samples
      # evaluation
      self.early_stopping_rounds = early_stopping_rounds
      self.verbose_eval = verbose_eval
      self.average_peak_n = average_peak_n
      # states
      self.data = OrderedDict()
      self.data_size = 0
      self.booster = None
      # adaptive training
      self.adaptive_training = adaptive_training
      self.last_train_size = 0
  
imports: import os
  import tempfile
  from collections import OrderedDict
  from itertools import chain
  from typing import TYPE_CHECKING, Any, Callable, Dict, List, NamedTuple, Optional, Tuple
  from typing_extensions import Literal
  import numpy
  from ...contrib.tar import tar, untar
  from ...runtime import NDArray
  from ..cost_model import PyCostModel
  from ..feature_extractor import FeatureExtractor
  from ..logging import get_logger
  from ..runner import RunnerResult
  from ..search_strategy import MeasureCandidate
  from ..utils import cpu_count, derived_object, shash2hex
  from .metric import max_curve
label_desc: Use image node_id 1 to create a new XGBModel object from inherited base classes: PyCostModel with example: obj = XGBModel()