Setting the value of certain parameters (PCE)

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