Skip to content

Last dimension is dropped by random when size is one #3896

Closed
@huard

Description

@huard

Description of your problem

The last dimension is squeezed when generating random samples. This creates a problem when converting posterior predictive samples to DataArray objects.

In the following example, I would expect the second case to have shape (10, 1, 2, 1).

>>> pm.distributions.Uniform.dist(lower=np.zeros((1,2,3)), upper=np.ones((1,2,3))).random(size=10).shape
(10, 1, 2, 3)

>>> pm.distributions.Uniform.dist(lower=np.zeros((1,2,1)), upper=np.ones((1,2,1))).random(size=10).shape
(10, 1, 2)

Versions and main components

  • PyMC3 Version: 3.8
  • Theano Version: 1.0.4
  • Python Version: 3.6.8
  • Operating system: Ubuntu
  • How did you install PyMC3: pip

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions