Output Formatting as Matrix & PCE Metamodel

Dear all,

For a given input (1x10), if my output is a matrix (10x10), and for 100 input samples my output is (10x10x100)

I’m trying to use PCE LARS using the following code

MetaOpts.Type = ‘Metamodel’;
MetaOpts.MetaType = ‘PCE’;
MetaOpts.Method = ‘LARS’;
MetaOpts.TruncOptions.qNorm = 0.75;
MetaOpts.Degree = 2; %:10;
MetaOpts.ExpDesign.NSamples = 10;
MetaOpts.ExpDesign.Sampling = ‘LHS’;

Error Message

 Incorrect dimensions for matrix multiplication. Check that the number of columns in the first matrix matches the number of rows in the second matrix. To perform elementwise multiplication, use '.*'.

    Error in uq_lar (line 199)
        cj = Psi'*(Y - mu);

    Error in uq_PCE_lars (line 60)
    lar_results = uq_lar(Psi, Y, lar_options);

Dear @AHz

You cannot have matrices as outputs of a UQLab model, only vectors. This means that you need to use the reshape function of Matlab to transform your 10x10 matrix into a line vector of length N_{out} =100 (1x100 array in Matlab). You should wrap your MODEL function such that it outputs a 1x100 array.

As a recap, if the dimension of your input vector is M=10, and you use N=100 samples, your experimental design (input) will be stored in a matrix of size N\times M, that is 100 x 10.

If you can vectorize your MODEL function, it should take a set of input vectors as a matrix of size N \times M and provide as an output a matrix of size N \times N_{out}.

Hope it answers your question.
Best regards
Bruno

1 Like