-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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 DiscreteGuideTable wrapper #14828
Conversation
Hi Kai, thanks for working on this. Don't forget to add the type hints in the pyi-file in the _unuran folder. |
This case is already handled by UNU.RAN giving a descriptive warning outlining the behaviour and that instead the defualt value is used. We do not require additional code to handle this.
Sorry for all the conflicts, @Kai-Striega! I have resolved them for you. If you have changed something locally, I think you can save it in some other temporary workspace or stash the changes using |
EDIT: Fixed by rebuilding all files from source.
|
This PR copies much of the examples from the DiscreteGuideTable examples modifying the docs as appropriate. It further adds examples for how to use the two kwargs.
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.
Some comments on typos, style, and tests. Wrapper code, docs, and tests look very good! You can copy-paste the documentation in the tutorial and write a small benchmark for the method to finish this up. Given the similarity to DiscreteAliasUrn
, I think we should be good to go if tuts and benchmarks look good. Can you take a look whenever you are free @chrisb83?
DOC: Document PPF example for DGT wrapper
Co-authored-by: Tirth Patel <tirthasheshpatel@gmail.com>
@tirthasheshpatel could you take a look at why there are merge issues. I don't think that it's anything I did but I'm not sure what's causing them |
Thanks for the changes, @Kai-Striega! I think the last thing left to do is return |
There's also one more instance of guide_factor that requires back-ticks around it
I'm having some weird issue with this. I've added the line
This should already be done starting on line 102 of
ok. I just don't normally like not having the tests run |
Oh, yes! Let me know once you are done with the |
@tirthasheshpatel it should be ready now ;) |
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.
This is very close! Last batch of comments to resolve the failing tests.
Co-authored-by: Tirth Patel <tirthasheshpatel@gmail.com>
Co-authored-by: Tirth Patel <tirthasheshpatel@gmail.com>
@tirthasheshpatel I've fixed the CI failure test failure, there is one more on MyPy that I can't fix - short of removing the line in its entirety. Could you please take a look and check if there is any better way to get it to pass? |
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.
Everything looks good to me now! Tests are comprehensive; docs and tutorials are informative. Only one comment on the tutorial above. @chrisb83 Let me know if we still have your approval after the new changes. If you are happy with it, feel free to merge!
@tirthasheshpatel @chrisb83 I'd like to thank both of you for all the help - and patience - on this PR. It is appreciated! |
Co-authored-by: Kai <kaistriega+github@gmail.com>
Thanks for your help too @Kai-Striega! This was a big one :) |
Thanks Kai and Tirth! Nice to have this method in SciPy now |
Thanks again @Kai-Striega! And thanks @chrisb83 for the reviews! |
Reference issue
gh-14600
What does this implement/fix?
This is a very minimal start of to the DiscreteGuideTable wrapper. It is included in
all_methods
and the associated tests pass, however additional tests, documentation and type hinting must still be added.Additional information
I'm having some problems having the wrapper recognize the probability vector memory view, this can be reproduced as follows:
It's also interesting to note that the tests still pass despite this.