-
-
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
Make pm.sample
return InferenceData
by default
#4372
Comments
Hi @AlexAndorra . |
Hi @chandan5362 ! Yes, exactly. And then actually implementing the default switch in the code -- and see whether our tests suite still passes. You wanna take that on? |
Yeah! sure, I would love to. if return_inferencedata is None:
v = packaging.version.parse(pm.__version__)
if v.release[0] > 3 or v.release[1] >= 10: # type: ignore
warnings.warn(
"In an upcoming release, pm.sample will return an `arviz.InferenceData` object instead of a `MultiTrace` by default. "
"You can pass return_inferencedata=True or return_inferencedata=False to be safe and silence this warning.",
FutureWarning,
)
# set the default
return_inferencedata = False am I going good? |
Hi @chandan5362, |
You meant setting |
I got a little lost in hypothetical changes. TL;DR I think we should start updating the code to Yeah, changing the default to I was thinking that maybe we could already start working on it using rcParams or something like that. As I understand it, the final goal is to remove To use an example, updating https://docs.pymc.io/notebooks/multilevel_modeling.html to use inferencedata instead of multitrace required considerable work, and the more specific the notebook the more work it will be (basically everything that differs from Also, these updates will allow us to write
or
can make "multitrace code" like |
I totally agree with @OriolAbril . ============================================================= short test summary info ==============================================================
FAILED pymc3/tests/test_sampling.py::TestSample::test_parallel_sample_does_not_reuse_seed - AttributeError: 'InferenceData' object has no attribu...
FAILED pymc3/tests/test_sampling.py::TestSample::test_parallel_start - AttributeError: 'InferenceData' object has no attribute 'get_values'
FAILED pymc3/tests/test_sampling.py::TestSample::test_sample_tune_len - TypeError: object of type 'InferenceData' has no len()
FAILED pymc3/tests/test_sampling.py::TestSample::test_trace_report[True-NUTS] - AttributeError: 'InferenceData' object has no attribute 'report'
FAILED pymc3/tests/test_sampling.py::TestSample::test_trace_report[True-Metropolis] - AttributeError: 'InferenceData' object has no attribute 're...
FAILED pymc3/tests/test_sampling.py::TestSample::test_trace_report[True-Slice] - AttributeError: 'InferenceData' object has no attribute 'report'
FAILED pymc3/tests/test_sampling.py::TestSample::test_trace_report[False-NUTS] - AttributeError: 'InferenceData' object has no attribute 'report'
FAILED pymc3/tests/test_sampling.py::TestSample::test_trace_report[False-Metropolis] - AttributeError: 'InferenceData' object has no attribute 'r...
FAILED pymc3/tests/test_sampling.py::TestSample::test_trace_report[False-Slice] - AttributeError: 'InferenceData' object has no attribute 'report'
FAILED pymc3/tests/test_sampling.py::TestSample::test_trace_report_bart - AttributeError: 'InferenceData' object has no attribute 'report'
FAILED pymc3/tests/test_sampling.py::TestSample::test_sampler_stat_tune[1] - AttributeError: 'InferenceData' object has no attribute 'get_sampler...
FAILED pymc3/tests/test_sampling.py::TestSample::test_sampler_stat_tune[2] - AttributeError: 'InferenceData' object has no attribute 'get_sampler...
FAILED pymc3/tests/test_sampling.py::TestSample::test_callback_can_cancel - TypeError: object of type 'InferenceData' has no len()
FAILED pymc3/tests/test_sampling.py::TestSamplePPC::test_normal_scalar - AttributeError: 'InferenceData' object has no attribute 'report'
FAILED pymc3/tests/test_sampling.py::TestSamplePPC::test_normal_vector - AttributeError: 'InferenceData' object has no attribute 'nchains'
FAILED pymc3/tests/test_sampling.py::TestSamplePPC::test_model_shared_variable - TypeError: 'InferenceData' object is not subscriptable
FAILED pymc3/tests/test_sampling.py::TestSamplePPC::test_deterministic_of_observed - TypeError: object of type 'InferenceData' has no len()
FAILED pymc3/tests/test_sampling.py::TestSamplePPC::test_deterministic_of_observed_modified_interface - AttributeError: 'InferenceData' object ha...
FAILED pymc3/tests/test_sampling.py::TestSamplePosteriorPredictive::test_point_list_arg_bug_fspp - TypeError: 'InferenceData' object is not subsc...
FAILED pymc3/tests/test_sampling.py::TestSamplePosteriorPredictive::test_point_list_arg_bug_spp - TypeError: 'InferenceData' object is not subscr...
FAILED pymc3/tests/test_sampling.py::TestSamplePosteriorPredictive::test_sample_from_xarray_prior - AttributeError: 'InferenceData' object has no...
FAILED pymc3/tests/test_sampling.py::TestSamplePosteriorPredictive::test_sample_from_xarray_posterior - AttributeError: 'InferenceData' object ha...
FAILED pymc3/tests/test_sampling.py::TestSamplePosteriorPredictive::test_sample_from_xarray_posterior_fast - AttributeError: 'InferenceData' obje...
============================================= 23 failed, 60 passed, 712 warnings in 489.86s (0:08:09) ============================================== These failures only account for |
what do you say @AlexAndorra ? |
Yeah, I agree with @OriolAbril's roadmap 👌 Especially:
If that all sounds clear to you, I think we can start @chandan5362 ! |
Yeah sure @AlexAndorra , we can start working. |
Pymc3 does not have rcparams (yet?), if we want to use that instead of setting return_inferencedata=True we can set something up. We can use arviz functions to generate the class so it should not be too much code nor too much work but not sure it is worth it. Are there other params that could benefit from that? If it's only want it does not make much sense |
Are you @OriolAbril referring to |
I see 3 main options:
|
@AlexAndorra, what should we do ? |
I wonder if option 1 is not the way to go, since it should be somewhat easy to do the change in one go with an IDE 🤔 |
@AlexAndorra @chandan5362 Sorry I did not notice that this conversation was going on. There are 99 occurences of
I think we can do both - Option 1 in #4446 and adding As much as I would like to get rid of the |
@AlexAndorra @michaelosthege So, I am proceeding with option 1. let's see how much time does it take? |
Just to get on the pace, How much time do we have to complete this PR before rolling out to the users? |
@chandan5362 hold on - in our PyMC meeting yesterday we discussed about this topic. We concluded that because However, many tests rely on the current default of I think that some of them are currently not compatible with Sorry about this back and forth. The Timeline right now is somewhat delicate ;) |
It's okay @michaelosthege , No problem at all. |
Also removes some unnecessary XFAIL marks. Closes pymc-devs#4372, pymc-devs#4740
Also removes some unnecessary XFAIL marks. Closes pymc-devs#4372, pymc-devs#4740
Also removes some unnecessary XFAIL marks. Closes pymc-devs#4372, pymc-devs#4740
Also removes some unnecessary XFAIL marks. Closes pymc-devs#4372, pymc-devs#4740 Co-authored-by: Oriol Abril <[email protected]>
Also removes some unnecessary XFAIL marks. Closes #4372, #4740 Co-authored-by: Oriol Abril <[email protected]>
The
return_inferencedata
kwarg has been there for a while inpm.sample
, without big bugs appearing, so we should add aDeprecationWarning
in 3.11, saying that the default format will change toInferenceData
in the next major release, aka 4.0.0.Feel free to comment if you wanna take on this issue 🖖
The text was updated successfully, but these errors were encountered: