-
-
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
Obtain timeseries step information from dims or observed #5743
Obtain timeseries step information from dims or observed #5743
Conversation
a7d9fde
to
b7a6290
Compare
Codecov Report
@@ Coverage Diff @@
## main #5743 +/- ##
==========================================
- Coverage 89.22% 89.13% -0.09%
==========================================
Files 75 75
Lines 13824 13844 +20
==========================================
+ Hits 12334 12340 +6
- Misses 1490 1504 +14
|
We really need to sort out what's going with #5739, it's failing nearly every time |
ff03fe7
to
4897cab
Compare
This is consistent with the meaning of steps in the GaussianRandomWalk and translates directly to the number of scan steps taken
4897cab
to
504da82
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.
Looks really good!
I particularly like the test cases.
@@ -245,6 +274,7 @@ def dist( | |||
and init.owner.op.ndim_supp == 0 | |||
): | |||
raise TypeError("init must be a univariate distribution variable") | |||
check_dist_not_registered(init) |
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.
Can you add a comment what this line does?
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 think the function self documents itself well enough:
Lines 337 to 351 in 02897d1
def check_dist_not_registered(dist, model=None): | |
"""Check that a dist is not registered in the model already""" | |
from pymc.model import modelcontext | |
try: | |
model = modelcontext(None) | |
except TypeError: | |
pass | |
else: | |
if dist in model.basic_RVs: | |
raise ValueError( | |
f"The dist {dist} was already registered in the current model.\n" | |
f"You should use an unregistered (unnamed) distribution created via " | |
f"the `.dist()` API instead, such as:\n`dist=pm.Normal.dist(0, 1)`" | |
) |
Follow up to #5690 so that steps can also be retrieved from observed and dims when possible.
Other changes:
pandas_to_array
toconvert_observed_data
steps
more consistent with expectation / GRW