-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Refactoring _print_name
for certain RVs and specifying rv_type
s in their distributions
#6219
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
Conversation
25b9f31
to
f671873
Compare
dca5332
to
e5fe176
Compare
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #6219 +/- ##
==========================================
- Coverage 93.78% 93.78% -0.01%
==========================================
Files 101 101
Lines 22187 22235 +48
==========================================
+ Hits 20809 20854 +45
- Misses 1378 1381 +3
|
e5fe176
to
aea8fde
Compare
Can't we just set |
That would have side-effects on the Aesara side (if it even works) |
aea8fde
to
4adb9b7
Compare
Letting tests run again. Hopefully nothing fails. Are there any additional tests to add in light of these new |
c6c02c7
to
cd92813
Compare
cd92813
to
27e574d
Compare
I am not super happy with this (even though I suggested it). It's a bit worrisome that our dispatched methods will work for the subclasses but not the original classes, when all we are doing is changing a name. We could do something more clever, where we still dispatch on the Aesara classes but return the PyMC ones from Distribution when those are specified. Then both objects will have logp/logcdf/moments/ etc... That would have avoided the concerns about the tests where we create new classes. We could use the class Normal(Continuous):
rv_op = pymc_normal
rv_type = NormalRV # Aesara
... And then tweak the Metaclass of Distribution to use |
I understand. I also had some doubts, but at least we have a clearer picture of how the changes in this PR would affect the codebase.
On top of my head, both solutions would work, but I'm not sure how I would dispatch the Aesara classes given pymc/pymc/distributions/distribution.py Lines 107 to 114 in 13dfeb2
I believe that the dispatch is being done in these lines and perhaps there is a more clever way than checking if Again, without trying much, I feel like using |
@larryshamalama what I meant was something like: rv_type = clsdict.setdefault("rv_type", None)
if rv_type is None and isinstance(rv_op, RandomVariable):
rv_type = type(rv_op)
clsdict["rv_type"] = rv_type Then when we set: class Normal(Continuous):
rv_op = pymc_normal
rv_type = NormalRV # Aesara
|
Okay, I can get to it |
27e574d
to
be6bce5
Compare
be6bce5
to
8f90165
Compare
_print_name
in random variables_print_name
for certain RVs and specifying rv_type
s in their distributions
8f90165
to
1205bd8
Compare
@larryshamalama Can you include the default changelist from the PR template? We use those for the auto-generated release notes |
Done! Thanks for the suggestion, I will start doing this more often |
Thanks @larryshamalama, now the |
What is this PR about?
This PR creates "new" PyMC
RandomVariable
s for those that have an abbreviate_print_name
such that we don't have to rely on the RV's class name for Latex and Graphviz displays.Checklist
Major / Breaking Changes
Bugfixes / New features
Docs / Maintenance
Subclass several random variables to have a more readable
_print_name
.Closes #6201