# Best Practices for Using PCE in UQlab for High-Dimensional Models with Discrete Variables

**URL:** <https://uqworld.org/t/best-practices-for-using-pce-in-uqlab-for-high-dimensional-models-with-discrete-variables/3704>\
**Category:** Community Q&A and How To\
**Tags:** sensitivity, pce, metamodeling\
**Created:** [June 23, 2024, 3:10pm UTC](https://uqworld.org/t/best-practices-for-using-pce-in-uqlab-for-high-dimensional-models-with-discrete-variables/3704 "2024-06-23T15:10:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Harvey](https://uqworld.org/letter_avatar_proxy/v4/letter/h/96bed5/32.png) [@Harvey](https://uqworld.org/u/Harvey)\
**Post date:** [June 23, 2024, 3:10pm UTC](https://uqworld.org/t/best-practices-for-using-pce-in-uqlab-for-high-dimensional-models-with-discrete-variables/3704/1 "2024-06-23T15:10:38Z")

</div>

Hello everyone,

I am currently working on modeling and sensitivity analysis using Polynomial Chaos Expansion (PCE) in UQlab. My model has about 180 input variables, many of which are discrete (either 0 or 1). I have several questions and would appreciate any guidance:

1. Is it feasible to use PCE in UQlab for this problem? If so, how should I handle the discrete variables? What should the `IOpts.Marginals.Type` be set to? Is it suitable to use arbitrary PCE in UQlab?

2. Is setting the PCE degree to 2 appropriate given the high number of input variables? Higher degrees might lead to computational difficulties.

3. How many input samples should I use? Currently, I have set it to 1000 samples due to the high computational cost for each run. Is this sufficient?

4. I have also been using the method from “Data-driven uncertainty quantification using the arbitrary polynomial chaos expansion” (S. Oladyshkin, W. Nowak, 2012) to construct the orthogonal polynomial basis. Then I employed the `uq_lar` program for sparsity and coefficient calculation. However, the final error(LOO) is quite large. i understand the method is not used in UQlab, but do you have any suggestions on how to improve this?

Thank you for your help!

Best regards,  
Harvey

---

<div class="post-metadata">

**Author:** ![bsudret](https://uqworld.org/user_avatar/uqworld.org/bsudret/32/224_2.png) [@bsudret](https://uqworld.org/u/bsudret)\
**Post date:** [June 24, 2024, 8:00am UTC](https://uqworld.org/t/best-practices-for-using-pce-in-uqlab-for-high-dimensional-models-with-discrete-variables/3704/2 "2024-06-24T08:00:09Z")

</div>

Dear Harvey

thanks for your question. Polynomial chaos expansions are not meant in general for problems with discrete 0/1 variables, although in theory this would be possible. However, UQLab does not support (yet) discrete variables in the various modules.

What could be possible is to use Gaussian processes with a “custom” auto-correlation function (kernel) meant for discrete variables. However, in 180 dimensions, this may also be quite complex to fit.  
For such a setting (high dim and discrete inputs) other machine learning techniques may be more suitable (e.g., random forest), although I haven’t tried myself.  
Best regards  
Bruno

---

<div class="post-metadata">

**Author:** ![Harvey](https://uqworld.org/letter_avatar_proxy/v4/letter/h/96bed5/32.png) [@Harvey](https://uqworld.org/u/Harvey)\
**Post date:** [July 1, 2024, 6:51am UTC](https://uqworld.org/t/best-practices-for-using-pce-in-uqlab-for-high-dimensional-models-with-discrete-variables/3704/3 "2024-07-01T06:51:49Z")

</div>

thank you very much for your answer. I find Gaussian processes quite useful in some area.

i will update my progress here.

Best regards
