Changing optimization technique for Gaussian process regression model

27 views (last 30 days)
By default, GPR model uses 'bayesopt' optimizer to optimize the hyperparameters. I wish to use 'particle swarm optimization'
to optimize the hyperparamaters i.e. to minimize the loss function or the MSE. Please help.
clear;clc;close all
load('data001.mat')
x = data001(:,1);
y = data001(:,2);
rng default
gprMdl = fitrgp(x,y,'KernelFunction','squaredexponential',...
'OptimizeHyperparameters','auto','HyperparameterOptimizationOptions',...
struct('AcquisitionFunctionName','expected-improvement-plus'));
ypred = resubPredict(gprMdl);
figure();
plot(x,y,'r.');
hold on
plot(x,ypred,'k','LineWidth',2);
xlabel('x');
ylabel('y');
hold off

Accepted Answer

Alan Weiss
Alan Weiss on 6 Jul 2022
Alan Weiss
MATLAB mathematical toolbox documentation
  7 Comments
Josh
Josh on 14 Jul 2022
Thanks for being generous with your patience to my questions and elaborating on it with some information.
Appreciate for responding. Thank you.

Sign in to comment.

More Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!