optimizing GPR model using genetic algorithm
4 次查看(过去 30 天)
显示 更早的评论
As I tried to optimize the hyperparameters and sigma using GA, it is showing some error. Also, is it possible to limit the maximum
objective evaluations or put lb/ub on GA optimization? Please help.
clear;clc;close all
load('data001.mat')
x=data001(:,1);
y=data001(:,2);
kernel = optimizableVariable('KernelFunction',{'exponential','squaredexponential','matern32','matern52',...
'rationalquadratic','ardexponential','ardsquaredexponential','ardmatern32','ardmatern52','ardrationalquadratic'},...
'Type','categorical');
sigma = optimizableVariable('Sigma',[1e-4,10],'Transform','log');
go = ga(@objFcn,2) % calling objective function in optimization algorithm
kernel= go.XAtMinObjective.KernelFunction
model = fitrgp(x,y, 'KernelFunction', char(kernel));
yfit = predict(model, x);
function Loss = objFcn(Vars, x, y)
m = fitrgp(x, y, 'KernelFunction', char(Vars.KernelFunction), ...
'Sigma', Vars.Sigma, 'ConstantSigma', true,...
'KFold', 5);
Loss = kfoldLoss(m);
end
1 个评论
Alan Weiss
2022-7-11
编辑:Alan Weiss
2022-7-11
You asked this question elsewhere. See my answer here: https://www.mathworks.com/matlabcentral/answers/1754650-changing-optimization-technique-for-gaussian-process-regression-model?s_tid=srchtitle
Alan Weiss
MATLAB mathematical toolbox documentation
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Gaussian Process Regression 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!