-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Added notebook and data for LGCP tutorial #4087
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 Review Jupyter notebook visual diffs & provide feedback on notebooks. Powered by ReviewNB |
Codecov Report
@@ Coverage Diff @@
## master #4087 +/- ##
=======================================
Coverage 88.48% 88.48%
=======================================
Files 88 88
Lines 13865 13865
=======================================
Hits 12268 12268
Misses 1597 1597 |
LGTM overall, some nitpicks: could you change the nested for-loop count with a |
I didn't realize there was an easy way to do it in 2D. Good idea! I've made the update. |
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 a super nice advanced use-case of GPs, thanks @ckrapu !
I think there are just a few tweaks or precisions missing, as I wrote below. It shouldn't be too long to add and feel free to ask if anything is unclear 😉
View / edit / reply to this conversation on ReviewNB AlexAndorra commented on 2020-09-09T10:14:23Z Typo: "In conjunction with a Bayesian analysis, can be used to..." -- word missing? ckrapu commented on 2020-09-10T00:20:16Z Yeah, I missed the rest of that statement. |
View / edit / reply to this conversation on ReviewNB AlexAndorra commented on 2020-09-09T10:14:24Z I think you can use more regularizing priors to improve sampling efficiency -- this is especially true for GP hyperparameters.
ckrapu commented on 2020-09-10T00:21:58Z Agreed - now that I think about it, a SD of 10 on log scale is way too wide. I'm not sure how to pick the length scale, though. I've tried using |
View / edit / reply to this conversation on ReviewNB AlexAndorra commented on 2020-09-09T10:14:25Z If you use |
View / edit / reply to this conversation on ReviewNB AlexAndorra commented on 2020-09-09T10:14:25Z
|
View / edit / reply to this conversation on ReviewNB AlexAndorra commented on 2020-09-09T10:14:26Z I think this can be fixed by more regularizing priors upstream |
View / edit / reply to this conversation on ReviewNB AlexAndorra commented on 2020-09-09T10:14:27Z You can get rid of Also, add a ";" at the end of the last line of the cell to avoid matplotlib object printing in notebooks: ckrapu commented on 2020-09-10T05:47:36Z Got it! |
View / edit / reply to this conversation on ReviewNB AlexAndorra commented on 2020-09-09T10:14:28Z Same comments on priors |
View / edit / reply to this conversation on ReviewNB AlexAndorra commented on 2020-09-09T10:14:29Z I think the last two lines diserve a bit more explanation, as this is not really a standard prior: IIUC, you're modeling the variation around marks more than marks themselves? If yes, explaining why would be interesting. Also, a line about what ckrapu commented on 2020-09-10T05:48:25Z This part didn't have to be expressed in a roundabout way; I cleaned that up. AlexAndorra commented on 2020-09-10T08:06:25Z Much clearer indeed, thanks! |
View / edit / reply to this conversation on ReviewNB AlexAndorra commented on 2020-09-09T10:14:30Z Same comment for model context |
Yeah, I missed the rest of that statement. View entire conversation on ReviewNB |
Agreed - now that I think about it, a SD of 10 on log scale is way too wide. I'm not sure how to pick the length scale, though. I've tried using View entire conversation on ReviewNB |
Got it! View entire conversation on ReviewNB |
This part didn't have to be expressed in a roundabout way; I cleaned that up. View entire conversation on ReviewNB |
Much clearer indeed, thanks! View entire conversation on ReviewNB |
Thanks for the changes @ckrapu, this looks really neat now!
Yeah, that's always (very) tricky... Prior pred checks with spaghetti plots and ribbon plots can also be useful -- I'm doing exactly that in a NB right now; the code is still very messy and WIP, but hopefully this can help you 🤷♂️ There are also prior choices in the Mauna Loa NB.
Yeah but even that isn't that great IIUC, as 1) it picks priors based on the observed data, and 2) maybe future data can inform larger interpoint distance. |
Hi @ckrapu - a new CI check has been added, before your next commit could you fetch and merge upstream/master? I'm pretty sure it will still pass, this is just to be sure |
I spoke too soon about the priors. Those changes helped a ton with the marked model as you pointed out. |
Yup! Done. |
@ckrapu looks like some of the imports are out of order, can you make the following change please? + "from itertools import product\n",
+ "\n",
"import arviz as az\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"import pandas as pd\n",
- "import pymc3 as pm\n",
- "\n",
- "from itertools import product"
+ "import pymc3 as pm" ? Or, just run
|
@MarcoGorelli is there a way to enforce this automatically in the GH action when the committer hasn't run nbqa (or, later, Black) on the NB? |
As in, can we get the GitHub Action to push to the file? Maybe...I know that pre-commit's author is working on a paid product that would allow for that, but there may be a way to do this without it, I'll look into it |
@AlexAndorra looks like it's not ready yet https://pre-commit.ci/ ...hopefully it'll be available for free for open source projects. In the meantime I guess we can ask contributors to run this themselves, or a maintainer can add a commit to their branch |
Yes, as in: contributor pushes to PR --> GH action checking imports/Black on NB fails --> GH action runs
That'd be so awesome!
Definitely -- that's already what we do so it's actually no change |
The import order is fixed. Should we assume that the import order desired by |
Thanks for updating!
just to be clear - it's |
Yep, but this was already the case (see the style guide) -- the only difference is that now it's checked automatically in CI 😉 |
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.
Merging now, as we gave it a few days 🎉 Thanks @ckrapu for this nice addition to the docs!
This may be a dumb question, but I don't see a thumbnail for this notebook in the gallery. Did I forget to set something with this PR? |
@ckrapu it should be the last plot of the NB. @ColCarroll? |
@ckrapu are you referring to the "Gaussian Process" section here https://docs.pymc.io/nb_examples/index.html ? If so, it seems that "conditional-autoregressive-model" is also missing |
Yup - I thought that putting its name in |
This PR refers to issue #4084 and adds a new notebook showing how to fit a log Gaussian Cox process using a discrete grid approximation. It also includes an extension to model marked points. A small dataset is included as well.