UQWorld

Setting the value of certain parameters (PCE)

Suppose that a PCE metamodel has been trained using an input of N parameters with uniform distribution, e.g. [0,1]. Is it possible to quickly update this model by setting a constant value for M (M<N) of its parameters?

Ultimately, what I want is to avoid having to train a different PCE model each time I set a constant value to certain parameters. This will aid greatly in studying the change of Sobol’ indices with respect to time. So far, I have to train a different PCE model for each point in time, but it would be much faster if i could just set the value of time on the PCE model (implying that the PCE metamodel has been trained with a distribution of time as one of its inputs) and then calculate the Sobol’ indices based on that.

I hope that my idea made sense and am looking forward to your suggestions

1 Like

Hi @ChrisP,

welcome to UQWorld! :slight_smile:

The easiest solution I see is to write a wrapper function around your PCE model, which takes an N-1-dimensional vector as input, and sets one of the parameters to the desired constant value. You can use this as your new model and compute MC-based Sobol indices. This is cheap since evaluating the PCE is very fast. (Make sure to implement a vectorized wrapper, and set newmodelopts.IsVectorized = True.)

Or, if you really need this lower-dimensional PCE object, you can use the property that a polynomial with one dimension set to constant is still a polynomial. So you could evaluate your N-dim PCE many times (it’s cheap anyways) and use this as data to fit another PCE corresponding to another input object myInputConst which is the same as myInput, but with one dimension set to a constant value. It could look like this:

ioptsConst = ioptsOrig; % copy the original input options object
ioptsConst.Marginals(1).Type = 'constant';
ioptsConst.Marginals(1).Parameters = 0.155;
ioptsConst.Marginals(1).Moments = [];
myInputConst = uq_createInput(ioptsConst);

Xconst = uq_getSample(myInputConst, 1000); % draw samples from the new input object
Yconst = uq_evalModel(myPCE, Xconst); % evaluate your N-dim PCE

% re-use MetaOpts from creation of myPCE: same settings
MetaOpts.Input = myInputConst; % make sure the PCE uses the new input object

MetaOpts.ExpDesign.X = Xconst;
MetaOpts.ExpDesign.Y = Yconst;

myPCEconst = uq_createModel(MetaOpts); % should have an LOO of ~1e-30 (exact fit)

Regarding using time as an input parameter: is time in your application really a random variable? With what distribution? Is time continuous or discrete? There are most likely better approaches than using time as an input RV. If you could describe your problem in more detail, we might be able to suggest something. Also have a look at these two questions about surrogating of time-dependent models:

I hope this helps, let us know how you proceed! :slight_smile:

2 Likes

Thank you for the detailed reply! While not explicitly solving my problem, it did provide some useful insight on the metamodelling procedure.
I realize that time is not a random variable, but i thought that it would be a neat trick to treat it as one.
Consider for example a time-dependent model of the form y = f(parameters,time). I would like to compute Sobol’ indices for various points in the time range [0 tmax], in order to quantify how the importance of model parameters changes with time (Assuming that their distribution remains the same throughout the timerange). Using my current knowledge, I would have to create a different surrogate PCE for each time point.
My idea is to train a sole PCE surrogate using time as a uniform input with limits [0 tmax]. This way the PCE model will hopefully provide accurate predictions for every point in the desired timerange. Then, using a wrapper function, as you suggested, would allow the calculation of Sobol’ indices for the model parameters at arbitrarily chosen points within the timerange.
I would really like to hear your opinion on whether this idea is mathematically sound. Thank you in advance for your time!

There should be no problem with the mathematics, but conceptually it’s not completely sound: after all, time is not a random variable. On the other hand, you could also take the view that you forget about uncertainties and simply approximate your function in an appropriate basis (which happens to consist of multivariate polynomials, specifically Legendre polynomials for the time variable), which is conceptually acceptable (I would say). In that case, you might even consider whether polynomials are suited to model the variation in time, or whether there might be another basis that is suited better. E.g., if there are jumps, kinks, or rapid oscillations in the time series for a fixed set of parameters, polynomials are not suited. If the variation in time is not well approximated by polynomials, the whole approximation will suffer.

The typical way to treat time-dependent problems is to first perform PCA on the output, identify the most important directions, and then create several PCEs to model the PCA coefficients (Nagel, Rieckermann, Sudret 2020). In this case, the time-dependent Sobol indices can even be computed analytically. PCA on the time series output can be interpreted as finding a custom-made “basis” for the time variable. Time-dependent Sobol indices are displayed e.g. in Fig. 6c of Nagel, Rieckermann, Sudret (2020) or in Fig. 8 of Wagner et al (2020).

Maybe @bsudret or @xujia have some more comments on this?