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

[BUG] fix rvs output shape in multivariate distributions #11150

Closed
wants to merge 6 commits into from

Conversation

JDkuba
Copy link
Contributor

@JDkuba JDkuba commented Nov 30, 2019

Reference issue

Closes #7689

What does this implement/fix?

Some multivariate distributions (multivariate_normal, wishart and invwishart) rvs methods return output with incorrect shape. As @WarrenWeckesser noted, it is due to the indiscriminate use of squeeze.

Additional information

In my solution, axes that were given with the size parameter are being skipped by squeeze.

@rgommers rgommers added the maintenance Items related to regular maintenance tasks label Jan 5, 2020
@rgommers
Copy link
Member

CI failures are real:

>  out = out.squeeze(axis)
E       TypeError: function takes exactly 0 arguments (1 given)


size = np.asarray(size)
if size.ndim != 0:
all_axes_count = len(out.shape)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

len(out.shape) --> out.ndim

@mdhaber
Copy link
Contributor

mdhaber commented Jul 24, 2022

We do want to fix this, but we need to be careful to warn users in advance. This PR would make the change immediately and it has merge conflicts, so I'll go ahead and close it. The need to fix this is tracked in gh-16278.

@mdhaber mdhaber closed this Jul 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
defect A clear bug or issue that prevents SciPy from being installed or used as expected maintenance Items related to regular maintenance tasks scipy.stats
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Various distribution functions disobey the size parameter when it has unit dimensions
4 participants