code: def select_config(Xraw, yraw, current, newpoint, bounds, num_f):
      """Selects the next hyperparameter config to try.
  
      This function takes the formatted data, fits the GP model and optimizes the
      UCB acquisition function to select the next point.
  
      Parameters
      ----------
      Xraw: np.array
          The un-normalized array of hyperparams, Time and Reward
      yraw: np.array
          The un-normalized vector of reward changes.
      current: list
          The hyperparams of trials currently running. This is important so we do not select the same
          config twice. If there is data here then we fit a second GP including it
          (with fake y labels). The GP variance doesn't depend on the y labels so it is ok.
      newpoint: np.array
          The Reward and Time for the new point.  We cannot change these as they are based on the
          *new weights*.
      bounds: dict
          Bounds for the hyperparameters. Used to normalize.
      num_f: int
          The number of fixed params. Almost always 2 (reward+time)
  
      Returns
      -------
      ``np.array``
          A vector of new hyperparameters.
      """
      length = select_length(Xraw, yraw, bounds, num_f)
  
      Xraw = Xraw[-length:, :]
      yraw = yraw[-length:]
  
      base_vals = np.array(list(bounds.values())).T
      oldpoints = Xraw[:, :num_f]
      old_lims = np.concatenate(
          (np.max(oldpoints, axis=0), np.min(oldpoints, axis=0))
      ).reshape(2, oldpoints.shape[1])
      limits = np.concatenate((old_lims, base_vals), axis=1)
  
      X = normalize(Xraw, limits)
      y = standardize(yraw).reshape(yraw.size, 1)
  
      fixed = normalize(newpoint, oldpoints)
  
      kernel = TVSquaredExp(
          input_dim=X.shape[1],
          variance=1.0,
          lengthscale=1.0,
          epsilon=0.1,
      )
  
      try:
          m = GPy.models.GPRegression(X, y, kernel)
      except np.linalg.LinAlgError:
          # add diagonal ** we would ideally make this something more robust...
          X += np.eye(X.shape[0]) * 1e-3
          m = GPy.models.GPRegression(X, y, kernel)
  
      try:
          m.optimize()
      except np.linalg.LinAlgError:
          # add diagonal ** we would ideally make this something more robust...
          X += np.eye(X.shape[0]) * 1e-3
          m = GPy.models.GPRegression(X, y, kernel)
          m.optimize()
  
      m.kern.lengthscale.fix(m.kern.lengthscale.clip(1e-5, 1))
  
      if current is None:
          m1 = deepcopy(m)
      else:
          # add the current trials to the dataset
          padding = np.array([fixed for _ in range(current.shape[0])])
          current = normalize(current, base_vals)
          current = np.hstack((padding, current))
  
          Xnew = np.vstack((X, current))
          ypad = np.zeros(current.shape[0])
          ypad = ypad.reshape(-1, 1)
          ynew = np.vstack((y, ypad))
  
          # kernel = GPy.kern.RBF(input_dim=X.shape[1], variance=1.,
          # lengthscale=1.)
          kernel = TVSquaredExp(
              input_dim=X.shape[1],
              variance=1.0,
              lengthscale=1.0,
              epsilon=0.1,
          )
          m1 = GPy.models.GPRegression(Xnew, ynew, kernel)
          m1.optimize()
  
      xt = optimize_acq(UCB, m, m1, fixed, num_f)
  
      # convert back...
      xt = xt * (
          np.max(base_vals, axis=0) - np.min(base_vals, axis=0)
      ) + np.min(base_vals, axis=0)
  
      xt = xt.astype(np.float32)
      return xt
  
file_path: orion/src/orion/algo/pbt/pb2_utils.py
imports: from copy import deepcopy
  import numpy
  from scipy.optimize import minimize
  from sklearn.metrics import euclidean_distances, pairwise_distances
  from orion.core.utils.module_import import ImportOptional
label_desc: Use image node_id 6 for calling a global function with example usage: select_config(Xraw, yraw, current, newpoint, bounds, num_f) and returns: xt