KernelPCA<T>
Models & Types · AiDotNet.Preprocessing.DimensionalityReduction
Kernel Principal Component Analysis for non-linear dimensionality reduction.
Inheritance: TransformerBase<T, Matrix<T>, Matrix<T>> → KernelPCA<T>
For Beginners
Regular PCA finds straight-line patterns. Kernel PCA can find curved patterns by mathematically “bending” the data:
- RBF kernel: Good for data with clusters or blobs
- Polynomial: Good for polynomial relationships
- Linear: Same as regular PCA
Think of it as finding principal components in a transformed space.
How It Works
Kernel PCA is an extension of PCA that uses a kernel function to map data into a higher-dimensional feature space where non-linear relationships become linear, then performs standard PCA in that space.
This allows capturing non-linear relationships that standard PCA cannot. Common kernels include RBF (Gaussian), polynomial, and sigmoid.
Constructors
| Constructor | Summary |
|---|---|
KernelPCA(int nComponents, KernelType kernel, double gamma, double degree, double coef0, bool fitInverseTransform, double alpha, int[] columnIndices) |
Creates a new instance of KernelPCA. |
Properties
| Property | Summary |
|---|---|
KernelType Kernel { get; } |
Gets the kernel type. |
Vector<T> Lambdas { get; } |
Gets the eigenvalues. |
bool SupportsInverseTransform { get; } |
Gets whether this transformer supports inverse transformation. |
double Gamma { get; } |
Gets the gamma parameter for RBF and polynomial kernels. |
int NComponents { get; } |
Gets the number of components. |
Methods
| Method | Summary |
|---|---|
string[] GetFeatureNamesOut(string[] inputFeatureNames) |
Gets the output feature names after transformation. |