sklearn.preprocessing.KernelCenterer¶
-
class
sklearn.preprocessing.KernelCenterer[源代码]¶ Center a kernel matrix
Let K(x, z) be a kernel defined by phi(x)^T phi(z), where phi is a function mapping x to a Hilbert space. KernelCenterer centers (i.e., normalize to have zero mean) the data without explicitly computing phi(x). It is equivalent to centering phi(x) with sklearn.preprocessing.StandardScaler(with_std=False).
Read more in the User Guide.
Methods
fit(K[, y])Fit KernelCenterer fit_transform(X[, y])Fit to data, then transform it. get_params([deep])Get parameters for this estimator. set_params(**params)Set the parameters of this estimator. transform(K[, y, copy])Center kernel matrix. -
__init__()¶ Initialize self. See help(type(self)) for accurate signature.
-
fit(K, y=None)[源代码]¶ 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.
-
get_params(deep=True)[源代码]¶ Get parameters for this estimator.
Parameters: deep: boolean, optional :
If True, will return the parameters for this estimator and contained subobjects that are estimators.
Returns: params : mapping of string to any
Parameter names mapped to their values.
-