code: def test_bo_custom_model():
      domain = Domain({"x": [-2.0, 2.0]})
      bayes_opt = bo.BayesianOptimisation(domain=domain, seed=7)
      kernel = GPy.kern.RBF(1) + GPy.kern.Bias(1)
      n_steps = 3
      batch_size = 3
      all_samples = []
      all_evaluations = []
      first_samples = bayes_opt.run_step(
          batch_size=batch_size, minimise=False
      )
      xs = np.atleast_2d([s["x"] for s in first_samples])
      ys = np.atleast_2d(
          test_utils.continuous_heteroscedastic_1d(
              np.array([s["x"] for s in first_samples])
          )
      )
      for i in range(n_steps):
          custom_model = GPy.models.GPHeteroscedasticRegression(
              xs, ys, kernel
          )
          samples = bayes_opt.run_step(
              batch_size, minimise=False, model=custom_model
          )
          evaluations = test_utils.continuous_heteroscedastic_1d(
              np.array([s["x"] for s in samples])
          )
          bayes_opt.update(
              samples, [base.EvaluationScore(ev) for ev in evaluations]
          )
          xs = np.concatenate(
              [xs, np.atleast_2d([s["x"] for s in samples])], axis=0
          )
          ys = np.concatenate([ys, np.atleast_2d(evaluations)], axis=0)
          # gather the samples and evaluations for later assessment
          all_samples.extend([s["x"] for s in samples])
          all_evaluations.extend(evaluations)
      best_eval_index = int(np.argmax(all_evaluations))
      best_sample = all_samples[best_eval_index]
      assert np.isclose(
          best_sample, test_utils.CONT_HETEROSCED_1D_ARGMAX, atol=1e-1
      )
  
file_path: hypertunity/hypertunity/optimisation/tests/test_bo.py
imports: import GPy
  import numpy
  import pytest
  from hypertunity.domain import Domain
  from hypertunity.optimisation import base, bo
  from .None import _common
label_desc: Use image node_id 5 for calling a global function with example usage: test_bo_custom_model() without return types