Kernel Principal Component Analysis (KPCA)¶
Non-linear dimensionality reduction through the use of kernels
Configuration:
n_components
Number of components. If None, all non-zero components are kept.
kernel
Kernel. Default=”linear”.
degree
Degree for poly kernels. Ignored by other kernels.
gamma
Kernel coefficient for rbf, poly and sigmoid kernels. Ignored by other kernels.
coef0
Independent term in poly and sigmoid kernels. Ignored by other kernels.
alpha
Hyperparameter of the ridge regression that learns the inverse transform (when fit_inverse_transform=True).
fit_inverse_transform
Learn the inverse transform for non-precomputed kernels. (i.e. learn to find the pre-image of a point)
remove_zero_eig
If True, then all components with zero eigenvalues are removed, so that the number of components in the output may be < n_components (and sometimes even zero due to numerical instability). When n_components is None, this parameter is ignored and components with zero eigenvalues are removed regardless.
eigen_solver
Select eigensolver to use. If n_components is much less than the number of training samples, arpack may be more efficient than the dense eigensolver.
tol
Convergence tolerance for arpack. If 0, optimal value will be chosen by arpack.
max_iter
Maximum number of iterations for arpack. If None, optimal value will be chosen by arpack.
random_state
If int, random_state is the seed used by the random number generator; If RandomState instance, random_state is the random number generator; If None, the random number generator is the RandomState instance used by np.random. Used when
eigen_solver
== ‘arpack’.New in version 0.18.
n_jobs
The number of parallel jobs to run.
None
means 1 unless in ajoblib.parallel_backend
context.-1
means using all processors. See n_jobs for more details.New in version 0.18.
Attributes:
lambdas_
Eigenvalues of the centered kernel matrix in decreasing order. If n_components and remove_zero_eig are not set, then all values are stored.
alphas_
Eigenvectors of the centered kernel matrix. If n_components and remove_zero_eig are not set, then all components are stored.
dual_coef_
Inverse transform matrix. Only available when
fit_inverse_transform
is True.X_transformed_fit_
Projection of the fitted data on the kernel principal components. Only available when
fit_inverse_transform
is True.X_fit_
The data used to fit the model. If copy_X=False, then X_fit_ is a reference. This attribute is used for the calls to transform.
Input ports:
- Output ports:
- model : model
- Model
- n_components (n_components)
- Number of components. If None, all non-zero components are kept.
- kernel (kernel)
- Kernel. Default=”linear”.
- degree (degree)
- Degree for poly kernels. Ignored by other kernels.
- gamma (gamma)
- Kernel coefficient for rbf, poly and sigmoid kernels. Ignored by other kernels.
- coef0 (coef0)
- Independent term in poly and sigmoid kernels. Ignored by other kernels.
- alpha (alpha)
- Hyperparameter of the ridge regression that learns the inverse transform (when fit_inverse_transform=True).
- fit_inverse_transform (fit_inverse_transform)
- Learn the inverse transform for non-precomputed kernels. (i.e. learn to find the pre-image of a point)
- remove_zero_eig (remove_zero_eig)
- If True, then all components with zero eigenvalues are removed, so that the number of components in the output may be < n_components (and sometimes even zero due to numerical instability). When n_components is None, this parameter is ignored and components with zero eigenvalues are removed regardless.
- eigen_solver (eigen_solver)
- Select eigensolver to use. If n_components is much less than the number of training samples, arpack may be more efficient than the dense eigensolver.
- tol (tol)
- Convergence tolerance for arpack. If 0, optimal value will be chosen by arpack.
- max_iter (max_iter)
- Maximum number of iterations for arpack. If None, optimal value will be chosen by arpack.
- random_state (random_state)
If int, random_state is the seed used by the random number generator; If RandomState instance, random_state is the random number generator; If None, the random number generator is the RandomState instance used by np.random. Used when
eigen_solver
== ‘arpack’.New in version 0.18.
- n_jobs (n_jobs)
The number of parallel jobs to run.
None
means 1 unless in ajoblib.parallel_backend
context.-1
means using all processors. See n_jobs for more details.New in version 0.18.
Some of the docstrings for this module have been automatically extracted from the scikit-learn library and are covered by their respective licenses.