code: def _gaussian_acquisition(
      X,
      model,
      y_opt=None,
      acq_func="LCB",
      return_grad=False,
      acq_func_kwargs=None,
  ):
      """
      Wrapper so that the output of this function can be
      directly passed to a minimizer.
      """
      # Check inputs
      X = np.asarray(X)
      if X.ndim != 2:
          raise ValueError(
              "X is {}-dimensional, however,"
              " it must be 2-dimensional.".format(X.ndim)
          )
  
      if acq_func_kwargs is None:
          acq_func_kwargs = dict()
      xi = acq_func_kwargs.get("xi", 0.01)
      kappa = acq_func_kwargs.get("kappa", 1.96)
  
      # Evaluate acquisition function
      per_second = acq_func.endswith("ps")
      if per_second:
          model, time_model = model.estimators_
  
      if acq_func == "LCB":
          func_and_grad = gaussian_lcb(X, model, kappa, return_grad)
          if return_grad:
              acq_vals, acq_grad = func_and_grad
          else:
              acq_vals = func_and_grad
  
      elif acq_func in ["EI", "PI", "EIps", "PIps"]:
          if acq_func in ["EI", "EIps"]:
              func_and_grad = gaussian_ei(
                  X, model, y_opt, xi, return_grad
              )
          else:
              func_and_grad = gaussian_pi(
                  X, model, y_opt, xi, return_grad
              )
  
          if return_grad:
              acq_vals = -func_and_grad[0]
              acq_grad = -func_and_grad[1]
          else:
              acq_vals = -func_and_grad
  
          if acq_func in ["EIps", "PIps"]:
              if return_grad:
                  mu, std, mu_grad, std_grad = time_model.predict(
                      X,
                      return_std=True,
                      return_mean_grad=True,
                      return_std_grad=True,
                  )
              else:
                  mu, std = time_model.predict(X, return_std=True)
  
              # acq = acq / E(t)
              inv_t = np.exp(-mu + 0.5 * std**2)
              acq_vals *= inv_t
  
              # grad = d(acq_func) * inv_t + (acq_vals *d(inv_t))
              # inv_t = exp(g)
              # d(inv_t) = inv_t * grad(g)
              # d(inv_t) = inv_t * (-mu_grad + std * std_grad)
              if return_grad:
                  acq_grad *= inv_t
                  acq_grad += acq_vals * (-mu_grad + std * std_grad)
  
      else:
          raise ValueError("Acquisition function not implemented.")
  
      if return_grad:
          return acq_vals, acq_grad
      return acq_vals
  
file_path: scikit-optimize/skopt/acquisition.py
imports: import numpy
  import warnings
  from scipy.stats import norm
label_desc: Use image node_id 2 for calling a global function with example usage: _gaussian_acquisition(X, model, y_opt, acq_func, return_grad, acq_func_kwargs) and returns: acq_vals, acq_vals,  acq_grad