class_docstr: Implementation of Gaussian process model. The Gaussian process hyperparameters are obtained by optimizing
  the marginal log likelihood.
  
  This code is based on the implementation of RoBO:
  Klein, A. and Falkner, S. and Mansur, N. and Hutter, F.
  RoBO: A Flexible and Robust Bayesian Optimization Framework in Python
  In: NIPS 2017 Bayesian Optimization Workshop
  
  Parameters
  ----------
  configspace : ConfigurationSpace
  kernel : Kernel
      Kernel which is used for the Gaussian process.
  n_restarts : int, defaults to 10
      Number of restarts for the Gaussian process hyperparameter optimization.
  normalize_y : bool, defaults to True
      Zero mean unit variance normalization of the output values.
  instance_features : dict[str, list[int | float]] | None, defaults to None
      Features (list of int or floats) of the instances (str). The features are incorporated into the X data,
      on which the model is trained on.
  pca_components : float, defaults to 7
      Number of components to keep when using PCA to reduce dimensionality of instance features.
  seed : int
class_docstr_tok: ["Implementation","of","Gaussian","process","model",".","The","Gaussian","process","hyperparameters","are","obtained","by","optimizing","the","marginal","log","likelihood",".","This","code","is","based","on","the","implementation","of","RoBO",":","Klein",",","A.","and","Falkner",",","S.","and","Mansur",",","N.","and","Hutter",",","F.","RoBO",":","A","Flexible","and","Robust","Bayesian","Optimization","Framework","in","Python","In",":","NIPS","2017","Bayesian","Optimization","Workshop","Parameters","--","--","--","--","--","configspace",":","ConfigurationSpace","kernel",":","Kernel","Kernel","which","is","used","for","the","Gaussian","process",".","n_restarts",":","int",",","defaults","to","10","Number","of","restarts","for","the","Gaussian","process","hyperparameter","optimization",".","normalize_y",":","bool",",","defaults","to","True","Zero","mean","unit","variance","normalization","of","the","output","values",".","instance_features",":","dict","[","str",",","list","[","int","|","float","]","]","|","None",",","defaults","to","None","Features","(","list","of","int","or","floats",")","of","the","instances","(","str",")",".","The","features","are","incorporated","into","the","X","data",",","on","which","the","model","is","trained","on",".","pca_components",":","float",",","defaults","to","7","Number","of","components","to","keep","when","using","PCA","to","reduce","dimensionality","of","instance","features",".","seed",":","int"]
docstr: Optimizes the marginal log likelihood and returns the best found hyperparameter
  configuration theta.
  
  Returns
  -------
  theta : np.ndarray
      Hyperparameter vector that maximizes the marginal log likelihood.
docstr_tok: ["Optimizes","the","marginal","log","likelihood","and","returns","the","best","found","hyperparameter","configuration","theta",".","Returns","--","--","--","-","theta",":","np.ndarray","Hyperparameter","vector","that","maximizes","the","marginal","log","likelihood","."]
code: def _optimize(self) -> np.ndarray:
      """Optimizes the marginal log likelihood and returns the best found hyperparameter
      configuration theta.
  
      Returns
      -------
      theta : np.ndarray
          Hyperparameter vector that maximizes the marginal log likelihood.
      """
      log_bounds = [(b[0], b[1]) for b in self._gp.kernel.bounds]
  
      # Start optimization from the previous hyperparameter configuration
      p0 = [self._gp.kernel.theta]
      if self._n_restarts > 0:
          dim_samples = []
  
          prior: list[AbstractPrior] | AbstractPrior | None = None
          for dim, hp_bound in enumerate(log_bounds):
              prior = self._all_priors[dim]
              # Always sample from the first prior
              if isinstance(prior, list):
                  if len(prior) == 0:
                      prior = None
                  else:
                      prior = prior[0]
  
              prior = cast(Optional[AbstractPrior], prior)
              if prior is None:
                  try:
                      sample = self._rng.uniform(
                          low=hp_bound[0],
                          high=hp_bound[1],
                          size=(self._n_restarts,),
                      )
                  except OverflowError:
                      raise ValueError(
                          "OverflowError while sampling from (%f, %f)"
                          % (hp_bound[0], hp_bound[1])
                      )
  
                  dim_samples.append(sample.flatten())
              else:
                  dim_samples.append(
                      prior.sample_from_prior(
                          self._n_restarts
                      ).flatten()
                  )
          p0 += list(np.vstack(dim_samples).transpose())
  
      theta_star: np.ndarray | None = None
      f_opt_star = np.inf
      for i, start_point in enumerate(p0):
          theta, f_opt, _ = optimize.fmin_l_bfgs_b(
              self._nll, start_point, bounds=log_bounds
          )
          if f_opt < f_opt_star:
              f_opt_star = f_opt
              theta_star = theta
  
      if theta_star is None:
          raise RuntimeError
  
      return theta_star
  
imports: from __future__ import annotations
  from typing import Any, Optional, TypeVar, cast
  import logging
  import numpy
  from ConfigSpace import ConfigurationSpace
  from scipy import optimize
  from sklearn.gaussian_process import GaussianProcessRegressor
  from sklearn.gaussian_process.kernels import Kernel
  from smac.constants import VERY_SMALL_NUMBER
  from smac.model.gaussian_process.abstract_gaussian_process import AbstractGaussianProcess
  from smac.model.gaussian_process.priors.abstract_prior import AbstractPrior
label_desc: Use image node_id 6 for calling the GaussianProcess obj's underlying member method code with example usage: obj._optimize() and returns: theta_star