Dear Community
My name is David and I’m trying to create PCE surrogate models for my given input data (experimental design X and response Y). I have 100 data points and the model consists of 4 (3 + 1 constant) input and 112 output dimensions. When evaluating the bootstrap predicitions YPC_replications (cf. PCE Manual p.42f.), I get some unexpected results, i.e. bootstrap predictions don’t overlap with the mean predictions YPC. More precisly, the 2.5% and 97.5% quantiles computed with the YPC_replications are not enclosing the predicted estimate YPC at all. I’ve also plotted the YPC_replications and it seems that they are entirely different compared to YPC.
I guess I did an error somewhere in the code but I didn’t find anything so far. Do you have an idea what the reason is for these results? You can access the script to train the PCE models as well as the input data and the probabilistic model under the following link :
For your convenience, I copied the main script also at the end of this post.
Thank you so much for your support.
Cheers,
David
Additional Notes:
- I’m using the newest UQLab version 2.0 together with Matlab2020b.
- Unfortunately, I can’t attach the files here directly because I’m a new user. Therefore, I had to use the link.
Main Script:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%----------------------------- Preparation ----------------------------%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% --- tabula rasa ---
close all
clear variables
fclose('all');
clc
%% --- Change Default Values ---
set(groot,'defaulttextinterpreter','latex')
set(groot, 'defaultAxesTickLabelInterpreter','latex');
set(groot, 'defaultLegendInterpreter','latex');
set(0,'DefaultTextFontname', 'Latin Modern Roman')
set(0,'DefaultAxesFontName', 'Latin Modern Roman')
set(0,'DefaultLegendFontName','Latin Modern Roman');
set(0, 'DefaultLineLineWidth', 2);
%% --- Set random number generator for reproducable results ---
rng(100,'twister')
%% --- Initialize UQlab ---
uqlab
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%---------------------------- Input Deck ------------------------------%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% 1) holdout fraction for test set
holdout=0.1;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%-------------------------------- Load Data ---------------------------%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% 1) Load Probabilistic Input Model
load('ProbModel_v1')
N_var=length(ProbModel.nonConst);
%% 2) Load Experimental Design
load('X')
N_sim=size(X,1);
%% 3) Load Response Matrix
load('Y')
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%--------------------- Define Test & Training Set ---------------------%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
cv = cvpartition(N_sim,'HoldOut',holdout);
X_test = X(test(cv),:);
X_training = X(training(cv),:);
Y_test = Y(test(cv),:);
Y_training = Y(training(cv),:);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%-------------------------- Create PCE Model --------------------------%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% 1) Select PCE Model
MetaOpts.Type = 'Metamodel';
MetaOpts.MetaType = 'PCE';
%% 2) Probabilistic Input Model
MetaOpts.Input = ProbModel;
%% 3) Experimental Design X
MetaOpts.ExpDesign.X = X_training;
%% 4) Response Matrix Y
MetaOpts.ExpDesign.Y = Y_training;
%% 6) Maximum Polynomial Degrees
MetaOpts.Degree=[1:5];
MetaOpts.DegreeEarlyStop=false;
%% 7) Truncation Scheme
MetaOpts.TruncOptions.qnorm=0.5:0.1:1;
MetaOpts.qNormEarlyStop = false;
%% 8) PCE Coefficient Calculation Method
MetaOpts.Method = 'LARS';
MetaOpts.LARS.LarsEarlyStop = false;
MetaOpts.LARS.ModifiedLoo = true;
%% 9) PCE Coefficient Calculation Method
MetaOpts.Bootstrap.Replications = 10^2;
%% 10) Create PCE Model
myPCE = uq_createModel(MetaOpts);
%% 11) Debugg
[YPC,YPC_var,YPC_replications]=uq_evalModel(myPCE,X_test);
idx=1;
Bounds = squeeze(quantile(YPC_replications(idx,:,:),[0.025 0.975],2));
figure
subplot(2,1,1)
title('Quantiles')
hold on
plot(YPC(idx,:),'r')
plot(Bounds(1,:),'r--')
plot(Bounds(2,:),'r--')
plot(Y_test(idx,:),'k')
subplot(2,1,2)
title('Standard Deviation')
hold on
plot(YPC(idx,:),'r')
plot(YPC(idx,:)+sqrt(YPC_var(idx,:)),'r--')
plot(YPC(idx,:)-sqrt(YPC_var(idx,:)),'r--')
plot(Y_test(idx,:),'k')