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 next_batch(self, batch_size):
      ret = []
      while len(ret) < batch_size and self.has_next():
          while self.trial_pt < len(self.trials):
              index = self.trials[self.trial_pt]
              if (
                  index not in self.visited
                  and self.space.is_index_valid(index)
              ):
                  break
              self.trial_pt += 1
  
          if self.trial_pt >= len(self.trials) - int(
              0.05 * self.plan_size
          ):
              # if the trial list is empty or
              # the tuner is doing the last 5% trials (e-greedy), choose randomly
              index = self.space.get_rand_index(to_exclude=self.visited)
          ret.append(self.space.get(index))
          self.visited.add(index)
      return ret
  
imports: import gc
  import numpy
  from .tuner import Tuner
  from ..env import GLOBAL_SCOPE
label_desc: Use image node_id 2 for calling the ModelBasedTuner obj's underlying member method code with example usage: obj.next_batch(batch_size) and returns: ret