Move to v4 for Rethinking 2 #194
Merged
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
Move to v2 for Rethinking 2
Starting with Statistical Rethinking 2 as this is the one I know the best.
Was using the script from pymc-example (
scripts/rerun.py)Some of the file got transformed automatically:
Rethinking_2/Chp_02.ipynbRethinking_2/Chp_03.ipynbRethinking_2/Chp_10.ipynbRethinking_2/End_of_chapter_problems/Chapter_2.ipynbRethinking_2/End_of_chapter_problems/Chapter_11.ipynbThis PR include #152 .
For
Rethinking_2/Chp_04.ipynb:return_inferencedata=Truefor thepm.sampleso using theaz.InferenceDatafor the the trace variables.trace['var']totrace.posterior('var']when possible or when it was expecting a array with all the sample in one array (rather than one array per chain), I usedaz.extract_datasetOther change needed was when a Panda Series was used to define a model, this was triggering a
Elementwiseerror, adding.valuesturned out to be enough.As the traces are
az.InferenceData, calculating the mean returns an array (I meant an Xarray), so added.item(0)to keep the compatibility with the formula as they exist, not sure this is the most elegant solution.Same thing for the size of the posterior distribution, you cannot just do
len(trace['var'], so I used.sizes["sample"], again not sure this is the most elegant solution, but it works.For the #152 :
sns.kdeplotfollowing seaborn depreciation warningbwtobw_methodas per seaborn depreciation warning.Simulation of field trip, as it was only doing 15 steps (index 0 is when no step have been done as far as I understood it).