InverseMultiquadricKernel<T>
Models & Types · AiDotNet.Kernels
Implements the Inverse Multiquadric kernel for measuring similarity between data points.
Implements: IKernelFunction<T>
For Beginners
A kernel function is a mathematical tool that measures how similar two data points are. The Inverse Multiquadric kernel is like a “similarity detector” that gives higher values when points are close together and lower values when they’re far apart.
How It Works
The Inverse Multiquadric kernel is a radial basis function kernel that measures similarity based on the distance between points. Unlike the Gaussian kernel, it decreases more slowly as points get farther apart, making it useful for data with long-range dependencies.
Think of this kernel as a “distance translator” - it takes the distance between two points and converts it into a similarity score. Points that are close together get a similarity score close to 1, while points that are far apart get a score closer to 0, but the decrease is more gradual than with some other kernels.
This kernel has a parameter ‘c’ that controls how quickly the similarity decreases with distance. A larger value of ‘c’ makes the kernel more “tolerant” of distance, meaning points can be farther apart and still be considered somewhat similar.
The Inverse Multiquadric kernel is often used in machine learning tasks like regression, classification, and interpolation, especially when you want to capture both local and more distant relationships in your data.
Example
using AiDotNet.Kernels;
using AiDotNet.Tensors.LinearAlgebra;
var kernel = new InverseMultiquadricKernel<double>();
var a = new Vector<double>(new[] { 1.0, 2.0, 3.0 });
var b = new Vector<double>(new[] { 1.5, 1.0, 2.5 });
double similarity = kernel.Calculate(a, b);
Console.WriteLine($"InverseMultiquadricKernel: K(a, b) = {similarity:F4}");
Constructors
| Constructor | Summary |
|---|---|
InverseMultiquadricKernel(T c) |
Initializes a new instance of the Inverse Multiquadric kernel with an optional shape parameter. |
Methods
| Method | Summary |
|---|---|
T Calculate(Vector<T> x1, Vector<T> x2) |
Calculates the Inverse Multiquadric kernel value between two vectors. |