GaussianProcessClassifier#
- class GaussianProcessClassifier(*, kernel: Literal['rbf', 'matern32', 'matern52'] | AbstractKernel = 'matern52', mean_function: Literal['zero', 'constant', 'linear'] | AbstractMeanFunction = 'constant', iterations: int = 2000)[source]#
skgp’s
GPClassifieras a scikit-learn estimator: Gaussian process classification of two classes, with skgp’s settings.There are no
features,targetorschema(seeGaussianProcessRegressor). The settings, checked atfit, are aGPClassifier’s:kernelandmean_function: as forGaussianProcessRegressor.iterations: the most iterations the fit may take, 2,000 by default.
After
fit:classes_holds the two classes in sorted order,fitted_is the fitted skgp model, andn_features_in_andfeature_names_in_are as forGaussianProcessRegressor. More than two classes are not supported yet.- fit(X: Any, y: Any) Self#
Fit to the inputs
Xand the classesy, 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 of two classes per row, of any type. The two classes, in sorted order, areclasses_. The fitted skgp model isfitted_.
- predict_proba(X: Any) ndarray#
The probability of each class at each row of
X: a numpy array with a row for each row and a column for each class, in the order ofclasses_.
- sample_y(X: Any, n_samples: int = 1, random_state: int = 0) ndarray#
Random samples of the class at each row of
X: a numpy array of a row for each row and a column for each sample, holding the classes (seeskgp.ClassPrediction.sample). scikit-learn’s classifiers have nosample_y; skgp’s have one so that every estimator samples the same way.random_stateis a whole number.
- score(X: Any, y: Any, sample_weight: None = None) float#
The Brier loss of the predicted probabilities of
yat the rowsX, with its sign flipped, so that higher is better, as scikit-learn’sneg_brier_scorescorer gives it: the mean, over the rows, of the squared difference between the probability ofclasses_[1]and 1 where it is the class, 0 where it is not. It is whatcross_val_scoreandGridSearchCVuse when given noscoring, in place of the accuracy scikit-learn’s classifiers give. Rows cannot be weighted.