You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to use a variable with a uniform integer distribution with the SC and PCE samplers. (Eventually, I want a distribution of {0, 1} for a random binary value).
params = {
...
"l_sb": { # flag for microphysics scheme: false - KK00 Khairoutdinov and Kogan, 2000
"type": "integer", # true - SB Seifert and Beheng, 2001, 2006, Default
"min" : 0,
"max" : 20, # converted to Fortran .true., .false. in prep.sh
"default" : 1
}
}
vary = {
...
"l_sb" : cp.DiscreteUniform(0, 10),
}
It seems the SC and PCE samplers do not respect the discrete distribution, but generate
real-valued sample points. Then, the generated parameters are checked and found to not obey the
constraints, integer values in this case.
Traceback:
Traceback (most recent call last):
File "easyvvuq_dales_sc.py", line 171, in <module>
my_campaign.draw_samples()
File "/home/jansson/code/VECMA/uq_env/lib64/python3.7/site-packages/easyvvuq-0.3.1+187.ga809472-py3.7.egg/easyvvuq/campaign.py", line 529, in draw_samples
File "/home/jansson/code/VECMA/uq_env/lib64/python3.7/site-packages/easyvvuq-0.3.1+187.ga809472-py3.7.egg/easyvvuq/campaign.py", line 464, in add_runs
File "/home/jansson/code/VECMA/uq_env/lib64/python3.7/site-packages/easyvvuq-0.3.1+187.ga809472-py3.7.egg/easyvvuq/params_specification.py", line 109, in process_run
RuntimeError: Error when verifying the following new run:
{'Nc_0': 55635083.268962905, 'cf': 2.422540333075852, 'Prandtl': 0.2225403330758517, 'l_sb': 0.7809953780542012, 'cn': 0.76, 'Rigc': 0.25, 'z0': 0.00016}
Identified errors were:
{'l_sb': ['must be of integer type']}
Among the test cases, I only saw one example using a discrete distribution - test_worker.py, line 109.
It uses the RandomSampler.
Is it possible to combine discrete integer distributions with SC and PCE sampling?
If possible, there is an extra complication in that the number of allowed values may be less than the
number of sampling points specified - e.g. 3rd order sampling and a binary variable. This might require allowing to have different orders for different variables.
The text was updated successfully, but these errors were encountered:
Part of this issue was solved with a chaospy update. Here's a summary of the current state.
Solved: chaospy fixed non-integer points in quadrature rules, specifically with joint distributions, in version 3.2.1. Discussion in jonathf/chaospy#188
We should update the chaospy version in requirements.txt to at least 3.2.1.
( I have tested EasyVVUQ with chaospy 3.2.1. Chaospy 3.2.6 is available now - but EasyVVUQ doesn't work with it)
Still open: If a parameter is declared with "type": "integer", the validation fails on DiscreteUniform distributions because chaospy returns a float numpy array. Workaround: declare all variables with "type": "float".
Perhaps the validation should check the value and not the type. Potential source of confusion: when generating a chaospy quadrature of a join of only discrete distributions, the absicissas are returned as an integer array. But when generating a quadrature of a join of discrete and continuous distribution, the abscissas are returned as a float array. It doesn't seem easy or reasonable to change this.
I'm trying to use a variable with a uniform integer distribution with the SC and PCE samplers. (Eventually, I want a distribution of {0, 1} for a random binary value).
It seems the SC and PCE samplers do not respect the discrete distribution, but generate
real-valued sample points. Then, the generated parameters are checked and found to not obey the
constraints, integer values in this case.
Traceback:
Among the test cases, I only saw one example using a discrete distribution - test_worker.py, line 109.
It uses the RandomSampler.
number of sampling points specified - e.g. 3rd order sampling and a binary variable. This might require allowing to have different orders for different variables.
The text was updated successfully, but these errors were encountered: