class_docstr: Uses HEBO (Heteroscedastic Evolutionary Bayesian Optimization)
  to optimize hyperparameters.
  
  HEBO is a cutting edge black-box optimization framework created
  by Huawei's Noah Ark. More info can be found here:
  https://github.com/huawei-noah/HEBO/tree/master/HEBO.
  
  `space` can either be a HEBO's `DesignSpace` object or a dict of Tune
  search spaces.
  
  Please note that the first few trials will be random and used
  to kickstart the search process. In order to achieve good results,
  we recommend setting the number of trials to at least 16.
  
  Maximum number of concurrent trials is determined by ``max_concurrent``
  argument. Trials will be done in batches of ``max_concurrent`` trials.
  If this Searcher is used in a ``ConcurrencyLimiter``, the
  ``max_concurrent`` value passed to it will override the value passed
  here.
  
  Args:
      space: A dict mapping parameter names to Tune search spaces or a
          HEBO DesignSpace object.
      metric: The training result objective value attribute. If None
          but a mode was passed, the anonymous metric `_metric` will be used
          per default.
      mode: One of {min, max}. Determines whether objective is
          minimizing or maximizing the metric attribute.
      points_to_evaluate: Initial parameter suggestions to be run
          first. This is for when you already have some good parameters
          you want to run first to help the algorithm make better suggestions
          for future parameters. Needs to be a list of dicts containing the
          configurations.
      evaluated_rewards: If you have previously evaluated the
          parameters passed in as points_to_evaluate you can avoid
          re-running those trials by passing in the reward attributes
          as a list so the optimiser can be told the results without
          needing to re-compute the trial. Must be the same length as
          points_to_evaluate.
      random_state_seed: Seed for reproducible
          results. Defaults to None. Please note that setting this to a value
          will change global random states for `numpy` and `torch`
          on initalization and loading from checkpoint.
      max_concurrent: Number of maximum concurrent trials.
          If this Searcher is used in a ``ConcurrencyLimiter``, the
          ``max_concurrent`` value passed to it will override the
          value passed here.
      **kwargs: The keyword arguments will be passed to `HEBO()``.
  
  Tune automatically converts search spaces to HEBO's format:
  
  .. code-block:: python
  
      from ray import tune
      from ray.tune.search.hebo import HEBOSearch
  
      config = {
          "width": tune.uniform(0, 20),
          "height": tune.uniform(-100, 100)
      }
  
      hebo = HEBOSearch(metric="mean_loss", mode="min")
      tuner = tune.Tuner(
          trainable_function,
          tune_config=tune.TuneConfig(
              search_alg=hebo
          ),
          param_space=config
      )
      tuner.fit()
  
  Alternatively, you can pass a HEBO `DesignSpace` object manually to the
  Searcher:
  
  .. code-block:: python
  
      from ray import tune
      from ray.tune.search.hebo import HEBOSearch
      from hebo.design_space.design_space import DesignSpace
  
      space_config = [
          {'name' : 'width', 'type' : 'num', 'lb' : 0, 'ub' : 20},
          {'name' : 'height', 'type' : 'num', 'lb' : -100, 'ub' : 100},
      ]
      space = DesignSpace().parse(space_config)
  
      hebo = HEBOSearch(space, metric="mean_loss", mode="min")
      tuner = tune.Tuner(
          trainable_function,
          tune_config=tune.TuneConfig(
              search_alg=hebo
          )
      )
      tuner.fit()
code: def convert_search_space(spec: Dict, prefix: str = "") -> Dict:
      resolved_vars, domain_vars, grid_vars = parse_spec_vars(spec)
  
      params = []
  
      if not domain_vars and not grid_vars:
          return {}
  
      if grid_vars:
          raise ValueError(
              "Grid search parameters cannot be automatically converted "
              "to a HEBO search space."
          )
  
      def resolve_value(par: str, domain: Domain):
          sampler = domain.get_sampler()
          if isinstance(sampler, Quantized):
              logger.warning(
                  "HEBO search does not support quantization. "
                  "Dropped quantization."
              )
              sampler = sampler.get_sampler()
  
          if isinstance(domain, Float):
              if isinstance(sampler, LogUniform):
                  return {
                      "name": par,
                      "type": "pow",
                      "lb": domain.lower,
                      "ub": domain.upper,
                      "base": sampler.base,
                  }
              elif isinstance(sampler, Uniform):
                  return {
                      "name": par,
                      "type": "num",
                      "lb": domain.lower,
                      "ub": domain.upper,
                  }
  
          elif isinstance(domain, Integer):
              if isinstance(sampler, LogUniform):
                  return {
                      "name": par,
                      "type": "pow_int",
                      "lb": domain.lower,
                      "ub": domain.upper - 1,  # Upper bound exclusive
                      "base": sampler.base,
                  }
              elif isinstance(sampler, Uniform):
                  return {
                      "name": par,
                      "type": "int",
                      "lb": domain.lower,
                      "ub": domain.upper - 1,  # Upper bound exclusive
                  }
          elif isinstance(domain, Categorical):
              return {
                  "name": par,
                  "type": "cat",
                  "categories": list(domain.categories),
              }
  
          raise ValueError(
              "HEBO does not support parameters of type "
              "`{}` with samplers of type `{}`".format(
                  type(domain).__name__, type(domain.sampler).__name__
              )
          )
  
      for path, domain in domain_vars:
          par = "/".join(
              [str(p) for p in ((prefix,) + path if prefix else path)]
          )
          value = resolve_value(par, domain)
          params.append(value)
  
      return hebo.design_space.design_space.DesignSpace().parse(params)
  
imports: import logging
  import pickle
  from typing import Dict, List, Optional, Union
  import numpy
  import pandas
  from ray.tune.result import DEFAULT_METRIC
  from ray.tune.search.sample import Categorical, Domain, Float, Integer, LogUniform, Quantized, Uniform
  from ray.tune.search import UNRESOLVED_SEARCH_SPACE, UNDEFINED_METRIC_MODE, UNDEFINED_SEARCH_SPACE, Searcher
  from ray.tune.search.variant_generator import parse_spec_vars
  from ray.tune.utils.util import is_nan_or_inf, unflatten_dict, validate_warmstart
label_desc: Use image node_id 11 for calling the HEBOSearch obj's underlying member method code with example usage: obj.convert_search_space(spec, prefix) and returns: hebo, dict, dict, dict, dict, dict, dict