AdditiveStructureKernel<T>
Models & Types · AiDotNet.Kernels
Additive Structure Kernel that decomposes the function into additive components.
Implements: IKernelFunction<T>
For Beginners
The Additive Structure Kernel assumes that the target function can be decomposed into a sum of lower-dimensional components:
f(x) = f₁(x₁) + f₂(x₂) + … + fₘ(x_groupₘ)
Where each fᵢ depends only on a subset of input features (a “group”).
This is useful because:
- Interpretability: You can understand how each feature (or group) contributes
- Efficiency: Additive structure can reduce computational complexity
- Generalization: Simpler models often generalize better
Example: Predicting house prices might be additive: price = location_effect(lat, lon) + size_effect(sqft) + age_effect(year_built)
The kernel for additive structure is: k(x, x’) = Σᵢ kᵢ(x_groupᵢ, x’_groupᵢ)
Each component can have its own kernel (e.g., RBF for smooth components, periodic for cyclical features).
How It Works
Applications:
- Feature importance analysis
- Structured time series (trend + seasonality)
- Scientific modeling with known additive structure
- High-dimensional problems where full interactions are intractable
Constructors
| Constructor | Summary |
|---|---|
AdditiveStructureKernel(IKernelFunction<T>[] componentKernels, int[][] featureGroups) |
Initializes an Additive Structure Kernel with one kernel per feature (fully additive). |
AdditiveStructureKernel(IKernelFunction<T>[] componentKernels, int[][] featureGroups, Vector<T> weights) |
Creates a fully additive kernel with one component per feature and the given component weights. |
AdditiveStructureKernel(int numFeatures, IKernelFunction<T> baseKernel) |
Initializes an Additive Structure Kernel with one kernel per feature (fully additive). |
AdditiveStructureKernel(int numFeatures, IKernelFunction<T> baseKernel, Vector<T> weights) |
Creates a fully additive kernel with one component per feature and the given component weights. |
Properties
| Property | Summary |
|---|---|
int NumComponents { get; } |
Gets the number of additive components. |
Methods
| Method | Summary |
|---|---|
AdditiveStructureKernel<T> WithRBF(int numFeatures, double lengthScale) |
Creates a simple additive kernel with RBF components. |
T Calculate(Vector<T> x1, Vector<T> x2) |
Calculates the additive kernel value. |
T CalculateComponent(Vector<T> x1, Vector<T> x2, int componentIndex) |
Calculates the kernel value for a specific component only. |
T GetWeight(int componentIndex) |
Gets the weight for a component. |
Vector<T> GetComponentImportances(Vector<T> x) |
Computes the importance of each component based on its kernel value at the origin. |
int[] GetFeatureGroup(int componentIndex) |
Gets the feature group for a component. |