This page

Citing

Please consider citing the scikit-learn.

9.17.5. sklearn.preprocessing.KernelCenterer

class sklearn.preprocessing.KernelCenterer

Center a kernel matrix

This is equivalent to centering phi(X) with sklearn.preprocessing.Scaler(with_std=False).

Methods

fit(K) Fit KernelCenterer
fit_transform(X[, y]) Fit to data, then transform it
set_params(**params) Set the parameters of the estimator.
transform(K[, copy]) Center kernel
__init__()

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

fit(K)

Fit KernelCenterer

Parameters :

K : numpy array of shape [n_samples, n_samples]

Kernel matrix.

Returns :

self : returns an instance of self.

fit_transform(X, y=None, **fit_params)

Fit to data, then transform it

Fits transformer to X and y with optional parameters fit_params and returns a transformed version of X.

Parameters :

X : numpy array of shape [n_samples, n_features]

Training set.

y : numpy array of shape [n_samples]

Target values.

Returns :

X_new : numpy array of shape [n_samples, n_features_new]

Transformed array.

set_params(**params)

Set the parameters of the estimator.

The method works on simple estimators as well as on nested objects (such as pipelines). The former have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.

Returns :self :
transform(K, copy=True)

Center kernel

Parameters :

K : numpy array of shape [n_samples1, n_samples2]

Kernel matrix.

Returns :

K_new : numpy array of shape [n_samples1, n_samples2]