UCL-CCS / EasyVVUQ

Python 3 framework to facilitate verification, validation and uncertainty quantification (VVUQ) for a wide variety of simulations.
https://easyvvuq.readthedocs.io/
GNU Lesser General Public License v3.0
87 stars 27 forks source link

Issue401: Inconsistent sampled values when mixing continuous and discrete distributions #402

Closed wedeling closed 1 year ago

wedeling commented 1 year ago

Fix for Issue https://github.com/UCL-CCS/EasyVVUQ/issues/401

I changed the SC and PCE samplers such that when mixing continuous and discrete inputs, the inputs files contain float/integer values respectively. This is done by modifications of the __next__ subroutines of both samplers.

For the PCE sampler I changed the rule such that only for the cp.DiscreteUniform inputs, the quadrature rule is set to "discrete" instead of the standard Gaussian quad rule "G". This was already done for the SC sampler. This must be done for DiscreteUniform inputs, otherswise e.g. cp.DiscretUniform(1,2) can lead to non-integer values such as 1.1, when fed to the cp.generate_quadrature method.

tests/test_mix_continuous_discrete.py is the corresponding test for both samplers.

wedeling commented 1 year ago

Looks all good and especially essential to me.

@djgroen the readthedocs test failed due to missing configuration file. Will I mess up the readthedocs page if I merge this into dev?

djgroen commented 1 year ago

@wedeling We did not have such a file in previous versions, and readthedocs built fine at the time. So perhaps something updated on the readthedocs platform that broke the Build between our last commit and the current one?

A broken readthedocs build is not critical though in my experience: the old documentation will remain online while we still try to fix the new build.

So possibly the best bet is to merge this and then fix the build?

wedeling commented 1 year ago

@wedeling We did not have such a file in previous versions, and readthedocs built fine at the time. So perhaps something updated on the readthedocs platform that broke the Build between our last commit and the current one?

A broken readthedocs build is not critical though in my experience: the old documentation will remain online while we still try to fix the new build.

So possibly the best bet is to merge this and then fix the build?

OK I merged it