scikits.learn.decomposition.KernelPCA¶
- class scikits.learn.decomposition.KernelPCA(n_components=None, kernel='linear', sigma=1.0, degree=3, alpha=1.0, fit_inverse_transform=False)¶
Kernel Principal component analysis (KPCA)
Non-linear dimensionality reduction through the use of kernels.
Parameters : n_components: int or None :
Number of components. If None, all non-zero components are kept.
kernel: “linear” | “poly” | “rbf” | “precomputed” :
kernel Default: “linear”
sigma: float :
width of the rbf kernel Default: 1.0
degree: int :
degree of the polynomial kernel Default: 3
alpha: int :
hyperparameter of the ridge regression that learns the inverse transform (when fit_inverse_transform=True) Default: 1.0
fit_inverse_transform: bool :
learn the inverse transform (i.e. learn to find the pre-image of a point) Default: False
Attributes
lambdas_, alphas_: Eigenvalues and eigenvectors of the centered kernel matrix dual_coef_: Inverse transform matrix X_transformed_fit_: Projection of the fitted data on the kernel principal components Methods
- __init__(n_components=None, kernel='linear', sigma=1.0, degree=3, alpha=1.0, fit_inverse_transform=False)¶
- fit(X, y=None, **params)¶
Fit the model from data in X.
Parameters : X: array-like, shape (n_samples, n_features) :
Training vector, where n_samples in the number of samples and n_features is the number of features.
Returns : self : object
Returns the instance itself.
- fit_transform(X, y=None, **params)¶
Fit the model from data in X and transform X.
Parameters : X: array-like, shape (n_samples, n_features) :
Training vector, where n_samples in the number of samples and n_features is the number of features.
Returns : X_new: array-like, shape (n_samples, n_components) :
- inverse_transform(X)¶
Transform X back to original space.
Parameters : X: array-like, shape (n_samples, n_components) : Returns : X_new: array-like, shape (n_samples, n_features) :
- transform(X)¶
Transform X.
Parameters : X: array-like, shape (n_samples, n_features) : Returns : X_new: array-like, shape (n_samples, n_components) :