-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Create helper pm.draw() to take draws for a given variable #5340
Conversation
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.
Looks great! I left a couple of suggestions above, let me know if you have any questions
By the ways, after updating the draw function and test cases, how should I proceed? Should I make a new Pull request, or how to integrate the updated codes into this Pull request? Many thanks. |
You can just add more commits and push to your GitHub branch, they will show up automatically here in the PR |
Hi yes, I have updated the codes and push it to the GitHub. Thanks. |
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.
Great progress! I left a couple more small comments/suggestions, but it looks pretty close to done.
You will also need to update the Release Notes to mention the new feature, and in these lines say that pm.draw(x)
shoud be used instead of x.eval()
:
Line 36 in b29124b
- `pm.Distribution(...).random()` is now `pm.Distribution(...).eval()` |
Let me know if you have any questions!
@OriolAbril It seems like the code block in the function docstrings is not rendering in the docs preview. Is there a formatting issue or is this expected? https://pymc--5340.org.readthedocs.build/en/5340/api/samplers.html#pymc.sampling.draw |
Codecov Report
@@ Coverage Diff @@
## main #5340 +/- ##
==========================================
+ Coverage 80.19% 80.23% +0.03%
==========================================
Files 89 89
Lines 14847 14856 +9
==========================================
+ Hits 11907 11919 +12
+ Misses 2940 2937 -3
|
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.
Trying to keep the Release Notes a bit more brief, as they are going to be pretty long for the V4 release already
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.
Looks great! Will merge after the tests pass
@danhphan I fixed the branch conflicts and tweaked some type hints and internal variable names, but nothing more. If you need to make further changes in your PR you will have to rebase from here (your origin) |
Hi yes, thanks a lot for your help 👍 @ricardoV94 |
@danhphan Ended up doing more changes than I expected, so sorry for robbing the fun from you... Thanks a lot and congrats for the PR! |
Indeed, this is one hell of a first PR @danhphan! |
Hi, all good @ricardoV94 @twiecki, It is great to contribute and learn as well :) |
Hi @ricardoV94
I have created helper pm.draw() to take draws for a given variable or several variables, to address the issue #5311
The draw function is stored in pymc/sampling.py along with docstring and examples.
The test cases are added in class TestDraw in pymc/tests/tests_sampling.py
Please let me know if there is anything needed to update.
Thank you.
Closes #5311