class sklearn.gaussian_process.GaussianProcessRegressor(kernel=None, alpha=1e10, optimizer=’fmin_l_bfgs_b’, n_restarts_optimizer=0, normalize_y=False, copy_X_train=True, random_state=None)
[source]
Gaussian process regression (GPR).
The implementation is based on Algorithm 2.1 of Gaussian Processes for Machine Learning (GPML) by Rasmussen and Williams.
In addition to standard scikitlearn estimator API, GaussianProcessRegressor:
Read more in the User Guide.
New in version 0.18.
Parameters: 


Attributes: 

>>> from sklearn.datasets import make_friedman2 >>> from sklearn.gaussian_process import GaussianProcessRegressor >>> from sklearn.gaussian_process.kernels import DotProduct, WhiteKernel >>> X, y = make_friedman2(n_samples=500, noise=0, random_state=0) >>> kernel = DotProduct() + WhiteKernel() >>> gpr = GaussianProcessRegressor(kernel=kernel, ... random_state=0).fit(X, y) >>> gpr.score(X, y) 0.3680... >>> gpr.predict(X[:2,:], return_std=True) (array([653.0..., 592.1...]), array([316.6..., 316.6...]))
fit (X, y)  Fit Gaussian process regression model. 
get_params ([deep])  Get parameters for this estimator. 
log_marginal_likelihood ([theta, eval_gradient])  Returns logmarginal likelihood of theta for training data. 
predict (X[, return_std, return_cov])  Predict using the Gaussian process regression model 
sample_y (X[, n_samples, random_state])  Draw samples from Gaussian process and evaluate at X. 
score (X, y[, sample_weight])  Returns the coefficient of determination R^2 of the prediction. 
set_params (**params)  Set the parameters of this estimator. 
__init__(kernel=None, alpha=1e10, optimizer=’fmin_l_bfgs_b’, n_restarts_optimizer=0, normalize_y=False, copy_X_train=True, random_state=None)
[source]
fit(X, y)
[source]
Fit Gaussian process regression model.
Parameters: 


Returns: 

get_params(deep=True)
[source]
Get parameters for this estimator.
Parameters: 


Returns: 

log_marginal_likelihood(theta=None, eval_gradient=False)
[source]
Returns logmarginal likelihood of theta for training data.
Parameters: 


Returns: 

predict(X, return_std=False, return_cov=False)
[source]
Predict using the Gaussian process regression model
We can also predict based on an unfitted model by using the GP prior. In addition to the mean of the predictive distribution, also its standard deviation (return_std=True) or covariance (return_cov=True). Note that at most one of the two can be requested.
Parameters: 


Returns: 

rng
DEPRECATED: Attribute rng was deprecated in version 0.19 and will be removed in 0.21.
sample_y(X, n_samples=1, random_state=0)
[source]
Draw samples from Gaussian process and evaluate at X.
Parameters: 


Returns: 

score(X, y, sample_weight=None)
[source]
Returns the coefficient of determination R^2 of the prediction.
The coefficient R^2 is defined as (1  u/v), where u is the residual sum of squares ((y_true  y_pred) ** 2).sum() and v is the total sum of squares ((y_true  y_true.mean()) ** 2).sum(). The best possible score is 1.0 and it can be negative (because the model can be arbitrarily worse). A constant model that always predicts the expected value of y, disregarding the input features, would get a R^2 score of 0.0.
Parameters: 


Returns: 

set_params(**params)
[source]
Set the parameters of this estimator.
The method works on simple estimators as well as on nested objects (such as pipelines). The latter have parameters of the form <component>__<parameter>
so that it’s possible to update each component of a nested object.
Returns: 


y_train_mean
DEPRECATED: Attribute y_train_mean was deprecated in version 0.19 and will be removed in 0.21.
sklearn.gaussian_process.GaussianProcessRegressor
© 2007–2018 The scikitlearn developers
Licensed under the 3clause BSD License.
http://scikitlearn.org/stable/modules/generated/sklearn.gaussian_process.GaussianProcessRegressor.html