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: The Gaussian Process model fitting method.
  
  Parameters
  ----------
  X : double array_like
      An array with shape (n_samples, n_features) with the input at which
      observations were made.
  
  y : double array_like
      An array with shape (n_samples, ) or shape (n_samples, n_targets)
      with the observations of the output to be predicted.
  
  Returns
  -------
  gp : self
      A fitted Gaussian Process model object awaiting data to perform
      predictions.
docstr_tok: ["The","Gaussian","Process","model","fitting","method",".","Parameters","--","--","--","--","--","X",":","double","array_like","An","array","with","shape","(","n_samples",",","n_features",")","with","the","input","at","which","observations","were","made",".","y",":","double","array_like","An","array","with","shape","(","n_samples",",",")","or","shape","(","n_samples",",","n_targets",")","with","the","observations","of","the","output","to","be","predicted",".","Returns","--","--","--","-","gp",":","self","A","fitted","Gaussian","Process","model","object","awaiting","data","to","perform","predictions","."]
code: def fit(self, X, y):
      """
      The Gaussian Process model fitting method.
  
      Parameters
      ----------
      X : double array_like
          An array with shape (n_samples, n_features) with the input at which
          observations were made.
  
      y : double array_like
          An array with shape (n_samples, ) or shape (n_samples, n_targets)
          with the observations of the output to be predicted.
  
      Returns
      -------
      gp : self
          A fitted Gaussian Process model object awaiting data to perform
          predictions.
      """
      # Run input checks
      self._check_params()
  
      self.random_state = check_random_state(self.random_state)
  
      # Force data to 2D numpy.array
      X, y = check_X_y(X, y, multi_output=True, y_numeric=True)
      self.y_ndim_ = y.ndim
      if y.ndim == 1:
          y = y[:, np.newaxis]
  
      # Check shapes of DOE & observations
      n_samples, n_features = X.shape
      _, n_targets = y.shape
  
      # Run input checks
      self._check_params(n_samples)
  
      # Normalize data or don't
      if self.normalize:
          X_mean = np.mean(X, axis=0)
          X_std = np.std(X, axis=0)
          y_mean = np.mean(y, axis=0)
          y_std = np.std(y, axis=0)
          X_std[X_std == 0.0] = 1.0
          y_std[y_std == 0.0] = 1.0
          # center and scale X if necessary
          X = (X - X_mean) / X_std
          y = (y - y_mean) / y_std
      else:
          X_mean = np.zeros(1)
          X_std = np.ones(1)
          y_mean = np.zeros(1)
          y_std = np.ones(1)
  
      # Calculate matrix of distances D between samples
      D, ij = l1_cross_distances(X)
      if (
          np.min(np.sum(D, axis=1)) == 0.0
          and self.corr != correlation.pure_nugget
      ):
          raise Exception(
              "Multiple input features cannot have the same"
              " target value."
          )
  
      # Regression matrix and parameters
      F = self.regr(X)
      n_samples_F = F.shape[0]
      if F.ndim > 1:
          p = F.shape[1]
      else:
          p = 1
      if n_samples_F != n_samples:
          raise Exception(
              "Number of rows in F and X do not match. Most "
              "likely something is going wrong with the "
              "regression model."
          )
      if p > n_samples_F:
          raise Exception(
              (
                  "Ordinary least squares problem is undetermined "
                  "n_samples=%d must be greater than the "
                  "regression model size p=%d."
              )
              % (n_samples, p)
          )
      if self.beta0 is not None:
          if self.beta0.shape[0] != p:
              raise Exception("Shapes of beta0 and F do not match.")
  
      # Set attributes
      self.X = X
      self.y = y
      self.D = D
      self.ij = ij
      self.F = F
      self.X_mean, self.X_std = X_mean, X_std
      self.y_mean, self.y_std = y_mean, y_std
  
      # Determine Gaussian Process model parameters
      if self.thetaL is not None and self.thetaU is not None:
          # Maximum Likelihood Estimation of the parameters
          if self.verbose:
              print(
                  "Performing Maximum Likelihood Estimation of the "
                  "autocorrelation parameters..."
              )
          (
              self.theta_,
              self.reduced_likelihood_function_value_,
              par,
          ) = self._arg_max_reduced_likelihood_function()
          if np.isinf(self.reduced_likelihood_function_value_):
              raise Exception(
                  "Bad parameter region. " "Try increasing upper bound"
              )
  
      else:
          # Given parameters
          if self.verbose:
              print(
                  "Given autocorrelation parameters. "
                  "Computing Gaussian Process model parameters..."
              )
          self.theta_ = self.theta0
          (
              self.reduced_likelihood_function_value_,
              par,
          ) = self.reduced_likelihood_function()
          if np.isinf(self.reduced_likelihood_function_value_):
              raise Exception("Bad point. Try increasing theta0.")
  
      self.beta = par["beta"]
      self.gamma = par["gamma"]
      self.sigma2 = par["sigma2"]
      self.C = par["C"]
      self.Ft = par["Ft"]
      self.G = par["G"]
  
      if self.storage_mode == "light":
          # Delete heavy data (it will be computed again if required)
          # (it is required only when MSE is wanted in self.predict)
          if self.verbose:
              print(
                  "Light storage mode specified. "
                  "Flushing autocorrelation matrix..."
              )
          self.D = None
          self.ij = None
          self.F = None
          self.C = None
          self.Ft = None
          self.G = None
  
      return self
  
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 2 for calling the GaussianProcess obj's underlying member method code with example usage: obj.fit(X, y) and returns: self