class_docstr: The legacy Gaussian Process model class.
  
  .. deprecated:: 0.18
      This class will be removed in 0.20.
      Use the :class:`GaussianProcessRegressor` instead.
  
  Read more in the :ref:`User Guide <gaussian_process>`.
  
  Parameters
  ----------
  regr : string or callable, optional
      A regression function returning an array of outputs of the linear
      regression functional basis. The number of observations n_samples
      should be greater than the size p of this basis.
      Default assumes a simple constant regression trend.
      Available built-in regression models are::
  
          'constant', 'linear', 'quadratic'
  
  corr : string or callable, optional
      A stationary autocorrelation function returning the autocorrelation
      between two points x and x'.
      Default assumes a squared-exponential autocorrelation model.
      Built-in correlation models are::
  
          'absolute_exponential', 'squared_exponential',
          'generalized_exponential', 'cubic', 'linear'
  
  beta0 : double array_like, optional
      The regression weight vector to perform Ordinary Kriging (OK).
      Default assumes Universal Kriging (UK) so that the vector beta of
      regression weights is estimated using the maximum likelihood
      principle.
  
  storage_mode : string, optional
      A string specifying whether the Cholesky decomposition of the
      correlation matrix should be stored in the class (storage_mode =
      'full') or not (storage_mode = 'light').
      Default assumes storage_mode = 'full', so that the
      Cholesky decomposition of the correlation matrix is stored.
      This might be a useful parameter when one is not interested in the
      MSE and only plan to estimate the BLUP, for which the correlation
      matrix is not required.
  
  verbose : boolean, optional
      A boolean specifying the verbose level.
      Default is verbose = False.
  
  theta0 : double array_like, optional
      An array with shape (n_features, ) or (1, ).
      The parameters in the autocorrelation model.
      If thetaL and thetaU are also specified, theta0 is considered as
      the starting point for the maximum likelihood estimation of the
      best set of parameters.
      Default assumes isotropic autocorrelation model with theta0 = 1e-1.
  
  thetaL : double array_like, optional
      An array with shape matching theta0's.
      Lower bound on the autocorrelation parameters for maximum
      likelihood estimation.
      Default is None, so that it skips maximum likelihood estimation and
      it uses theta0.
  
  thetaU : double array_like, optional
      An array with shape matching theta0's.
      Upper bound on the autocorrelation parameters for maximum
      likelihood estimation.
      Default is None, so that it skips maximum likelihood estimation and
      it uses theta0.
  
  normalize : boolean, optional
      Input X and observations y are centered and reduced wrt
      means and standard deviations estimated from the n_samples
      observations provided.
      Default is normalize = True so that data is normalized to ease
      maximum likelihood estimation.
  
  nugget : double or ndarray, optional
      Introduce a nugget effect to allow smooth predictions from noisy
      data.  If nugget is an ndarray, it must be the same length as the
      number of data points used for the fit.
      The nugget is added to the diagonal of the assumed training covariance;
      in this way it acts as a Tikhonov regularization in the problem.  In
      the special case of the squared exponential correlation function, the
      nugget mathematically represents the variance of the input values.
      Default assumes a nugget close to machine precision for the sake of
      robustness (nugget = 10. * MACHINE_EPSILON).
  
  optimizer : string, optional
      A string specifying the optimization algorithm to be used.
      Default uses 'fmin_cobyla' algorithm from scipy.optimize.
      Available optimizers are::
  
          'fmin_cobyla', 'Welch'
  
      'Welch' optimizer is dued to Welch et al., see reference [WBSWM1992]_.
      It consists in iterating over several one-dimensional optimizations
      instead of running one single multi-dimensional optimization.
  
  random_start : int, optional
      The number of times the Maximum Likelihood Estimation should be
      performed from a random starting point.
      The first MLE always uses the specified starting point (theta0),
      the next starting points are picked at random according to an
      exponential distribution (log-uniform on [thetaL, thetaU]).
      Default does not use random starting point (random_start = 1).
  
  random_state: integer or numpy.RandomState, optional
      The generator used to shuffle the sequence of coordinates of theta in
      the Welch optimizer. If an integer is given, it fixes the seed.
      Defaults to the global numpy random number generator.
  
  
  Attributes
  ----------
  theta_ : array
      Specified theta OR the best set of autocorrelation parameters (the         sought maximizer of the reduced likelihood function).
  
  reduced_likelihood_function_value_ : array
      The optimal reduced likelihood function value.
  
  Examples
  --------
  >>> import numpy as np
  >>> from sklearn.gaussian_process import GaussianProcess
  >>> X = np.array([[1., 3., 5., 6., 7., 8.]]).T
  >>> y = (X * np.sin(X)).ravel()
  >>> gp = GaussianProcess(theta0=0.1, thetaL=.001, thetaU=1.)
  >>> gp.fit(X, y)                                      # doctest: +ELLIPSIS
  GaussianProcess(beta0=None...
          ...
  
  Notes
  -----
  The presentation implementation is based on a translation of the DACE
  Matlab toolbox, see reference [NLNS2002]_.
  
  References
  ----------
  
  .. [NLNS2002] `H.B. Nielsen, S.N. Lophaven, H. B. Nielsen and J.
      Sondergaard.  DACE - A MATLAB Kriging Toolbox.` (2002)
      http://imedea.uib-csic.es/master/cambioglobal/Modulo_V_cod101615/Lab/lab_maps/krigging/DACE-krigingsoft/dace/dace.pdf
  
  .. [WBSWM1992] `W.J. Welch, R.J. Buck, J. Sacks, H.P. Wynn, T.J. Mitchell,
      and M.D.  Morris (1992). Screening, predicting, and computer
      experiments.  Technometrics, 34(1) 15--25.`
      http://www.jstor.org/stable/1269548
class_docstr_tok: ["The","legacy","Gaussian","Process","model","class",".","..","deprecated",":",":","0.18","This","class","will","be","removed","in","0.20",".","Use","the",":","class",":","`","GaussianProcessRegressor","`","instead",".","Read","more","in","the",":","ref",":","`","User","Guide","<","gaussian_process",">","`",".","Parameters","--","--","--","--","--","regr",":","string","or","callable",",","optional","A","regression","function","returning","an","array","of","outputs","of","the","linear","regression","functional","basis",".","The","number","of","observations","n_samples","should","be","greater","than","the","size","p","of","this","basis",".","Default","assumes","a","simple","constant","regression","trend",".","Available","built-in","regression","models","are",":",":","'constant","'",",","'linear","'",",","'quadratic'","corr",":","string","or","callable",",","optional","A","stationary","autocorrelation","function","returning","the","autocorrelation","between","two","points","x","and","x","'",".","Default","assumes","a","squared-exponential","autocorrelation","model",".","Built-in","correlation","models","are",":",":","'absolute_exponential","'",",","'squared_exponential","'",",","'generalized_exponential","'",",","'cubic","'",",","'linear'","beta0",":","double","array_like",",","optional","The","regression","weight","vector","to","perform","Ordinary","Kriging","(","OK",")",".","Default","assumes","Universal","Kriging","(","UK",")","so","that","the","vector","beta","of","regression","weights","is","estimated","using","the","maximum","likelihood","principle",".","storage_mode",":","string",",","optional","A","string","specifying","whether","the","Cholesky","decomposition","of","the","correlation","matrix","should","be","stored","in","the","class","(","storage_mode","=","'full","'",")","or","not","(","storage_mode","=","'light","'",")",".","Default","assumes","storage_mode","=","'full","'",",","so","that","the","Cholesky","decomposition","of","the","correlation","matrix","is","stored",".","This","might","be","a","useful","parameter","when","one","is","not","interested","in","the","MSE","and","only","plan","to","estimate","the","BLUP",",","for","which","the","correlation","matrix","is","not","required",".","verbose",":","boolean",",","optional","A","boolean","specifying","the","verbose","level",".","Default","is","verbose","=","False",".","theta0",":","double","array_like",",","optional","An","array","with","shape","(","n_features",",",")","or","(","1",",",")",".","The","parameters","in","the","autocorrelation","model",".","If","thetaL","and","thetaU","are","also","specified",",","theta0","is","considered","as","the","starting","point","for","the","maximum","likelihood","estimation","of","the","best","set","of","parameters",".","Default","assumes","isotropic","autocorrelation","model","with","theta0","=","1e-1",".","thetaL",":","double","array_like",",","optional","An","array","with","shape","matching","theta0","'s",".","Lower","bound","on","the","autocorrelation","parameters","for","maximum","likelihood","estimation",".","Default","is","None",",","so","that","it","skips","maximum","likelihood","estimation","and","it","uses","theta0",".","thetaU",":","double","array_like",",","optional","An","array","with","shape","matching","theta0","'s",".","Upper","bound","on","the","autocorrelation","parameters","for","maximum","likelihood","estimation",".","Default","is","None",",","so","that","it","skips","maximum","likelihood","estimation","and","it","uses","theta0",".","normalize",":","boolean",",","optional","Input","X","and","observations","y","are","centered","and","reduced","wrt","means","and","standard","deviations","estimated","from","the","n_samples","observations","provided",".","Default","is","normalize","=","True","so","that","data","is","normalized","to","ease","maximum","likelihood","estimation",".","nugget",":","double","or","ndarray",",","optional","Introduce","a","nugget","effect","to","allow","smooth","predictions","from","noisy","data",".","If","nugget","is","an","ndarray",",","it","must","be","the","same","length","as","the","number","of","data","points","used","for","the","fit",".","The","nugget","is","added","to","the","diagonal","of","the","assumed","training","covariance",";","in","this","way","it","acts","as","a","Tikhonov","regularization","in","the","problem",".","In","the","special","case","of","the","squared","exponential","correlation","function",",","the","nugget","mathematically","represents","the","variance","of","the","input","values",".","Default","assumes","a","nugget","close","to","machine","precision","for","the","sake","of","robustness","(","nugget","=","10",".","*","MACHINE_EPSILON",")",".","optimizer",":","string",",","optional","A","string","specifying","the","optimization","algorithm","to","be","used",".","Default","uses","'fmin_cobyla","'","algorithm","from","scipy.optimize",".","Available","optimizers","are",":",":","'fmin_cobyla","'",",","'Welch'","'Welch","'","optimizer","is","dued","to","Welch","et","al.",",","see","reference","[","WBSWM1992","]","_",".","It","consists","in","iterating","over","several","one-dimensional","optimizations","instead","of","running","one","single","multi-dimensional","optimization",".","random_start",":","int",",","optional","The","number","of","times","the","Maximum","Likelihood","Estimation","should","be","performed","from","a","random","starting","point",".","The","first","MLE","always","uses","the","specified","starting","point","(","theta0",")",",","the","next","starting","points","are","picked","at","random","according","to","an","exponential","distribution","(","log-uniform","on","[","thetaL",",","thetaU","]",")",".","Default","does","not","use","random","starting","point","(","random_start","=","1",")",".","random_state",":","integer","or","numpy.RandomState",",","optional","The","generator","used","to","shuffle","the","sequence","of","coordinates","of","theta","in","the","Welch","optimizer",".","If","an","integer","is","given",",","it","fixes","the","seed",".","Defaults","to","the","global","numpy","random","number","generator",".","Attributes","--","--","--","--","--","theta_",":","array","Specified","theta","OR","the","best","set","of","autocorrelation","parameters","(","the","sought","maximizer","of","the","reduced","likelihood","function",")",".","reduced_likelihood_function_value_",":","array","The","optimal","reduced","likelihood","function","value",".","Examples","--","--","--","--",">",">",">","import","numpy","as","np",">",">",">","from","sklearn.gaussian_process","import","GaussianProcess",">",">",">","X","=","np.array","(","[","[","1.",",","3.",",","5.",",","6.",",","7.",",","8",".","]","]",")",".T",">",">",">","y","=","(","X","*","np.sin","(","X",")",")",".ravel","(",")",">",">",">","gp","=","GaussianProcess","(","theta0=0.1",",","thetaL=.001",",","thetaU=1",".",")",">",">",">","gp.fit","(","X",",","y",")","#","doctest",":","+ELLIPSIS","GaussianProcess","(","beta0=None","...","...","Notes","--","--","-","The","presentation","implementation","is","based","on","a","translation","of","the","DACE","Matlab","toolbox",",","see","reference","[","NLNS2002","]","_.","References","--","--","--","--","--","..","[","NLNS2002","]","`","H.B",".","Nielsen",",","S.N",".","Lophaven",",","H.","B.","Nielsen","and","J.","Sondergaard",".","DACE","-","A","MATLAB","Kriging","Toolbox.","`","(","2002",")","http",":","\/\/imedea.uib-csic.es\/master\/cambioglobal\/Modulo_V_cod101615\/Lab\/lab_maps\/krigging\/DACE-krigingsoft\/dace\/dace.pdf","..","[","WBSWM1992","]","`","W.J",".","Welch",",","R.J.","Buck",",","J.","Sacks",",","H.P",".","Wynn",",","T.J.","Mitchell",",","and","M.D",".","Morris","(","1992",")",".","Screening",",","predicting",",","and","computer","experiments",".","Technometrics",",","34","(","1",")","15","--","25.","`","http",":","\/\/www.jstor.org\/stable\/1269548"]
docstr: This function estimates the autocorrelation parameters theta as the
  maximizer of the reduced likelihood function.
  (Minimization of the opposite reduced likelihood function is used for
  convenience)
  
  Parameters
  ----------
  self : All parameters are stored in the Gaussian Process model object.
  
  Returns
  -------
  optimal_theta : array_like
      The best set of autocorrelation parameters (the sought maximizer of
      the reduced likelihood function).
  
  optimal_reduced_likelihood_function_value : double
      The optimal reduced likelihood function value.
  
  optimal_par : dict
      The BLUP parameters associated to thetaOpt.
docstr_tok: ["This","function","estimates","the","autocorrelation","parameters","theta","as","the","maximizer","of","the","reduced","likelihood","function",".","(","Minimization","of","the","opposite","reduced","likelihood","function","is","used","for","convenience",")","Parameters","--","--","--","--","--","self",":","All","parameters","are","stored","in","the","Gaussian","Process","model","object",".","Returns","--","--","--","-","optimal_theta",":","array_like","The","best","set","of","autocorrelation","parameters","(","the","sought","maximizer","of","the","reduced","likelihood","function",")",".","optimal_reduced_likelihood_function_value",":","double","The","optimal","reduced","likelihood","function","value",".","optimal_par",":","dict","The","BLUP","parameters","associated","to","thetaOpt","."]
code: def _arg_max_reduced_likelihood_function(self):
      """
      This function estimates the autocorrelation parameters theta as the
      maximizer of the reduced likelihood function.
      (Minimization of the opposite reduced likelihood function is used for
      convenience)
  
      Parameters
      ----------
      self : All parameters are stored in the Gaussian Process model object.
  
      Returns
      -------
      optimal_theta : array_like
          The best set of autocorrelation parameters (the sought maximizer of
          the reduced likelihood function).
  
      optimal_reduced_likelihood_function_value : double
          The optimal reduced likelihood function value.
  
      optimal_par : dict
          The BLUP parameters associated to thetaOpt.
      """
  
      # Initialize output
      best_optimal_theta = []
      best_optimal_rlf_value = []
      best_optimal_par = []
  
      if self.verbose:
          print("The chosen optimizer is: " + str(self.optimizer))
          if self.random_start > 1:
              print(
                  str(self.random_start)
                  + " random starts are required."
              )
  
      percent_completed = 0.0
  
      # Force optimizer to fmin_cobyla if the model is meant to be isotropic
      if self.optimizer == "Welch" and self.theta0.size == 1:
          self.optimizer = "fmin_cobyla"
  
      if self.optimizer == "fmin_cobyla":
  
          def minus_reduced_likelihood_function(log10t):
              return -self.reduced_likelihood_function(
                  theta=10.0**log10t
              )[0]
  
          constraints = []
          for i in range(self.theta0.size):
              constraints.append(
                  lambda log10t, i=i: log10t[i]
                  - np.log10(self.thetaL[0, i])
              )
              constraints.append(
                  lambda log10t, i=i: np.log10(self.thetaU[0, i])
                  - log10t[i]
              )
  
          for k in range(self.random_start):
              if k == 0:
                  # Use specified starting point as first guess
                  theta0 = self.theta0
              else:
                  # Generate a random starting point log10-uniformly
                  # distributed between bounds
                  log10theta0 = np.log10(
                      self.thetaL
                  ) + self.random_state.rand(
                      *self.theta0.shape
                  ) * np.log10(
                      self.thetaU / self.thetaL
                  )
                  theta0 = 10.0**log10theta0
  
              # Run Cobyla
              try:
                  log10_optimal_theta = optimize.fmin_cobyla(
                      minus_reduced_likelihood_function,
                      np.log10(theta0).ravel(),
                      constraints,
                      iprint=0,
                  )
              except ValueError as ve:
                  print(
                      "Optimization failed. Try increasing the ``nugget``"
                  )
                  raise ve
  
              optimal_theta = 10.0**log10_optimal_theta
              (
                  optimal_rlf_value,
                  optimal_par,
              ) = self.reduced_likelihood_function(theta=optimal_theta)
  
              # Compare the new optimizer to the best previous one
              if k > 0:
                  if optimal_rlf_value > best_optimal_rlf_value:
                      best_optimal_rlf_value = optimal_rlf_value
                      best_optimal_par = optimal_par
                      best_optimal_theta = optimal_theta
              else:
                  best_optimal_rlf_value = optimal_rlf_value
                  best_optimal_par = optimal_par
                  best_optimal_theta = optimal_theta
              if self.verbose and self.random_start > 1:
                  if (20 * k) / self.random_start > percent_completed:
                      percent_completed = (20 * k) / self.random_start
                      print("%s completed" % (5 * percent_completed))
  
          optimal_rlf_value = best_optimal_rlf_value
          optimal_par = best_optimal_par
          optimal_theta = best_optimal_theta
  
      elif self.optimizer == "Welch":
          # Backup of the given attributes
          theta0, thetaL, thetaU = self.theta0, self.thetaL, self.thetaU
          corr = self.corr
          verbose = self.verbose
  
          # This will iterate over fmin_cobyla optimizer
          self.optimizer = "fmin_cobyla"
          self.verbose = False
  
          # Initialize under isotropy assumption
          if verbose:
              print("Initialize under isotropy assumption...")
          self.theta0 = check_array(self.theta0.min())
          self.thetaL = check_array(self.thetaL.min())
          self.thetaU = check_array(self.thetaU.max())
          (
              theta_iso,
              optimal_rlf_value_iso,
              par_iso,
          ) = self._arg_max_reduced_likelihood_function()
          optimal_theta = theta_iso + np.zeros(theta0.shape)
  
          # Iterate over all dimensions of theta allowing for anisotropy
          if verbose:
              print("Now improving allowing for anisotropy...")
          for i in self.random_state.permutation(theta0.size):
              if verbose:
                  print("Proceeding along dimension %d..." % (i + 1))
              self.theta0 = check_array(theta_iso)
              self.thetaL = check_array(thetaL[0, i])
              self.thetaU = check_array(thetaU[0, i])
  
              def corr_cut(t, d):
                  return corr(
                      check_array(
                          np.hstack(
                              [
                                  optimal_theta[0][0:i],
                                  t[0],
                                  optimal_theta[0][(i + 1) : :],
                              ]
                          )
                      ),
                      d,
                  )
  
              self.corr = corr_cut
              (
                  optimal_theta[0, i],
                  optimal_rlf_value,
                  optimal_par,
              ) = self._arg_max_reduced_likelihood_function()
  
          # Restore the given attributes
          self.theta0, self.thetaL, self.thetaU = theta0, thetaL, thetaU
          self.corr = corr
          self.optimizer = "Welch"
          self.verbose = verbose
  
      else:
          raise NotImplementedError(
              "This optimizer ('%s') is not "
              "implemented yet. Please contribute!" % self.optimizer
          )
  
      return optimal_theta, optimal_rlf_value, optimal_par
  
file_path: catboost/contrib/python/scikit-learn/py2/sklearn/gaussian_process/gaussian_process.py
imports: from __future__ import print_function
  import numpy
  from scipy import linalg, optimize
  from ..base import BaseEstimator, RegressorMixin
  from ..metrics.pairwise import manhattan_distances
  from ..utils import check_random_state, check_array, check_X_y
  from ..utils.validation import check_is_fitted
  from .None import regression_models
  from .None import correlation_models
  from ..utils import deprecated
label_desc: Use image node_id 5 for calling the GaussianProcess obj's underlying member method code with example usage: obj._arg_max_reduced_likelihood_function() and returns: optimal_theta,  optimal_rlf_value,  optimal_par, unknown, corr