how to construct a gaussian process kernel in 2D
이전 댓글 표시
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));
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Linear Regression에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!