CylindricalKernel<T>

Models & Types · AiDotNet.Kernels

Cylindrical Kernel for Bayesian optimization with periodic/angular dimensions.

Implements: IKernelFunction<T>

For Beginners

The Cylindrical Kernel is designed for data that has both “regular” dimensions (like temperature, pressure) and “angular” or “periodic” dimensions (like angles, time of day, day of week).

For regular dimensions: Uses a standard kernel (e.g., RBF) For angular dimensions: Uses a periodic kernel that wraps around

Example use cases:

  • Optimizing chemical reactions: Temperature (regular) + catalyst angle (periodic)
  • Time series: Date (regular) + hour of day (periodic)
  • Robotics: Position (regular) + joint angles (periodic)

The kernel combines: k(x, x’) = k_regular(x_reg, x’_reg) × k_angular(x_ang, x’_ang)

For angular dimensions, it uses: k_angular(θ, θ’) = exp(-2 × sin²(π(θ - θ’)/period) / l²)

This ensures smooth wrapping at boundaries (e.g., 359° is close to 1°).

Constructors

Constructor Summary
CylindricalKernel(IKernelFunction<T> regularKernel, int[] regularDims, int[] angularDims, Vector<T> periods, Vector<T> angularLengthScales) Initializes a new Cylindrical Kernel.

Properties

Property Summary
IKernelFunction<T> RegularKernel { get; } Gets the regular kernel.
int[] AngularDims { get; } Gets the angular dimension indices.
int[] RegularDims { get; } Gets the regular dimension indices.

Methods

Method Summary
CylindricalKernel<T> WithRBF(int totalDims, int[] angularDimIndices, double regularLengthScale, Vector<T> periods, Vector<T> angularLengthScales) Creates a Cylindrical Kernel with RBF for regular dimensions.
T Calculate(Vector<T> x1, Vector<T> x2) Calculates the cylindrical kernel value.