-
-
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
Implement transforms for discrete variables #6102
base: main
Are you sure you want to change the base?
Conversation
87daa29
to
edf512e
Compare
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #6102 +/- ##
===========================================
- Coverage 92.02% 60.18% -31.84%
===========================================
Files 95 95
Lines 16262 16328 +66
===========================================
- Hits 14965 9827 -5138
- Misses 1297 6501 +5204
|
ba811b8
to
6a02057
Compare
Another use case showed up in https://discourse.pymc.io/t/variable-lag-and-slicing/12003 where proposing invalid values for discrete variables can cause the model to error out structurally: https://discourse.pymc.io/t/variable-lag-and-slicing/12003 |
6a02057
to
82e02cf
Compare
Reviving again. This is useful to avoid gotchas where categorical models have a "structural role" in the model, such as being used in indexing. In which case the samplers will just crash with IndexErrors and stuff like that. See https://discourse.pymc.io/t/abc-function-works-independently-but-fails-in-pm-simulator/12470/13 I don't see a good reason not to have transforms by default the same way we do for Continuous variables |
82e02cf
to
da64bf4
Compare
Another similar issue with discrete variables and indexing operations: #7066 |
I am marking this as a draft, as I might very well be shooting myself in the foot... but it seems like it should work?
One trace
Another trace
I purposely chose parameters I thought would benefit from transforms. In general it seems to improve slightly. The outlier clearly being the DiscreteUniform which now has a 100% acceptance rate (which will probably drive Metropolis tuning crazy :P)
Checklist
Major / Breaking Changes
f"{var}_dinterval"
when manually evaluating the modellogp/dlogp
.Bugfixes / New features
Docs / Maintenance