class_docstr: Base class for model based tuner
  This type of tuner will fit a cost model and use an optimizer to
  find the maximums of the cost model as next trials
  
  Parameters
  ----------
  task: autotvm.task.Task
      The tuning task
  cost_model: CostModel
      The cost model that predicts the speed of a config (IR)
  model_optimizer:
      The optimizer to find local optimum points of cost model in tuning search space
  plan_size: int
      Tuner will re-fit model per `plan_size` new measure samples
  diversity_filter_ratio: int or float, optional
      If is not None, the tuner will first select
      top-(plan_size * diversity_filter_ratio) candidates according to the cost model
      and then pick plan_size of them according to the diversity metric.
code: def __init__(
      self,
      task,
      cost_model,
      model_optimizer,
      plan_size,
      diversity_filter_ratio=None,
  ):
      super(ModelBasedTuner, self).__init__(task)
  
      # space
      self.task = task
      self.target = task.target
      self.plan_size = plan_size
  
      self.cost_model = cost_model
      self.model_optimizer = model_optimizer
      self.diversity_filter_ratio = diversity_filter_ratio
  
      if self.diversity_filter_ratio:
          assert self.diversity_filter_ratio >= 1, (
              "Diversity filter ratio " "must be larger than one"
          )
  
      # trial plan
      self.trials = []
      self.trial_pt = 0
      self.visited = set()
  
      # observed samples
      self.xs = []
      self.ys = []
      self.flops_max = 0.0
      self.train_ct = 0
  
imports: import gc
  import numpy
  from .tuner import Tuner
  from ..env import GLOBAL_SCOPE
label_desc: Use image node_id 1 to create a new ModelBasedTuner object from inherited base classes: Tuner with example: obj = ModelBasedTuner(task, cost_model, model_optimizer, plan_size, diversity_filter_ratio)