class_docstr: A Minin object to add hpo related methods to models.
  
  It is used to add hpo related search methods onto
  tf.keras.Sequential, tf.keras.Model, as well as custom
      model subclassing from tf.keras.Model.
class_docstr_tok: ["A","Minin","object","to","add","hpo","related","methods","to","models",".","It","is","used","to","add","hpo","related","search","methods","onto","tf.keras.Sequential",",","tf.keras.Model",",","as","well","as","custom","model","subclassing","from","tf.keras.Model","."]
docstr: Do the hyper param search.
  
  :param resume: bool, optional. whether to resume the previous tuning.
      Defaults to False.
  :param target_metric: str, optional. the target metric to optimize.
      Defaults to "accuracy".
  :param n_parallels: number of parallel processes to run trials.
  :param target_metric_mode: target metric of which epoch to report as the final result,
      possible options are:
  
      | 'max': maximum value of all epochs's results
      | 'min': minimum value of all epochs's results
      | 'last': result of the last epoch
      | 'auto': if direction is maximize, use max mode
                  if direction is minimize, use min mode
  
  :param kwargs: model.fit arguments (e.g. batch_size, validation_data, etc.)
      and search backend arguments (e.g. n_trials, pruner, etc.)
      are allowed in kwargs.
docstr_tok: ["Do","the","hyper","param","search",".",":","param","resume",":","bool",",","optional",".","whether","to","resume","the","previous","tuning",".","Defaults","to","False",".",":","param","target_metric",":","str",",","optional",".","the","target","metric","to","optimize",".","Defaults","to","``","accuracy","''",".",":","param","n_parallels",":","number","of","parallel","processes","to","run","trials",".",":","param","target_metric_mode",":","target","metric","of","which","epoch","to","report","as","the","final","result",",","possible","options","are",":","|","'max","'",":","maximum","value","of","all","epochs","'s","results","|","'min","'",":","minimum","value","of","all","epochs","'s","results","|","'last","'",":","result","of","the","last","epoch","|","'auto","'",":","if","direction","is","maximize",",","use","max","mode","if","direction","is","minimize",",","use","min","mode",":","param","kwargs",":","model.fit","arguments","(","e.g",".","batch_size",",","validation_data",",","etc",".",")","and","search","backend","arguments","(","e.g",".","n_trials",",","pruner",",","etc",".",")","are","allowed","in","kwargs","."]
code: def search(
      self,
      resume=False,
      target_metric=None,
      n_parallels=1,
      target_metric_mode="last",
      **kwargs,
  ):
      """
      Do the hyper param search.
  
      :param resume: bool, optional. whether to resume the previous tuning.
          Defaults to False.
      :param target_metric: str, optional. the target metric to optimize.
          Defaults to "accuracy".
      :param n_parallels: number of parallel processes to run trials.
      :param target_metric_mode: target metric of which epoch to report as the final result,
          possible options are:
  
          | 'max': maximum value of all epochs's results
          | 'min': minimum value of all epochs's results
          | 'last': result of the last epoch
          | 'auto': if direction is maximize, use max mode
                      if direction is minimize, use min mode
  
      :param kwargs: model.fit arguments (e.g. batch_size, validation_data, etc.)
          and search backend arguments (e.g. n_trials, pruner, etc.)
          are allowed in kwargs.
      """
      do_create = True
      if resume:
          if (
              "storage" not in kwargs.keys()
              or kwargs["storage"].strip() == ""
          ):
              if self.study is None:
                  warnings.warn(
                      "A new study is created since there's no existing study to resume from.",
                      UserWarning,
                  )
              else:
                  do_create = False
  
      if "storage" in kwargs.keys() and kwargs["storage"].strip() == "":
          del kwargs["storage"]
  
      search_kwargs = kwargs or {}
      self.target_metric = self._fix_target_metric(
          target_metric, kwargs
      )
  
      _validate_args(
          search_kwargs,
          self.target_metric,
          legal_keys=[
              HPOMixin.FIT_KEYS,
              HPOMixin.TUNE_CREATE_KEYS,
              HPOMixin.TUNE_RUN_KEYS,
          ],
      )
  
      (
          self.create_kwargs,
          self.run_kwargs,
          self.fit_kwargs,
      ) = _prepare_args(
          search_kwargs,
          HPOMixin.TUNE_CREATE_KEYS,
          HPOMixin.TUNE_RUN_KEYS,
          HPOMixin.FIT_KEYS,
          self.backend,
      )
  
      self.report_method = self._prepare_report_method(
          target_metric_mode, self.create_kwargs.get("direction", None)
      )
  
      # create study
      if do_create:
          self.study = _create_study(
              resume, self.create_kwargs, self.backend
          )
  
      isprune = (
          True if self.create_kwargs.get("pruner", None) else False
      )
      if n_parallels and n_parallels > 1:
          # if storage is in-memory, use parallel threads instead of multi-process
          # this may suffer form python's GIL.
          if self.create_kwargs.get("storage", "").strip() == "":
              self._run_search_n_threads(isprune, n_threads=n_parallels)
          else:
              self._run_search_n_procs(isprune, n_procs=n_parallels)
      else:
          self._run_search(isprune)
  
      self.tune_end = False
  
imports: import copy
  import warnings
  from .objective import Objective
  from bigdl.nano.automl.hpo.backend import create_hpo_backend
  from bigdl.nano.automl.hpo.search import _search_summary, _end_search, _create_study, _validate_args, _strip_val_prefix, _prepare_args
  from bigdl.nano.automl.hpo.space import AutoObject
  from bigdl.nano.utils.common import invalidInputError
  from bigdl.nano.automl.utils.parallel import run_parallel
  import math
label_desc: Use image node_id 11 for calling the HPOMixin obj's underlying member method code with example usage: obj.search(resume, target_metric, n_parallels, target_metric_mode) without return types