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

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Gaussian Process Regression 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by