@MathWorks Support Team please any solution to my question? My code takes a long time to run and displaying all the results means that I can't use my system effectively when the code is running. I.e. My current window closes when every new iteration.
How to stop the display of objective function model calculation and the graphs when using GP
9 views (last 30 days)
Show older comments
Telema Harry
on 21 Nov 2023
Answered: Ayush Aniket
on 27 Nov 2023
I am computing a GP at every iteration using a for-loop. The objective function graphs and calculations in the command wind is taking a lot of space. I have about 201 figures. How can I stop the display of objective function calculation in the command window and the graphs.
N = 100;
x1 = linspace(0, 10, N);
x2 = linspace(0, 5, N);
X = [x1; x2];
X = X';
Y = sin(X(:, 1).^2 + X(:, 2).^2);
gpr = fitrgp(X,Y,'KernelFunction','squaredexponential',...
'OptimizeHyperparameters','auto','HyperparameterOptimizationOptions',...
struct('AcquisitionFunctionName','expected-improvement-plus'));
Accepted Answer
Ayush Aniket
on 27 Nov 2023
Hi Telema,
As per my understanding you would like to stop the display of objective function model calculation and the graphs. You can use the ‘ShowPlots’ and ‘Verbose’ options available in the ‘HyperparameterOptimizationOptions’ name-value argument of the function “fitgrp”. These options give you the ability to suppress the display of plots and iterative calculation information. You can modify your code as follows:
% Set the options for hyperparameter optimization to suppress display and plots
opts = struct('AcquisitionFunctionName', 'expected-improvement-plus', ...
'ShowPlots', false, ... % This stops the display of plots
'Verbose', 0); % This stops the display in the command window
gpr = fitrgp(X, Y, 'KernelFunction', 'squaredexponential', ...
'OptimizeHyperparameters', 'auto', ...
'HyperparameterOptimizationOptions', opts);
To read more about the options and their functionality please refer to the following documentation page:
Hope it helps!
0 Comments
More Answers (0)
See Also
Categories
Find more on Gaussian Process Regression in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!