-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Support logcdf, logccdf and icdf for dim RVs #8083
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
base: main
Are you sure you want to change the base?
Support logcdf, logccdf and icdf for dim RVs #8083
Conversation
6464254 to
f1b70ef
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8083 +/- ##
=======================================
Coverage 90.89% 90.90%
=======================================
Files 123 123
Lines 19489 19506 +17
=======================================
+ Hits 17714 17731 +17
Misses 1775 1775
🚀 New features to boost your workflow:
|
f1b70ef to
d1015d9
Compare
| @_logprob.register(MeasurableXTensorFromTensor) | ||
| def measurable_xtensor_from_tensor(op, values, rv, **kwargs): | ||
| rv_logp = _logprob(rv.owner.op, tuple(v.values for v in values), *rv.owner.inputs, **kwargs) | ||
| def _to_xtensor(expr, op: MeasurableXTensorFromTensor): |
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.
nit: expr is a vague variable name. I associated it with polars expressions, definitely would not have guessed that we want to pass one of _logprob, _logcdf or _icdf here
| x = Normal.dist( | ||
| mu=as_xtensor(mean, dims=("city",)), | ||
| sigma=1, | ||
| dim_lengths={"time": 5}, |
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.
There's no time dim declared, is this a non-public API for making a dims-aware RV?
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 how you specify shape in pymc.dims/xtensor.random variables. There's no size/shape argument, only this. When you are in a model context with a named variable, it forwards this information from model.dim_lengths, but if you are working with a .dist you work with this manually.
|
Approved but there's a failing test, i guess unrelated. |
Only
_logprobhad a dispatch before