-
-
Notifications
You must be signed in to change notification settings - Fork 269
Updated splines notebook to v4 #274
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
Conversation
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
View / edit / reply to this conversation on ReviewNB OriolAbril commented on 2022-01-31T00:15:37Z Add a myst target with a notebook specific keyword so we can use it to link to this notebook from other pages of the documentation. https://docs.pymc.io/en/latest/contributing/jupyter_style.html#first-cell |
View / edit / reply to this conversation on ReviewNB OriolAbril commented on 2022-01-31T00:15:37Z the
Moreover, I think there was also a way of setting dim lengths only, so that instead of creating an arange, something like michaelosthege commented on 2022-02-06T14:25:17Z Yes, the You can write this: w = pm.Normal("w", mu=0, sd=3, size=B.shape[1], dims="splines") to automatically create a lenght-3 dimension tied to that |
View / edit / reply to this conversation on ReviewNB OriolAbril commented on 2022-01-31T00:15:39Z with spline_model: idata = pm.sample_prior_predictive() idata.extend(pm.sample( draws=1000, tune=1000, random_seed=RANDOM_SEED, chains=4, return_inferencedata=True, )) pm.sample_posterior_predictive(idata, extend_inferencedata=True)
I think something like the above will work. |
View / edit / reply to this conversation on ReviewNB OriolAbril commented on 2022-01-31T00:15:39Z Line #1. wp = trace.posterior["w"].mean(("chain", "draw")).values instead, we should avoid axis indexes when working with xarray. I don't have time to look into converting the cell into xarray and don't want to block the PR, but this is very easy fix |
View / edit / reply to this conversation on ReviewNB OriolAbril commented on 2022-01-31T00:15:40Z Add yourself here too. https://docs.pymc.io/en/latest/contributing/jupyter_style.html#authorship-and-attribution |
Yes, the You can write this: w = pm.Normal("w", mu=0, sd=3, size=B.shape[1], dims="splines") to automatically create a lenght-3 dimension tied to that View entire conversation on ReviewNB |
View / edit / reply to this conversation on ReviewNB michaelosthege commented on 2022-02-06T14:25:49Z Does this render correctly? Could be safer to go with a standard inline code formatting. OriolAbril commented on 2022-02-06T14:31:11Z it does and it's standard code formatting. The strange view is all because of reviewnb. The actual change is swapping apostrophes for backticks. Never trust reviewnb preview. What matters is what is shown in the website: https://pymc--274.org.readthedocs.build/projects/examples/en/274/splines/spline.html?highlight=splines#prepare-the-spline |
it does and it's standard code formatting. The strange view is all because of reviewnb. The actual change is swapping apostrophes for backticks. Never trust reviewnb preview. What matters is what is shown in the website: https://pymc--274.org.readthedocs.build/projects/examples/en/274/splines/spline.html?highlight=splines#prepare-the-spline View entire conversation on ReviewNB |
View / edit / reply to this conversation on ReviewNB aloctavodia commented on 2022-04-01T07:06:04Z Remove line
Below is an exmaple of how to fit a spline using the Bayesian framework PyMC.
We can also remove this (I found them very distracting)
As the book uses Stan (another advanced probabilitistic programming language), the modeling code is primarily taken from the GitHub repository of the PyMC implementation of Statistical Rethinking. My contributions are primarily of explanation and additional analyses of the data and results. Note that this is not a comprehensive review of splines – I primarily focus on the implementation in PyMC.
We can also direct people to https://bayesiancomputationbook.com/markdown/chp_05.html :-)
|
View / edit / reply to this conversation on ReviewNB aloctavodia commented on 2022-04-01T07:06:05Z We are going to use 'patsy' library to generate the basis for the spline (more on that below). |
View / edit / reply to this conversation on ReviewNB aloctavodia commented on 2022-04-01T07:06:05Z I think this is also distracting from the main topic of the example
|
View / edit / reply to this conversation on ReviewNB aloctavodia commented on 2022-04-01T07:06:06Z Why is this another way of visualizing splines can be confusing if splines has not been explained before. Also can be confusing given the previous explanation that splines are local fit that are "connected at the knots", because in this example the lines are not connected.
We can simply remove this in this PR, alternatively we can keep this and I offer myself to improve this section in a future PR |
View / edit / reply to this conversation on ReviewNB aloctavodia commented on 2022-04-01T07:06:07Z Again, not sure we need this kind of comments in our examples
|
Should be good to go now. |
:::{post} Oct 8, 2021 | ||
:tags: patsy, pymc3.Deterministic, pymc3.Exponential, pymc3.Model, pymc3.Normal, regression, spline | ||
:::{post} May 6, 2022 | ||
:tags: patsy, pymc.Deterministic, pymc.Exponential, pymc.Model, pymc.Normal, regression, spline |
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.
There should not be pymc.<object>
tags anymore, that generates way too many tags that are not that useful so we decided to use https://docs.pymc.io/projects/examples/en/latest/object_index/index.html instead for this. The issue to track progress on this is #289
:category: beginner | ||
:author: Joshua Cook, Tyler James Burch | ||
:author: Joshua Cook updated by Tyler James Burch, Chris Fonnesbeck |
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 is metadata used to generate the citation advise at the bottom. It should only have names and exclude those who have only re-executed the notebooks without making changes. The Authors section should always be present and list everyone and the changes they did.
We discussed that both in an issue, in the docs channel in slack and in a couple doc meetings. Like I often say, I do not have strong feelings about what was chosen and would have been perfectly happy (or even more happy) with another choice or with changing this now. What I do have strong feelings about is that all notebooks do the same because otherwise some people don't dare add their name at all whereas others do which only increases already present inequalities. Therefore changing that would mean changing the style guide and updating all the notebooks that are already in the Done column.
Modest updates to convert to v4.
PyMC3
withPyMC
througoutModel
instantiation