class_docstr: Bayesian Optimiser using `GPyOpt` as a backend.
class_docstr_tok: ["Bayesian","Optimiser","using","`","GPyOpt","`","as","a","backend","."]
docstr: Build the surrogate model for the GPyOpt BayesianOptimisation.
  
  The default model is 'gp'. In case of a large number of already
  evaluated samples, a 'sparse_gp' is used to speed up computation.
  
  Args:
      model: :obj:`str` or :obj:`GPy.Model`, the GP regression model.
      kernel: :obj:`GPy.kern.Kern`, the kernel of the GP regression model.
      variance: :obj:`float`, the variance of the evaluations
          (used only if supported by the model).
  
  Returns:
      A :obj:`GPy.Model` instance.
docstr_tok: ["Build","the","surrogate","model","for","the","GPyOpt","BayesianOptimisation",".","The","default","model","is","'gp","'",".","In","case","of","a","large","number","of","already","evaluated","samples",",","a","'sparse_gp","'","is","used","to","speed","up","computation",".","Args",":","model",":",":","obj",":","`","str","`","or",":","obj",":","`","GPy.Model","`",",","the","GP","regression","model",".","kernel",":",":","obj",":","`","GPy.kern.Kern","`",",","the","kernel","of","the","GP","regression","model",".","variance",":",":","obj",":","`","float","`",",","the","variance","of","the","evaluations","(","used","only","if","supported","by","the","model",")",".","Returns",":","A",":","obj",":","`","GPy.Model","`","instance","."]
code: def _build_model(
      self,
      model: Union[str, Type[GPy.Model]] = "GP",
      kernel: GPy.kern.Kern = None,
      variance: float = None,
  ):
      """Build the surrogate model for the GPyOpt BayesianOptimisation.
  
      The default model is 'gp'. In case of a large number of already
      evaluated samples, a 'sparse_gp' is used to speed up computation.
  
      Args:
          model: :obj:`str` or :obj:`GPy.Model`, the GP regression model.
          kernel: :obj:`GPy.kern.Kern`, the kernel of the GP regression model.
          variance: :obj:`float`, the variance of the evaluations
              (used only if supported by the model).
  
      Returns:
          A :obj:`GPy.Model` instance.
      """
      if isinstance(model, GPy.Model):
          return model
      if isinstance(model, str):
          model = model.lower()
          if model == "gp":
              return GPyOpt.models.GPModel(
                  kernel=kernel,
                  noise_var=variance,
                  sparse=len(self._data_x) > 25,
              )
          if model == "gp_mcmc":
              return GPyOpt.models.GPModel_MCMC(
                  kernel=kernel, noise_var=variance
              )
          raise ValueError(
              f"Unknown model {model}. When supplying a custom kernel or "
              f"the variance of the objective function, the model has to be "
              f"one from {{'GP', 'GP_MCMC'}}. Otherwise you should supply a "
              f"custom `GPy.Model` instance."
          )
      raise TypeError(
          "Argument `model` must be of type str or `GPy.Model`."
      )
  
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 6 for calling the BayesianOptimisation obj's underlying member method code with example usage: obj._build_model(model, kernel, variance) and returns: model, GPyOpt, GPyOpt