class_docstr: Bayesian Optimiser using `GPyOpt` as a backend.
class_docstr_tok: ["Bayesian","Optimiser","using","`","GPyOpt","`","as","a","backend","."]
docstr: Convert a :class:`Domain` type object to :obj:`GPyOptDomain`.
  
  Args:
      orig_domain: :class:`Domain` to convert.
  
  Returns:
      A tuple of the converted :obj:`GPyOptDomain` object and a value
      mapper to assign each categorical value to an integer
      (0, 1, 2, 3 ...). This is done to abstract away the type of the
      categorical domain from the `GPyOpt` internals and thus arbitrary
      types are supported.
  
  Notes:
      The categorical options must be hashable. This behaviour may change
      in the future.
docstr_tok: ["Convert","a",":","class",":","`","Domain","`","type","object","to",":","obj",":","`","GPyOptDomain","`",".","Args",":","orig_domain",":",":","class",":","`","Domain","`","to","convert",".","Returns",":","A","tuple","of","the","converted",":","obj",":","`","GPyOptDomain","`","object","and","a","value","mapper","to","assign","each","categorical","value","to","an","integer","(","0",",","1",",","2",",","3","...",")",".","This","is","done","to","abstract","away","the","type","of","the","categorical","domain","from","the","`","GPyOpt","`","internals","and","thus","arbitrary","types","are","supported",".","Notes",":","The","categorical","options","must","be","hashable",".","This","behaviour","may","change","in","the","future","."]
code: def _convert_to_gpyopt_domain(
      orig_domain: Domain,
  ) -> Tuple[
      GPyOptDomain,
      GPyOptCategoricalValueMapper,
      GPyOptDiscreteTypeMapper,
  ]:
      """Convert a :class:`Domain` type object to :obj:`GPyOptDomain`.
  
      Args:
          orig_domain: :class:`Domain` to convert.
  
      Returns:
          A tuple of the converted :obj:`GPyOptDomain` object and a value
          mapper to assign each categorical value to an integer
          (0, 1, 2, 3 ...). This is done to abstract away the type of the
          categorical domain from the `GPyOpt` internals and thus arbitrary
          types are supported.
  
      Notes:
          The categorical options must be hashable. This behaviour may change
          in the future.
      """
      gpyopt_domain = []
      value_mapper = {}
      type_mapper = {}
      flat_domain = orig_domain.flatten()
      for names, vals in flat_domain.items():
          dim_name = utils.join_strings(names)
          domain_type = Domain.get_type(vals)
          if domain_type == Domain.Continuous:
              dim_type = BayesianOptimisation.CONTINUOUS_TYPE
          elif domain_type == Domain.Discrete:
              dim_type = BayesianOptimisation.DISCRETE_TYPE
              type_mapper[dim_name] = {v: type(v) for v in vals}
          elif domain_type == Domain.Categorical:
              dim_type = BayesianOptimisation.CATEGORICAL_TYPE
              value_mapper[dim_name] = {
                  v: i for i, v in enumerate(vals)
              }
              vals = tuple(range(len(vals)))
          else:
              raise ValueError(
                  f"Badly specified subdomain {names} with values {vals}."
              )
          gpyopt_domain.append(
              {
                  "name": dim_name,
                  "type": dim_type,
                  "domain": tuple(vals),
              }
          )
      assert len(gpyopt_domain) == len(
          orig_domain
      ), "Mismatching dimensionality after domain conversion."
      return gpyopt_domain, value_mapper, type_mapper
  
imports: from multiprocessing import cpu_count
  from typing import Any, Dict, List, Sequence, Tuple, Type, TypeVar, Union
  import GPy
  import GPyOpt
  import numpy
  from GPyOpt.core import errors
  from hypertunity import utils
  from hypertunity.domain import Domain, Sample
  from hypertunity.optimisation.base import EvaluationScore, ExhaustedSearchSpaceError, Optimiser
label_desc: Use image node_id 2 for calling the BayesianOptimisation obj's underlying member method code with example usage: obj._convert_to_gpyopt_domain(orig_domain) and returns: gpyopt_domain,  value_mapper,  type_mapper