Skip to content

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

@ehsansaleh

Description

@ehsansaleh

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions