How to use both mean and standard deviation/variance of each data to build a surrogate model?
Show older comments
I have the following data coming from a stochastic experiment. I ran the experiment for 10 times for each x and tabulated the mean and standard deviations. How can I use both the mean and standard deviation to train a surrogate model? I tried using fitrgp but it does not take standard deviations. I could use sigma, but it takes a scaler value, not a vector.
x = [5; 7; 9; 11; 13];
mean_output= [103.78; 108.84; 117.68; 109.57; 72.26];
std_output = [4.20; 3.44; 4.25; 10.09; 10.71];
gprModels = fitrgp(x, mean_output, ...
'KernelFunction', 'squaredexponential', ...
'BasisFunction', 'constant', ...
'FitMethod', 'exact', ...
'PredictMethod', 'exact')
Accepted Answer
More Answers (1)
UDAYA PEDDIRAJU
on 22 Apr 2025
Hi Rounak,
To incorporate both the mean and standard deviation of your stochastic experiment data into a Gaussian Process surrogate model in MATLAB, you can use the "Sigma" parameter of the "fitrgp" function. This parameter does not accept a vector of observation noise standard deviations, but you can use a representative scalar noise level, for example, the mean or median of your standard deviations:
x = [5; 7; 9; 11; 13];
mean_output = [103.78; 108.84; 117.68; 109.57; 72.26];
std_output = [4.20; 3.44; 4.25; 10.09; 10.71];
sigma_scalar = mean(std_output); % Representative noise level
gprModel = fitrgp(x, mean_output, ...
'KernelFunction', 'squaredexponential', ...
'BasisFunction', 'constant', ...
'Sigma', sigma_scalar, ...
'FitMethod', 'exact', ...
'PredictMethod', 'exact');
Alternatively, omit the Sigma parameter and let fitrgp estimate a single noise level automatically by enabling hyperparameter optimization:
% Data (same as above)
x = [5; 7; 9; 11; 13];
mean_output = [103.78; 108.84; 117.68; 109.57; 72.26];
% Fit Gaussian Process Regression model with automatic noise estimation
gprModel_opt = fitrgp(x, mean_output, ...
'KernelFunction', 'squaredexponential', ...
'BasisFunction', 'constant', ...
'OptimizeHyperparameters', 'Sigma', ... % Optimize noise level
'HyperparameterOptimizationOptions', struct('ShowPlots', true, 'Verbose', 1));
1 Comment
Rounak Saha Niloy
on 22 Apr 2025
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!