pymc
pymc copied to clipboard
Add gufunc signature to SymbolicRandomVariables
Description
This meta-info is necessary to reason about batch dims of SymbolicRandomVariables in the context of https://github.com/pymc-devs/pymc-experimental/pull/300
This is probably what we should use for RandomVariables, instead of defining ndims_params
and ndim_supp
. Those can be properties derived from the gufunc signature.
There is however a limitation with gufunc signatures, which has to do with inputs and outputs that are not tensors, such as RNGs and the size vector which obviously cannot have batch dimensions. For now I am treating those as scalars so in the signature they show up as ()
, but perhaps it makes sense to deviate a bit from numpy and use []
or None
?
For vanilla RandomVariables like Normal. the signature would be None,None,None,(),()->None,()
, for the inputs: rng, size, dtype, mu, sigma and outputs: next_rng, draws.
Related Issue
- [ ] Closes #
- [x] Related to https://github.com/pymc-devs/pymc-experimental/pull/300
Checklist
- [x] Checked that the pre-commit linting/style checks pass
- [x] Included tests that prove the fix is effective or that the new feature works
- [x] Added necessary documentation (docstrings and/or example notebooks)
- [x] If you are a pro: each commit corresponds to a relevant logical change
Type of change
- [ ] New feature / enhancement
- [ ] Bug fix
- [ ] Documentation
- [x] Maintenance
- [ ] Other (please specify):
π Documentation preview π: https://pymc--7159.org.readthedocs.build/en/7159/
Codecov Report
Attention: Patch coverage is 91.30435%
with 6 lines
in your changes are missing coverage. Please review.
Project coverage is 92.23%. Comparing base (
a2988c7
) to head (45eb6ef
). Report is 1 commits behind head on main.
Additional details and impacted files
@@ Coverage Diff @@
## main #7159 +/- ##
==========================================
- Coverage 92.28% 92.23% -0.06%
==========================================
Files 101 100 -1
Lines 16923 16889 -34
==========================================
- Hits 15618 15578 -40
- Misses 1305 1311 +6
Files | Coverage Ξ | |
---|---|---|
pymc/distributions/censored.py | 100.00% <100.00%> (ΓΈ) |
|
pymc/distributions/mixture.py | 95.08% <100.00%> (+0.12%) |
:arrow_up: |
pymc/distributions/multivariate.py | 93.81% <100.00%> (+0.02%) |
:arrow_up: |
pymc/distributions/timeseries.py | 94.58% <100.00%> (+0.12%) |
:arrow_up: |
pymc/distributions/distribution.py | 94.29% <87.50%> (-0.76%) |
:arrow_down: |
Just for clarity, we don't have any sections of the code that use a tensor of RNG seeds right?
That's not a thing in PyTensor