-
Notifications
You must be signed in to change notification settings - Fork 27
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
an issue using a Quasi-Monte Carlo sampler #368
Comments
Hi @kbronik2017 Where do you get negative values? in |
Yes it is, if you add for example "print" statement after the following line: self._samples = self.distribution.inv(dist_U.fwd(nodes.transpose())) print("self._samples") it will print the negative samples |
print("samples:", self._samples) |
If I execute this: import chaospy as cp
import easyvvuq as uq
params = {
"X": {"type": "integer", "min": 0, "max": 20, "default": 10},
"Y": {"type": "integer", "min": 0, "max": 30, "default": 20},
"out_file": {"type": "string", "default": "output.csv"}
}
vary = {
"X": cp.DiscreteUniform(1, 15),
"Y": cp.DiscreteUniform(5, 25)
}
sampler = uq.sampling.QMCSampler(vary, 10)
print(sampler._samples) I obtain:
So no negative values. What is your version of ChaosPy? However, the other obvious problem is that the resulting samples are not discrete. If I check the chaospy documentation, it seems that the DiscreteUniform variables are still treated as continuous under the hood:
So the inverse transform (which is also used in the QMCSampler) returns non-integer values. The other problem with the We also have a Monte Carlo sampler ( import chaospy as cp
import easyvvuq as uq
params = {
"X": {"type": "integer", "min": 0, "max": 20, "default": 10},
"Y": {"type": "integer", "min": 0, "max": 30, "default": 20},
"out_file": {"type": "string", "default": "output.csv"}
}
vary = {
"X": cp.DiscreteUniform(1, 15),
"Y": cp.DiscreteUniform(5, 25)
}
sampler = uq.sampling.MCSampler(vary, 10)
print(sampler.xi_mc) I get
So I would stick with the MCsampler for now. I even think we could delete the |
Hi, Thank you (and non-integer values, yes, I forgot to mention it as well, thank you for pointing that out), actually, the settings were exactly as the follows (which did results in negative samples, version of ChaosPy==4.3.2) params = { vary = { But it does not matter now, as you suggested, using the Monte Carlo sampler instead of QMC would be the best choice. Best |
Hi
An issue using a Quasi-Monte Carlo sampler with discrete uniform (values from ChaosPy distributions)
For example, consider the following scenario:
params = {
"X": {"type": "integer", "min": 0, "max": 20, "default": 10},
"Y": {"type": "integer", "min": 0, "max": 30, "default": 20},
"out_file": {"type": "string", "default": "output.csv"}
}
vary = {
"X": cp.DiscreteUniform(1, 15),
"Y": cp.DiscreteUniform(5, 25)
}
will give negative samples (needless to say it works very well with only Uniform distribution), and the reason could be found in the file easyvvuq/sampling/qmc.py where
dist_U = []
for i in range(self.n_params):
dist_U.append(cp.Uniform())
dist_U = cp.J(*dist_U)
only a Uniform distribution case is implemented, so either you need to add a DiscreteUniform case as well or add some assertion there!
thanks.
The text was updated successfully, but these errors were encountered: