class_docstr: NNI wraps `hyperopt <https://github.com/hyperopt/hyperopt>`__ to provide anneal tuner.
  
  This simple annealing algorithm begins by sampling from the prior
  but tends over time to sample from points closer and closer to the best ones observed.
  This algorithm is a simple variation of random search that leverages smoothness in the response surface.
  The annealing rate is not adaptive.
  
  Note that it needs additional installation using the following command:
  
  .. code-block:: bash
  
      pip install nni[Anneal]
  
  Examples
  --------
  
  .. code-block::
  
      config.tuner.name = 'Anneal'
      config.tuner.class_args = {
          'optimize_mode': 'minimize'
      }
  
  Parameters
  ----------
  optimze_mode: 'minimize' or 'maximize'
      Whether optimize to minimize or maximize trial result.
class_docstr_tok: ["NNI","wraps","`","hyperopt","<","https",":","\/\/github.com\/hyperopt\/hyperopt",">","`","__","to","provide","anneal","tuner",".","This","simple","annealing","algorithm","begins","by","sampling","from","the","prior","but","tends","over","time","to","sample","from","points","closer","and","closer","to","the","best","ones","observed",".","This","algorithm","is","a","simple","variation","of","random","search","that","leverages","smoothness","in","the","response","surface",".","The","annealing","rate","is","not","adaptive",".","Note","that","it","needs","additional","installation","using","the","following","command",":","..","code-block",":",":","bash","pip","install","nni","[","Anneal","]","Examples","--","--","--","--","..","code-block",":",":","config.tuner.name","=","'Anneal'","config.tuner.class_args","=","{","'optimize_mode","'",":","'minimize'","}","Parameters","--","--","--","--","--","optimze_mode",":","'minimize","'","or","'maximize'","Whether","optimize","to","minimize","or","maximize","trial","result","."]
docstr: get suggestion from hyperopt
  
  Parameters
  ----------
  random_search : bool
      flag to indicate random search or not (default: {False})
  
  Returns
  ----------
  total_params : dict
      parameter suggestion
docstr_tok: ["get","suggestion","from","hyperopt","Parameters","--","--","--","--","--","random_search",":","bool","flag","to","indicate","random","search","or","not","(","default",":","{","False","}",")","Returns","--","--","--","--","--","total_params",":","dict","parameter","suggestion"]
code: def _get_suggestion(self, random_search=False):
      """
      get suggestion from hyperopt
  
      Parameters
      ----------
      random_search : bool
          flag to indicate random search or not (default: {False})
  
      Returns
      ----------
      total_params : dict
          parameter suggestion
      """
      if (
          self.parallel
          and len(self.total_data) > 20
          and self.running_data
          and self.optimal_y is not None
      ):
          self.CL_rval = copy.deepcopy(self.rval)
          if self.constant_liar_type == "mean":
              _constant_liar_y = self.optimal_y[0] / self.optimal_y[1]
          else:
              _constant_liar_y = self.optimal_y
          for _parameter_id in self.running_data:
              self.receive_trial_result(
                  parameter_id=_parameter_id,
                  parameters=None,
                  value=_constant_liar_y,
                  constant_liar=True,
              )
          rval = self.CL_rval
  
          random_state = np.random.randint(2**31 - 1)
      else:
          rval = self.rval
          random_state = rval.rstate.randint(2**31 - 1)
  
      trials = rval.trials
      algorithm = rval.algo
      new_ids = rval.trials.new_trial_ids(1)
      rval.trials.refresh()
  
      if random_search:
          new_trials = hp.rand.suggest(
              new_ids, rval.domain, trials, random_state
          )
      else:
          new_trials = algorithm(
              new_ids, rval.domain, trials, random_state
          )
      rval.trials.refresh()
      vals = new_trials[0]["misc"]["vals"]
      parameter = dict()
      for key in vals:
          try:
              parameter[key] = vals[key][0].item()
          except (KeyError, IndexError):
              parameter[key] = None
  
      # remove '_index' from json2parameter and save params-id
      total_params = json2parameter(self.json, parameter)
      return total_params
  
imports: import copy
  import logging
  import hyperopt
  import numpy
  from schema import Optional, Schema
  from nni import ClassArgsValidator
  from nni.common.hpo_utils import validate_search_space
  from nni.tuner import Tuner
  from nni.utils import NodeType, OptimizeMode, extract_scalar_reward, split_index
label_desc: Use image node_id 7 for calling the HyperoptTuner obj's underlying member method code with example usage: obj._get_suggestion(random_search) and returns: total_params