class_docstr: Binary Gaussian process classification based on Laplace approximation.
  
  The implementation is based on Algorithm 3.1, 3.2, and 5.1 of
  ``Gaussian Processes for Machine Learning'' (GPML) by Rasmussen and
  Williams.
  
  Internally, the Laplace approximation is used for approximating the
  non-Gaussian posterior by a Gaussian.
  
  Currently, the implementation is restricted to using the logistic link
  function.
  
  .. versionadded:: 0.18
  
  Parameters
  ----------
  kernel : kernel object
      The kernel specifying the covariance function of the GP. If None is
      passed, the kernel "1.0 * RBF(1.0)" is used as default. Note that
      the kernel's hyperparameters are optimized during fitting.
  
  optimizer : string or callable, optional (default: "fmin_l_bfgs_b")
      Can either be one of the internally supported optimizers for optimizing
      the kernel's parameters, specified by a string, or an externally
      defined optimizer passed as a callable. If a callable is passed, it
      must have the  signature::
  
          def optimizer(obj_func, initial_theta, bounds):
              # * 'obj_func' is the objective function to be maximized, which
              #   takes the hyperparameters theta as parameter and an
              #   optional flag eval_gradient, which determines if the
              #   gradient is returned additionally to the function value
              # * 'initial_theta': the initial value for theta, which can be
              #   used by local optimizers
              # * 'bounds': the bounds on the values of theta
              ....
              # Returned are the best found hyperparameters theta and
              # the corresponding value of the target function.
              return theta_opt, func_min
  
      Per default, the 'fmin_l_bfgs_b' algorithm from scipy.optimize
      is used. If None is passed, the kernel's parameters are kept fixed.
      Available internal optimizers are::
  
          'fmin_l_bfgs_b'
  
  n_restarts_optimizer: int, optional (default: 0)
      The number of restarts of the optimizer for finding the kernel's
      parameters which maximize the log-marginal likelihood. The first run
      of the optimizer is performed from the kernel's initial parameters,
      the remaining ones (if any) from thetas sampled log-uniform randomly
      from the space of allowed theta-values. If greater than 0, all bounds
      must be finite. Note that n_restarts_optimizer=0 implies that one
      run is performed.
  
  max_iter_predict: int, optional (default: 100)
      The maximum number of iterations in Newton's method for approximating
      the posterior during predict. Smaller values will reduce computation
      time at the cost of worse results.
  
  warm_start : bool, optional (default: False)
      If warm-starts are enabled, the solution of the last Newton iteration
      on the Laplace approximation of the posterior mode is used as
      initialization for the next call of _posterior_mode(). This can speed
      up convergence when _posterior_mode is called several times on similar
      problems as in hyperparameter optimization.
  
  copy_X_train : bool, optional (default: True)
      If True, a persistent copy of the training data is stored in the
      object. Otherwise, just a reference to the training data is stored,
      which might cause predictions to change if the data is modified
      externally.
  
  random_state : integer or numpy.RandomState, optional
      The generator used to initialize the centers. If an integer is
      given, it fixes the seed. Defaults to the global numpy random
      number generator.
  
  Attributes
  ----------
  X_train_ : array-like, shape = (n_samples, n_features)
      Feature values in training data (also required for prediction)
  
  y_train_: array-like, shape = (n_samples,)
      Target values in training data (also required for prediction)
  
  classes_ : array-like, shape = (n_classes,)
      Unique class labels.
  
  kernel_: kernel object
      The kernel used for prediction. The structure of the kernel is the
      same as the one passed as parameter but with optimized hyperparameters
  
  L_: array-like, shape = (n_samples, n_samples)
      Lower-triangular Cholesky decomposition of the kernel in X_train_
  
  pi_: array-like, shape = (n_samples,)
      The probabilities of the positive class for the training points
      X_train_
  
  W_sr_: array-like, shape = (n_samples,)
      Square root of W, the Hessian of log-likelihood of the latent function
      values for the observed labels. Since W is diagonal, only the diagonal
      of sqrt(W) is stored.
  
  log_marginal_likelihood_value_: float
      The log-marginal-likelihood of ``self.kernel_.theta``
docstr: Fit Gaussian process classification model
  
  Parameters
  ----------
  X : array-like, shape = (n_samples, n_features)
      Training data
  
  y : array-like, shape = (n_samples,)
      Target values, must be binary
  
  Returns
  -------
  self : returns an instance of self.
