Hi Mono,
I understand you want to know if MATLAB provides Exponential Sine Squared kernel for Gaussian processes and, if not, why it is not included despite being commonly used.MATLAB's Gaussian Process (GP) regression framework includes built-in kernels like the Squared Exponential (SE), Matern, and Rational Quadratic kernels. Although the Exponential Sine Squared (Periodic) kernel is not built-in, MATLAB's flexibility allows users to define and implement custom kernels as needed.
Exponential Sine Squared (Periodic) Kernel: It is defined as
where: (l) is the length scale,
(p) is the period.
Custom Kernel Implementation: One can define custom kernel function and use it in Gaussian Process model. Here's how one can do it:
1. Define the Custom Kernel Function: Create a function file (e.g., exponentialSineSquaredKernel.m) to define the Exponential Sine Squared kernel.
function K = exponentialSineSquaredKernel(theta, X, X2)
K = exp(-2 * (sin(pi * dists / p).^2) / l^2);
2. Use the Custom Kernel in GP Regression: Use custom kernel function in the “fitrgp” function by specifying it as a function handle.
y = sin(X) + 0.1*randn(size(X));
kernelFcn = @(theta, X, X2) exponentialSineSquaredKernel(theta, X, X2);
gprMdl = fitrgp(X, y, 'KernelFunction', kernelFcn, 'KernelParameters', initialTheta);
[ypred, ysd, yint] = predict(gprMdl, X);
legend('Data', 'Prediction', '95% Prediction Interval');
title('Gaussian Process Regression with Exponential Sine Squared Kernel');
The reason MATLAB might not include the Exponential Sine Squared kernel by default could be due to specialized use case and a limited set of well-chosen kernels keeps the toolbox simpler and more focused, enhancing performance and usability.
By defining custom kernel as shown above, one can leverage the full power of MATLAB's GP regression tools while using the specific kernels that best suit the application.
Please refer to the following documentation link-
Hope it helps!
Best Regards,
Simar