ProductStructureKernel<T>
Models & Types · AiDotNet.Kernels
Product Structure Kernel for modeling multiplicative interactions between feature groups.
Implements: IKernelFunction<T>
For Beginners
The Product Structure Kernel assumes the underlying function has a multiplicative structure: f(x) = f_1(x_G1) × f_2(x_G2) × … × f_K(x_GK)
Where x_Gi is the subset of features in group i.
The kernel is: k(x, x’) = k_1(x_G1, x’_G1) × k_2(x_G2, x’_G2) × … × k_K(x_GK, x’_GK)
This is useful when:
- Features naturally group together (e.g., spatial × temporal)
- There’s known multiplicative interaction structure
- You want to reduce computation via Kronecker structure
Example: Modeling sales as (location effects) × (time effects) × (product effects)
Compare to Additive Structure:
- Additive: f = f_1 + f_2 + … (sum of independent effects)
- Product: f = f_1 × f_2 × … (multiplicative interaction)
Product kernels can capture stronger interactions but are less interpretable.
Constructors
| Constructor | Summary |
|---|---|
ProductStructureKernel(IKernelFunction<T>[] groupKernels, int[][] featureGroups) |
Initializes a Product Structure Kernel. |
Properties
| Property | Summary |
|---|---|
int NumGroups { get; } |
Gets the number of feature groups. |
int[][] FeatureGroups { get; } |
Gets the feature indices for each group. |
Methods
| Method | Summary |
|---|---|
Matrix<T>[] ComputeGroupKernelMatrices(Matrix<T>[] Xgroups) |
Computes the kernel matrix with Kronecker structure (for gridded data). |
ProductStructureKernel<T> FullyFactorized(int numFeatures, double baseLengthscale) |
Creates a Product Structure Kernel with automatic grouping (one feature per group). |
ProductStructureKernel<T> WithRBF(int[][] featureGroups, double[] lengthscales) |
Creates a Product Structure Kernel with RBF for all groups. |
T Calculate(Vector<T> x1, Vector<T> x2) |
Calculates the product kernel value. |
T LogDeterminant(Matrix<T>[] groupKernelMatrices) |
Computes log-determinant using Kronecker structure. |
Vector<T> KroneckerMultiply(Matrix<T>[] groupKernelMatrices, Vector<T> v) |
Performs efficient Kronecker matrix-vector product. |