Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MC Sampler: Integer inputs converted to floats causing EasyVVUQ error #431

Open
lauraharbach opened this issue Dec 4, 2024 · 3 comments

Comments

@lauraharbach
Copy link

Description:

The MC Sampler converts integer inputs to floats when using the DiscreteUniform distribution. While the numerical values remain integers, they are of type float (e.g., 220.0 instead of 220). This means EasyVVUQ encounters an error as it expects an integer.

Steps to Reproduce:

A minimum working example demonstrating the issue is available here: https://drive.google.com/file/d/17NlEwNK-lSe56C9Ucu6_2MkKbD1lfGdO/view?usp=share_link

Alternatively, modify the basic tutorial with:

  1. Integer Parameter: Define a new parameter as an integer type.
  2. DiscreteUniform Distribution: Assign a DiscreteUniform distribution to the integer parameter.
  3. Run MC Sampler: Execute the model using the MC Sampler.

Expected Behavior:

The MC Sampler should sample integer values from the DiscreteUniform distribution and pass them directly to EasyVVUQ without any conversion.

Observed Behavior:

The MC Sampler converts integer inputs to floats before passing them to EasyVVUQ, causing an error because EasyVVUQ expects an integer.

Potential Solution:

The documentation for Chaospy suggests using the interpret_as_integer flag. However, debugging indicates that the flag is already being set correctly in MCSampler.py. Further investigation is needed to identify the root cause of the conversion.

@JonMcCullough
Copy link
Contributor

Test for this exact issue for SC and PCE samplers passes. This commit has the relevant edits - 32f4886.

@JonMcCullough
Copy link
Contributor

Have just pushed edits to mc_sampler.py and test_mix_continuous_discrete.py based on previous efforts to address this.

@JonMcCullough
Copy link
Contributor

Laura, may be worth double-checking the modified beam tutorial works for you now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants