how to construct a gaussian process kernel in 2D
Afficher commentaires plus anciens
Say a gaussian process regression take with predictor X in 2D, i.e.
X = [x1, x2]
I am wondering how to construct a kernel function in 2D for
fitrgp(X, y, 'KernelFunction', kfcn)
In 1D input case, kernel could be in shape as:
kfcn = @(XN,XM,theta) (exp(theta(2))^2)*exp(-(pdist2(XN,XM).^2)/(2*exp(theta(1))^2));
But in 2D, I am confused how to define the function with indivial magnitude and length scale parameters for x1 and x2.
Perhaps in form as following?
% additive kernel
kfcn = @(XN,XM,theta) (exp(theta(2))^2)*exp(-(pdist2(XN(:,1),XM(:,1)).^2)/(2*exp(theta(1))^2))...
+ (exp(theta(4))^2)*exp(-(pdist2(XN(:,2),XM(:,2)).^2)/(2*exp(theta(3))^2));
or
% multiplication kernel
kfcn = @(XN,XM,theta) (exp(theta(2))^2)*exp(-(pdist2(XN(:,1),XM(:,1)).^2)/(2*exp(theta(1))^2)) ...
* (exp(theta(4))^2)*exp(-(pdist2(XN(:,2),XM(:,2)).^2)/(2*exp(theta(3))^2));
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Linear Regression dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!