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","."]
docstr: Predict the normalized score using the cost model.
  
  Parameters
  ----------
  context : TuneContext
      The tuning context.
  candidates : List[MeasureCandidate]
      The measure candidates.
  
  Return
  ------
  result : np.ndarray
      The predicted normalized score.
docstr_tok: ["Predict","the","normalized","score","using","the","cost","model",".","Parameters","--","--","--","--","--","context",":","TuneContext","The","tuning","context",".","candidates",":","List","[","MeasureCandidate","]","The","measure","candidates",".","Return","--","--","--","result",":","np.ndarray","The","predicted","normalized","score","."]
code: def predict(
      self,
      context: "TuneContext",
      candidates: List[MeasureCandidate],
  ) -> np.ndarray:
      """Predict the normalized score using the cost model.
  
      Parameters
      ----------
      context : TuneContext
          The tuning context.
      candidates : List[MeasureCandidate]
          The measure candidates.
  
      Return
      ------
      result : np.ndarray
          The predicted normalized score.
      """
      if (
          self.data_size >= self.num_warmup_samples
          and self.booster is not None
      ):
          ret = self._predict(
              xs=[
                  x.numpy().astype("float32")
                  for x in self.extractor.extract_from(
                      context,
                      candidates,
                  )
              ]
          )
      else:
          ret = np.random.uniform(
              low=0,
              high=1,
              size=(len(candidates),),
          )
      return ret.astype("float64")
  
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 5 for calling the XGBModel obj's underlying member method code with example usage: obj.predict(context, candidates) and returns: ret