GridInterpolationKernel<T>

Models & Types · AiDotNet.Kernels

Grid Interpolation Kernel (KISS-GP) for scalable Gaussian Process inference.

Implements: IKernelFunction<T>

For Beginners

KISS-GP (Kernel Interpolation for Scalable Structured GPs) combines inducing points with grid structure for highly scalable GP inference.

The key insight: Place inducing points on a regular grid, then use:

  1. Interpolation to map data points to the grid
  2. Kronecker/Toeplitz structure of the grid for fast computations

K ≈ W × K_grid × W’

Where:

  • W is a sparse interpolation matrix (each data point → nearby grid points)
  • K_grid has Kronecker structure (efficient to work with)

W uses the local cubic convolution interpolation of Keys (1981), as in Wilson & Nickisch, “Kernel Interpolation for Scalable Structured Gaussian Processes (KISS-GP)” (ICML 2015) and GPyTorch’s Interpolation: every data point draws on the 4 nearest grid points per dimension.

Complexity for N data points, M grid points:

  • Standard GP: O(N³)
  • Inducing points: O(NM² + M³)
  • KISS-GP: O(N × 4^d + M × Σ n_d) per kernel-vector product

This enables GPs with millions of data points on commodity hardware.

Constructors

Constructor Summary
GridInterpolationKernel(IKernelFunction<T> baseKernel, Vector<T>[] gridCoordinates) Initializes a Grid Interpolation Kernel.

Properties

Property Summary
IKernelFunction<T> BaseKernel { get; } Gets the base kernel.
int NumDimensions { get; } Gets the number of dimensions.
int TotalGridPoints { get; } Gets the total number of grid points.

Methods

Method Summary
GridInterpolationKernel<T> WithUniformGrid(IKernelFunction<T> baseKernel, ValueTuple<T, T>[] bounds, int gridPointsPerDim) Creates a Grid Interpolation Kernel with automatic grid spacing.
T Calculate(Vector<T> x1, Vector<T> x2) Calculates the kernel value between two points.
ValueTuple<Tensor<int>, Matrix<T>> ComputeInterpolationMatrix(Matrix<T> X) Computes the interpolation matrix W for a set of data points.
Vector<T> FastGridMultiply(Vector<T> v) Performs fast matrix-vector product using the Kronecker structure of the grid kernel.
Vector<T> KissGpMultiply(Vector<T> v, Tensor<int> interpolationIndices, Matrix<T> interpolationWeights) Performs full KISS-GP kernel-vector product: W × K_grid × W’ × v.
void Precompute() Precomputes the per-dimension grid kernel matrices for efficient matrix-vector products.