optimizing GPR model using genetic algorithm

16 ビュー (過去 30 日間)
Josh
Josh 2022 年 7 月 11 日
編集済み: Alan Weiss 2022 年 7 月 11 日
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
Alan Weiss 2022 年 7 月 11 日
編集済み: Alan Weiss 2022 年 7 月 11 日
Alan Weiss
MATLAB mathematical toolbox documentation

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeProblem-Based Optimization Setup についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by