class_docstr: Exploring the search space with a cost model
class_docstr_tok: ["Exploring","the","search","space","with","a","cost","model"]
code: def __init__(
      self, exps: list, resource_manager, metric, tuning_space
  ):
      super().__init__(exps, resource_manager, metric)
      self.tuning_space = tuning_space
      self.best_iter = 0
  
      self.all_configs = [e["ds_config"] for e in exps]
      self.num_all_configs = len(self.all_configs)
  
      self.dims = dict_to_dims(self.tuning_space)
  
      logger.info(
          f"Create config dim: {self.dims}, all configs: {self.num_all_configs}"
      )
  
      self.visited = set([])
  
      self.trials = []
      self.trial_pt = 0
  
      init_num = min(INIT_NUM, self.num_all_configs)
  
      for _ in range(init_num):
          exp_feature = np.random.randint(self.num_all_configs)
          exp_feature = 0
          while exp_feature in self.visited:
              exp_feature = np.random.randint(self.num_all_configs)
          self.trials.append(exp_feature)
          self.visited.add(exp_feature)
  
      self.cost_model = XGBoostCostModel("rank")
  
      self.evaluated_configs = []
      self.evaluated_perf = []
  
      self.train_ct = 0
  
      self.random_exploration_ratio = 0.2
  
file_path: DeepSpeed/deepspeed/autotuning/tuner/model_based_tuner.py
imports: import hjson
  from ..constants import AUTOTUNING, AUTOTUNING_METRIC_PATH
  from .base_tuner import BaseTuner
  from .cost_model import XGBoostCostModel
  from .utils import *
  from ..utils import *
  import numbers
  from ..constants import AUTOTUNING_METRIC_LATENCY
label_desc: Use image node_id 1 to create a new ModelBasedTuner object from inherited base classes: BaseTuner with example: obj = ModelBasedTuner(exps, resource_manager, metric, tuning_space)