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

Python Importing Fashion Affects the Sampler Output's Shape #421

Open
ehsansaleh opened this issue Apr 26, 2024 · 1 comment
Open

Python Importing Fashion Affects the Sampler Output's Shape #421

ehsansaleh opened this issue Apr 26, 2024 · 1 comment
Labels

Comments

@ehsansaleh
Copy link

Describe the bug
There are two ways to call the generate_samples function:

  • Calling generate_samples with a from chaospy.distributions.sampler.generator import generate_samples import.
  • Calling sampler.generator.generate_samples with a from chaospy.distributions import sampler import.

As you can see below, these two methods yield different output shapes on the same set of input arguments.

To Reproduce

>>> import chaospy
>>> from chaospy.distributions.sampler.generator import generate_samples
>>> from chaospy.distributions import sampler

>>> cpy_dist = chaospy.Iid(chaospy.Normal(0, 1), 1)
>>> cpy_jac = chaospy.J(cpy_dist)
>>> rule = "additive_recursion"

>>> a = generate_samples(order=128, domain=cpy_jac, rule=rule, antithetic=None)
>>> a.shape
(1, 128)

>>> b = sampler.generator.generate_samples(order=128, domain=cpy_jac, rule=rule, antithetic=False)
>>> b.shape
(1, 65)

>>> c = cpy_jac.sample(size=128, rule=rule, antithetic=False, include_axis_dim=True)
>>> c.shape
(1, 65)

Expected behavior
There is no error. However, I can't wrap my head around why an identical call to generate_samples and sampler.generator.generate_samples results in different shapes!

Desktop (please complete the following information):

  • OS: CentOS 7.9
  • Python version: 3.8.8
  • Chaospy version: 4.3.13

Additional context
See #420 (comment) for the pip freeze output on my system

@ehsansaleh ehsansaleh added the bug label Apr 26, 2024
@jonathf
Copy link
Owner

jonathf commented May 18, 2024

Thanks for the bug report.

This is indeed a bug in the antithetic variate module. I've made a fix in version 4.3.15. Please let me know if it solves the problem for you.

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

No branches or pull requests

2 participants