-
-
Notifications
You must be signed in to change notification settings - Fork 417
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
enabled type checking for io_pymc3 input #1629
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good, can you also add a test for this?
Codecov Report
@@ Coverage Diff @@
## main #1629 +/- ##
=======================================
Coverage 90.92% 90.92%
=======================================
Files 108 108
Lines 11663 11665 +2
=======================================
+ Hits 10604 10606 +2
Misses 1059 1059
Continue to review full report at Codecov.
|
CHANGELOG.md
Outdated
@@ -25,6 +25,7 @@ | |||
* Fix `ess/rhat` plots in `plot_forest` ([1606](https://github.com/arviz-devs/arviz/pull/1606)) | |||
* Fix `from_numpyro` crash when importing model with `thinning=x` for `x > 1` ([1619](https://github.com/arviz-devs/arviz/pull/1619)) | |||
* Upload updated mypy.ini in ci if mypy copilot fails ([1624](https://github.com/arviz-devs/arviz/pull/1624)) | |||
* Enforced using `pymc3.backends.base.MultiTrace` as the `trace` value for `io_pymc3` ([1629](https://github.com/arviz-devs/arviz/pull/1629)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would say something along the lines of raising an informative error if inferencedata is passed
@@ -139,6 +139,16 @@ def test_from_pymc_predictions(self, data, eight_schools_params): | |||
assert ivalues.shape[0] == 1 # one chain in predictions | |||
assert np.all(np.isclose(ivalues[0], values)) | |||
|
|||
def test_from_pymc_trace_inference_data(self): | |||
# check if error is raised successfully after passing InferenceData as trace |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be a docstring using """
instead of a comment
with pm.Model(): | ||
p = pm.Uniform("p", 0, 1) | ||
pm.Binomial("w", p=p, n=2, observed=1) | ||
trace = pm.sample(100, chains=2, return_inferencedata=True) | ||
assert isinstance(trace, InferenceData) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we don't need to sample from a model, we can use an example inferencedata or create it with from_dict
and then do az.from_pymc3(idata, model=pm.Model())
directly
* enabled type checking for io_pymc3 input * Added test and updated changelog * Fixed test and updated changelog msg
Description
Enabled type checking for
io_pymc3
input... Now it raises an error whenever input type is ofInferenceData
.Fix #1617
Checklist