GeneralizedTStudentKernel<T>
Models & Types · AiDotNet.Kernels
Implements the Generalized T-Student 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 T-Student kernel is like a “similarity detector” that gives higher values when points are close together and lower values when they’re far apart, but it’s more tolerant of occasional large distances than some other kernels.
How It Works
The Generalized T-Student kernel is a kernel function based on the Student’s t-distribution. It is particularly useful for handling data with outliers because it decreases more slowly than the Gaussian kernel as points get farther apart.
Think of this kernel as a “forgiving” similarity measure. While many kernels quickly decide that distant points have almost zero similarity, the T-Student kernel decreases more gradually, still giving some weight to points that are moderately far apart. This makes it useful when your data might contain outliers or when distant points might still have meaningful relationships.
This kernel is particularly valuable in machine learning tasks where robustness to outliers is important, such as in financial data analysis, anomaly detection, or noisy real-world datasets.
Example
using AiDotNet.Kernels;
using AiDotNet.Tensors.LinearAlgebra;
var kernel = new GeneralizedTStudentKernel<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($"GeneralizedTStudentKernel: K(a, b) = {similarity:F4}");
Constructors
| Constructor | Summary |
|---|---|
GeneralizedTStudentKernel(T degree) |
Initializes a new instance of the Generalized T-Student kernel with an optional degree parameter. |
Methods
| Method | Summary |
|---|---|
T Calculate(Vector<T> x1, Vector<T> x2) |
Calculates the Generalized T-Student kernel value between two vectors. |