pymc
pymc copied to clipboard
Add support for automatic naming of random variables
This PR introduces a way to use distributions without needing to provide a name.
This means:
import pymc as pm
with pm.Model():
x = pm.Normal(0., 1.)
is equivalent to
import pymc as pm
with pm.Model():
x = pm.Normal("x", 0., 1.)
I use some code originally written by @Tobias-Kohn for pyprob. The implementation is done by inspecting stack frames to figure out what the assignment will be. It picks earliest point an assignment can take place.
This PR is intended to be fully backwards-compatible.
Checklist
- [x] Explain important implementation details 👆
- [x] Make sure that the pre-commit linting/style checks pass.
- [x] Are the changes covered by tests and docstrings?
- [x] Fill out the short summary sections 👇