code: def _add_ucb_for_boca(mfgp, fidel_to_opt, mean_funcs, anc_data):
      """Add UCB for BOCA."""
      # pylint: disable=undefined-loop-variable
      # TODO: this is repeating a lot of code from add_ucb. Fix this!
      # prelims
      domain_kernel_list = mfgp.domain_kernel.kernel_list
      groupings = mfgp.domain_kernel.groupings
      total_max_evals = anc_data.max_evals
      kern_scale = mfgp.kernel.hyperparams["scale"]
      domain_bounds = anc_data.domain_bounds
      X_train = np.array(mfgp.XX)
      num_groups = len(domain_kernel_list)
      if mean_funcs is None:
          mean_funcs = lambda x: np.array([0] * len(x))
      if not hasattr(mean_funcs, "__iter__"):
          mean_funcs = [mean_funcs] * num_groups
      group_points = []
      num_coordinates = 0
      anc_data.max_evals = total_max_evals // num_groups
      K_fidel_Z_tr_to_f2o = mfgp.fidel_kernel(mfgp.ZZ, [fidel_to_opt])
      K_fidel_f2o_to_f2o = float(
          mfgp.fidel_kernel([fidel_to_opt], [fidel_to_opt])
      )
  
      # go through each element
      for group_j, kernel_j, mean_func_j in zip(
          groupings, domain_kernel_list, mean_funcs
      ):
          # Using python internal function here
          def _mf_add_ucb_acq_j(X_test_j):
              """Acquisition for the j'th group."""
              betath_j = _get_add_ucb_beta_th(len(group_j), anc_data.t)
              X_train_j = X_train[:, group_j]
              K_tetr_domain_j = kernel_j(X_test_j, X_train_j)
              K_tetr_fidel_j = np.repeat(
                  K_fidel_Z_tr_to_f2o.T, len(X_test_j), axis=0
              )
              K_tetr_j = kern_scale * K_tetr_fidel_j * K_tetr_domain_j
              pred_mean_j = K_tetr_j.dot(mfgp.alpha) + mean_func_j(
                  X_test_j
              )
              K_tete_j = (
                  kern_scale
                  * K_fidel_f2o_to_f2o
                  * kernel_j(X_test_j, X_test_j)
              )
              V_j = solve_lower_triangular(mfgp.L, K_tetr_j.T)
              post_covar_j = K_tete_j - V_j.T.dot(V_j)
              post_covar_j = get_post_covar_from_raw_covar(
                  post_covar_j,
                  mfgp.noise_var,
                  mfgp.kernel.is_guaranteed_psd(),
              )
              post_std_j = np.sqrt(np.diag(post_covar_j))
              return pred_mean_j + betath_j * post_std_j
  
          # Objatin the jth group
          anc_data_j = copy(anc_data)
          anc_data_j.domain = EuclideanDomain(domain_bounds[group_j])
          point_j = maximise_acquisition(_mf_add_ucb_acq_j, anc_data_j)
  
          group_points.append(point_j)
          num_coordinates += len(point_j)
  
      # return
      anc_data.max_evals = total_max_evals
      ret = np.zeros((num_coordinates,))
      for point_j, group_j in zip(group_points, groupings):
          ret[group_j] = point_j
      return ret
  
imports: from __future__ import division
  from argparse import Namespace
  from copy import copy
  import numpy
  from scipy.stats import norm
  from ..utils.general_utils import solve_lower_triangular
  from ..gp.gp_core import get_post_covar_from_raw_covar
  from ..exd.domains import EuclideanDomain
  from ..exd.exd_utils import maximise_with_method
label_desc: Use image node_id 26 for calling a global function with example usage: _add_ucb_for_boca(mfgp, fidel_to_opt, mean_funcs, anc_data) and returns: ret, unknown