# Building PCE issues

**URL:** <https://uqworld.org/t/building-pce-issues/544>\
**Category:** Community Q&A and How To\
**Created:** [March 17, 2020, 2:31pm UTC](https://uqworld.org/t/building-pce-issues/544 "2020-03-17T14:31:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![geofflo](https://uqworld.org/letter_avatar_proxy/v4/letter/g/8797f3/32.png) [@geofflo](https://uqworld.org/u/geofflo)\
**Post date:** [March 17, 2020, 2:31pm UTC](https://uqworld.org/t/building-pce-issues/544/1 "2020-03-17T14:31:41Z")

</div>

Hi UQLab community,

I’ve meet an issue while building PCE surrogate from simulation data along a wide range of frequencies. I don’t know why UQlab crashes and/or if my data miss some informations to that end.  
Please find below the UQLab report while crashing (the used script… if asked).  
Is it possible to fix or to avoid this problem?

Thank you in advance,

— Calculating the PCE coefficients with least-squares. —  
Warning: Warning: numerical instability!! Gamma for LAR iteration 10 was set to 0 to prevent  
crashes.

> In uq\_lar (line 268)  
> In uq\_PCE\_lars (line 60)  
> In uq\_PCE\_calculate\_coefficients\_regression (line 197)  
> In uq\_PCE\_calculate\_coefficients (line 47)  
> In uq\_calculateMetamodel (line 18)  
> In uq\_initialize\_uq\_metamodel (line 358)  
> In uq\_core\_module/run\_initialization\_script (line 208)  
> In uq\_core\_model/add\_module (line 101)  
> In uq\_createModel (line 91)  
> Inner matrix dimensions must agree.  
> Error in uq\_blockwise\_inverse (line 26)  
> SCinv = 1/(D - C_Ainv_B);  
> Error in uq\_lar (line 214)  
> M = uq\_blockwise\_inverse(M,x,x’,r) ;  
> Error in uq\_PCE\_lars (line 60)  
> lar\_results = uq\_lar(Psi, Y, lar\_options);  
> Error in uq\_PCE\_calculate\_coefficients\_regression (line 197)  
> lars\_results = uq\_PCE\_lars(univ\_p\_val, current\_model);  
> Error in uq\_PCE\_calculate\_coefficients (line 47)  
> uq\_PCE\_calculate\_coefficients\_regression(current\_model);  
> Error in uq\_calculateMetamodel (line 18)  
> success = uq\_PCE\_calculate\_coefficients(current\_model);  
> Error in uq\_initialize\_uq\_metamodel (line 358)  
> success = uq\_calculateMetamodel(current\_model);

---

<div class="post-metadata">

**Author:** ![nluethen](https://uqworld.org/user_avatar/uqworld.org/nluethen/32/218_2.png) [@nluethen](https://uqworld.org/u/nluethen)\
**Post date:** [March 17, 2020, 6:49pm UTC](https://uqworld.org/t/building-pce-issues/544/2 "2020-03-17T18:49:16Z")

</div>

Hi @geofflo,

Welcome to UQWorld! 🙂

This sounds very similar to an issue another user had recently. Have a look here: [After update receiving error in uq\_blockwise\_inverse](https://uqworld.org/t/after-update-receiving-error-in-uq-blockwise-inverse/238/13)

The fact that the algorithm ends up in this part of the code (where a regressor that was added by LARS has to be removed again) hints at some problem with your data: it does not contain enough information to properly build a PCE.

I hope this helps, good luck!

---

<div class="post-metadata">

**Author:** ![geofflo](https://uqworld.org/letter_avatar_proxy/v4/letter/g/8797f3/32.png) [@geofflo](https://uqworld.org/u/geofflo)\
**Post date:** [March 18, 2020, 9:42am UTC](https://uqworld.org/t/building-pce-issues/544/3 "2020-03-18T09:42:42Z")

</div>

Thank you @nluethen,  
This update fixed in part my problem and allow me to continue some analysis…

Best regards,

---

<div class="post-metadata">

**Author:** ![geofflo](https://uqworld.org/letter_avatar_proxy/v4/letter/g/8797f3/32.png) [@geofflo](https://uqworld.org/u/geofflo)\
**Post date:** [March 20, 2020, 9:33am UTC](https://uqworld.org/t/building-pce-issues/544/4 "2020-03-20T09:33:07Z")

</div>

Dear UQLab comminuty,

I’m wondering why the evaluation of my PCE surrogate give NAN responses to my validation data (see code below).  
After building PCE along wide range of frequencies, I need to use them to predict the behavior of my model. But I’m surprised to get NANs as results provided by the PCE (using uq\_evalModel(…) command).  
Is it possible to help me understand why it doesn’t work?

Thank you in advance,

m =0; Nsimuls = size(ExpDes\_Valid,1);  
YPCE\_indu = cell(Nfreq,1); YPCE\_resi = cell(Nfreq,1);  
for kk = 1:Nfreq  
m = m+1;  
YPCE\_indu{kk} = uq\_evalModel(PCE\_Indu2{kk},ExpDes\_Valid);  
YPCE\_resi{kk} = uq\_evalModel(PCE\_Resi2{kk},ExpDes\_Valid);  
end
