-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Support PyTensor deterministic operations as observations #7656
Conversation
We need to tell InferenceData converter how to get the data values to put in |
I don't consider this a bugfix, it's behavior that was explicitly forbidden for conservative reasons (more like a NotImplementedError) |
Where does this happen in the code? |
I think the MiniBatch tests will still fail. Any thoughts on how that should behave? |
Also, feel free to choose a better title! I couldn't express it too well |
Line 63 in fa43eba
Line 152 in fa43eba
We should be able to just use constant_fold (also in pytensor) for it |
I have an implementation before this suggestion. I need a little help understanding this. Feel free to put suggestion |
What do you mean? My suggestion is to simply call constant_fold on the observed variable |
I am not able to make this work with either |
From pymc.pytensorf. There's a |
Ah if it's a SharedVariable like |
from pytensor.compile.mode import Mode
import pymc as pm
with pm.Model(coords={"date": [0, 1, 2]}) as m:
data = pm.Data("data", [0, 1, 2], dims="date")
x = pm.Normal("x")
y = pm.Normal("y", x, observed=data, dims="date")
cheap_eval_mode = Mode(linker="py", optimizer=None)
m.rvs_to_values[y].eval(mode=cheap_eval_mode)
# array([0., 1., 2.]) |
Thanks for the suggestion. I've used mode on the random variable directly. Is it different to get the rvs_to_values from the model? it currently isn't accessed from the function at the moment. |
Could you point me to similar tests for this? |
I've just added to associated pytensorf test suite |
There are some failing tests related to the Mini batch also using the is_valid_observed function as well. How should those be handled. Are those test tests no longer valid? |
Yeah sounds like the test should be changed to the more strict kind of stuff that we still don't allow, like having a pt.random.normal in it. |
Looks like a random test failure? Will address rest of feedback when I have chance |
Yeah that one is flaky, we should probably try/except on that error and just skip when it happens |
Are we far from merge here? |
Hi @ricardoV94 |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #7656 +/- ##
==========================================
- Coverage 92.70% 92.65% -0.06%
==========================================
Files 107 107
Lines 18391 18327 -64
==========================================
- Hits 17050 16981 -69
- Misses 1341 1346 +5
|
Thanks @wd60622 and apologies for the delay |
Description
Will need some help on this implementation and how to best test this.
Related Issue
Checklist
Type of change
📚 Documentation preview 📚: https://pymc--7656.org.readthedocs.build/en/7656/