SparseGaussianProcessRegressor#
- class SparseGaussianProcessRegressor(*, kernel: Literal['rbf', 'matern32', 'matern52'] | AbstractKernel = 'matern52', mean_function: Literal['zero', 'constant', 'linear'] | AbstractMeanFunction = 'constant', learned_noise: Literal['constant', 'heteroscedastic'] = 'constant', num_inducing: int | None = None, minibatch_size: int | None = None, random_state: int = 0, iterations: int = 2000)[source]#
skgp’s
SparseGPRegressoras a scikit-learn estimator: a sparse Gaussian process regression model, for data with too many rows for an exact one, with skgp’s settings.There are no
features,targetorschema(seeGaussianProcessRegressor), and nonoise_column, which aSparseGPRegressordoes not take. The settings, checked atfit, are aSparseGPRegressor’s:kernelandmean_function: as forGaussianProcessRegressor.learned_noise:"constant"(the default) or"heteroscedastic".num_inducing: how many inducing points summarise the data, orNone(the default) to let skgp choose.minibatch_size: the rows each iteration looks at, orNone(the default) for all.random_state: the seed of everything random in the fit, 0 by default.iterations: 2,000 by default: the most iterations a fit on all rows may take, and exactly the number a fit on minibatches runs.
After
fit,fitted_,n_features_in_andfeature_names_in_are as forGaussianProcessRegressor.- fit(X: Any, y: Any) Self#
Fit to the inputs
Xand the targety, and return this estimator, fitted.Xis a Polars or pandas dataframe, whose columns keep their names, or a numeric array, whose columns are calledx0,x1, …;yholds one number per row. The skgp model checks the data and the settings, and raisesValueErrornaming what is wrong. The fitted skgp model isfitted_.
- predict(X: Any, return_std: bool = False, return_cov: bool = False, include_noise: bool = True) Any#
The predicted mean of each row of
X, in the target’s units, as a numpy array; withreturn_std=Truealso the standard deviation of each row, and withreturn_cov=Truethe covariance between the rows instead, as scikit-learn’sGaussianProcessRegressor.predictgives them.Unlike scikit-learn’s, the spread is of a new observation, measurement noise included, unless
include_noise=False, which gives the spread of the underlying curve.Xhas the columns it had atfit, as scikit-learn requires, so a model with known noise has itsnoise_columnthere even for the curve alone, whose prediction does not use it.
- sample_y(X: Any, n_samples: int = 1, random_state: int = 0, include_noise: bool = True) ndarray#
Random samples of the prediction at the rows of
X: a numpy array of a row for each row and a column for each sample, as scikit-learn’ssample_ygives (seeskgp.Prediction.sample). Each sample includes measurement noise unlessinclude_noise=False.random_stateis a whole number.
- score(X: Any, y: Any, sample_weight: None = None) float#
The mean CRPS of the predictions of
yat the rowsX, with its sign flipped, so that higher is better (seeneg_crps). It is whatcross_val_scoreandGridSearchCVuse when given noscoring, in place of the R² scikit-learn’s regressors give. Rows cannot be weighted.