docstr_tok: ["Fit","Gaussian","process","classification","model","Parameters","--","--","--","--","--","X",":","array-like",",","shape","=","(","n_samples",",","n_features",")","Training","data","y",":","array-like",",","shape","=","(","n_samples",",",")","Target","values",",","must","be","binary","Returns","--","--","--","-","self",":","returns","an","instance","of","self","."]
code: def fit(self, X, y):
      """Fit Gaussian process classification model
  
      Parameters
      ----------
      X : array-like, shape = (n_samples, n_features)
          Training data
  
      y : array-like, shape = (n_samples,)
          Target values, must be binary
  
      Returns
      -------
      self : returns an instance of self.
      """
      if self.kernel is None:  # Use an RBF kernel as default
          self.kernel_ = C(1.0, constant_value_bounds="fixed") * RBF(
              1.0, length_scale_bounds="fixed"
          )
      else:
          self.kernel_ = clone(self.kernel)
  
      self.rng = check_random_state(self.random_state)
  
      self.X_train_ = np.copy(X) if self.copy_X_train else X
  
      # Encode class labels and check that it is a binary classification
      # problem
      label_encoder = LabelEncoder()
      self.y_train_ = label_encoder.fit_transform(y)
      self.classes_ = label_encoder.classes_
      if self.classes_.size > 2:
          raise ValueError(
              "%s supports only binary classification. "
              "y contains classes %s"
              % (self.__class__.__name__, self.classes_)
          )
      elif self.classes_.size == 1:
          raise ValueError(
              "{0:s} requires 2 classes.".format(
                  self.__class__.__name__
              )
          )
  
      if self.optimizer is not None and self.kernel_.n_dims > 0:
          # Choose hyperparameters based on maximizing the log-marginal
          # likelihood (potentially starting from several initial values)
          def obj_func(theta, eval_gradient=True):
              if eval_gradient:
                  lml, grad = self.log_marginal_likelihood(
                      theta, eval_gradient=True
                  )
                  return -lml, -grad
              else:
                  return -self.log_marginal_likelihood(theta)
  
          # First optimize starting from theta specified in kernel
          optima = [
              self._constrained_optimization(
                  obj_func, self.kernel_.theta, self.kernel_.bounds
              )
          ]
  
          # Additional runs are performed from log-uniform chosen initial
          # theta
          if self.n_restarts_optimizer > 0:
              if not np.isfinite(self.kernel_.bounds).all():
                  raise ValueError(
                      "Multiple optimizer restarts (n_restarts_optimizer>0) "
                      "requires that all bounds are finite."
                  )
              bounds = self.kernel_.bounds
              for iteration in range(self.n_restarts_optimizer):
                  theta_initial = np.exp(
                      self.rng.uniform(bounds[:, 0], bounds[:, 1])
                  )
                  optima.append(
                      self._constrained_optimization(
                          obj_func, theta_initial, bounds
                      )
                  )
          # Select result from run with minimal (negative) log-marginal
          # likelihood
          lml_values = list(map(itemgetter(1), optima))
          self.kernel_.theta = optima[np.argmin(lml_values)][0]
          self.log_marginal_likelihood_value_ = -np.min(lml_values)
      else:
          self.log_marginal_likelihood_value_ = (
              self.log_marginal_likelihood(self.kernel_.theta)
          )
  
      # Precompute quantities required for predictions which are independent
      # of actual query points
      K = self.kernel_(self.X_train_)
  
      _, (self.pi_, self.W_sr_, self.L_, _, _) = self._posterior_mode(
          K, return_temporaries=True
      )
  
      return self
  
imports: import warnings
  from operator import itemgetter
  import numpy
  from scipy.linalg import cholesky, cho_solve, solve
  from scipy.optimize import fmin_l_bfgs_b
  from scipy.special import erf
  from sklearn.base import BaseEstimator, ClassifierMixin, clone
  from sklearn.gaussian_process.kernels import RBF, CompoundKernel, ConstantKernel
  from sklearn.utils.validation import check_X_y, check_is_fitted, check_array
  from sklearn.utils import check_random_state
  from sklearn.preprocessing import LabelEncoder
  from sklearn.multiclass import OneVsRestClassifier, OneVsOneClassifier
label_desc: Use image node_id 2 for calling the _BinaryGaussianProcessClassifierLaplace obj's underlying member method code with example usage: obj.fit(X, y) and returns: self, unknown,  unknown, unknown