class_docstr: `SMAC <https://www.cs.ubc.ca/~hutter/papers/10-TR-SMAC.pdf>`__ is based on Sequential Model-Based Optimization (SMBO).
  It adapts the most prominent previously used model class (Gaussian stochastic process models)
  and introduces the model class of random forests to SMBO in order to handle categorical parameters.
  
  The SMAC supported by nni is a wrapper on `the SMAC3 github repo <https://github.com/automl/SMAC3>`__,
  following NNI tuner interface :class:`nni.tuner.Tuner`. For algorithm details of SMAC, please refer to the paper
  :footcite:t:`hutter2011sequential`.
  
  Note that SMAC on nni only supports a subset of the types in
  :doc:`search space </hpo/search_space>`:
  ``choice``, ``randint``, ``uniform``, ``loguniform``, and ``quniform``.
  
  Note that SMAC needs additional installation using the following command:
  
  .. code-block:: bash
  
      pip install nni[SMAC]
  
  ``swig`` is required for SMAC. for Ubuntu ``swig`` can be installed with ``apt``.
  
  Examples
  --------
  
  .. code-block::
  
      config.tuner.name = 'SMAC'
      config.tuner.class_args = {
          'optimize_mode': 'maximize'
      }
  
  Parameters
  ----------
  optimize_mode : str
      Optimize mode, 'maximize' or 'minimize', by default 'maximize'
  config_dedup : bool
      If True, the tuner will not generate a configuration that has been already generated.
      If False, a configuration may be generated twice, but it is rare for relatively large search space.
docstr: Convert search_space to the format that ``SMAC3`` could recognize, thus, not all the search space types
  are supported. In this function, we also do the initialization of `SMAC3`, i.e., calling ``self._main_cli``.
  
  NOTE: updating search space during experiment running is not supported.
  
  Parameters
  ----------
  search_space : dict
      The format could be referred to search space spec (https://nni.readthedocs.io/en/latest/Tutorial/SearchSpaceSpec.html).
docstr_tok: ["Convert","search_space","to","the","format","that","``","SMAC3","``","could","recognize",",","thus",",","not","all","the","search","space","types","are","supported",".","In","this","function",",","we","also","do","the","initialization","of","`","SMAC3","`",",","i.e.",",","calling","``","self._main_cli","``",".","NOTE",":","updating","search","space","during","experiment","running","is","not","supported",".","Parameters","--","--","--","--","--","search_space",":","dict","The","format","could","be","referred","to","search","space","spec","(","https",":","\/\/nni.readthedocs.io\/en\/latest\/Tutorial\/SearchSpaceSpec.html",")","."]
code: def update_search_space(self, search_space):
      """
      Convert search_space to the format that ``SMAC3`` could recognize, thus, not all the search space types
      are supported. In this function, we also do the initialization of `SMAC3`, i.e., calling ``self._main_cli``.
  
      NOTE: updating search space during experiment running is not supported.
  
      Parameters
      ----------
      search_space : dict
          The format could be referred to search space spec (https://nni.readthedocs.io/en/latest/Tutorial/SearchSpaceSpec.html).
      """
      self.logger.info("update search space in SMAC.")
      validate_search_space(
          search_space,
          ["choice", "randint", "uniform", "quniform", "loguniform"],
      )
      if not self.update_ss_done:
          self.categorical_dict = generate_scenario(search_space)
          if self.categorical_dict is None:
              raise RuntimeError(
                  "categorical dict is not correctly returned after parsing search space."
              )
          # TODO: this is ugly, we put all the initialization work in this method, because initialization relies
          #         on search space, also because update_search_space is called at the beginning.
          self.optimizer = self._main_cli()
          self.smbo_solver = self.optimizer.solver
          self.loguniform_key = {
              key
              for key in search_space.keys()
              if search_space[key]["_type"] == "loguniform"
          }
          self.update_ss_done = True
      else:
          self.logger.warning("update search space is not supported.")
  
imports: import logging
  import sys
  import numpy
  from schema import Schema, Optional
  from smac.facade.epils_facade import EPILS
  from smac.facade.roar_facade import ROAR
  from smac.facade.smac_facade import SMAC
  from smac.scenario.scenario import Scenario
  from smac.utils.io.cmd_reader import CMDReader
  from ConfigSpaceNNI import Configuration
  import nni
  from nni import ClassArgsValidator
  from nni.common.hpo_utils import validate_search_space
  from nni.tuner import Tuner
  from nni.utils import OptimizeMode, extract_scalar_reward
  from .convert_ss_to_scenario import generate_scenario
label_desc: Use image node_id 3 for calling the SMACTuner obj's underlying member method code with example usage: obj.update_search_space(search_space) without return types