-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
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
ENH: Add broadcast support to Generator.multinomial #16740
Conversation
9986d3e
to
15e3965
Compare
I’d be happy to be a test user when this is ready |
dba9ebb
to
5bfa6e1
Compare
LGTM, but there is a merge conflict. |
5bfa6e1
to
11f9af1
Compare
@mattip Is this fail due to setuptools/distutils expected? |
Should be fixed in master, we don't allow the troublesome version of setuptools. I'll try a close/reopen, if that doesn't work you will probably need to rebase. |
Funny thing is that this was just rebased on master when the fails started. |
It seems setuptools 49.2.1 is out but issue pypa/setuptools#2259 is not fixed. We will have to pin |
xref pr gh-16993 |
11f9af1
to
7128fc9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made a few suggestions, but I haven't carefully reviewed the implementation of the broadcasting. I did run into problems with a couple edge cases: rng.multinomial([1, 2], [])
raises ZeroDivisionError: division by zero
, which is a strange error to get for that input, and more seriously, rng.multinomial(5, [])
crashes Python with Floating point exception: 8
on OSX and Floating point exception (core dumped)
on Linux.
7128fc9
to
bcee419
Compare
I think I have addressed all of the issues you identified @WarrenWeckesser . I also added checks for edge cases with empty arrays. |
ce55453
to
10ecb05
Compare
10ecb05
to
1b2d5d3
Compare
1b2d5d3
to
21b2759
Compare
21b2759
to
a3227c9
Compare
a3227c9
to
65cbb5e
Compare
65cbb5e
to
50c23d6
Compare
8a7e21b
to
e8ad2b1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bashtage, sorry this "dropped off my radar" (as they euphemistically say) for so long.
I made a few small suggestions, otherwise looks good.
a5bd460
to
9eec91f
Compare
Add broadcasting support to multinomial xref numpy#15201
Improve robustness fo broadcasting Explicitly rule out impossible cases
Switch to broadcast_shape plus other small changes
9eec91f
to
43110b6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @bashtage!
Thanks @WarrenWeckesser |
Add broadcasting support to multinomial
xref #15201