Skip to content
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

HSGP Tutorial -- Advanced use-cases #668

Merged
merged 8 commits into from
Jul 4, 2024
Merged

HSGP Tutorial -- Advanced use-cases #668

merged 8 commits into from
Jul 4, 2024

Conversation

AlexAndorra
Copy link
Collaborator

@AlexAndorra AlexAndorra commented Jun 12, 2024

Second part of the HSGP tutorial with @bwengals 🍾
Ready to review folks!

PS: Also took the opportunity to improve the formatting of the intro of the Basic HSGP NB, but that's the only change there


📚 Documentation preview 📚: https://pymc-examples--668.org.readthedocs.build/en/668/

@AlexAndorra AlexAndorra self-assigned this Jun 12, 2024
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@twiecki
Copy link
Member

twiecki commented Jun 13, 2024

Just skimmed but the plots are a true beauty!

@ricardoV94
Copy link
Member

Just skimmed but the plots are a true beauty!

You were not wrong!

@fonnesbeck
Copy link
Member

I have concerns about the out-of-sample prediction in Example1. All that is going on there is that the GP is quickly reverting to the mean function (i.e. zero) as soon as it leaves the range of the observed data. Its not providing anything insightful out of sample, as far as I can tell. This is fine, but the narrative has to reinforce that. There is a lot of good supporting text at the start of each example, but much less supporting the results. This is an instance where it needs to be explained pretty well, or the reader will be mislead (unless they already understand GPs well). I think the only way you can get something interesting out-of-sample there is to have a second covariance function with a much longer lengthscale so that it is not immediately deferring to the prior. Let me know what you think.

@bwengals
Copy link
Collaborator

We should also add @ferrine as an author (if he's OK with that). He came up with the hierarchical model.

@bwengals
Copy link
Collaborator

RE what you said @fonnesbeck, that's definitely true. HSGPs are additive, so you can do:

cov = cov1 + cov2
gp = pm.gp.HSGP(m=m, c=c, cov_func=cov)

This can speeds things up because the two GPs share the same basis. Maybe this is a good opportunity to demonstrate this?

@ferrine
Copy link
Member

ferrine commented Jun 19, 2024

Yes, I'm happy to co author

@AlexAndorra
Copy link
Collaborator Author

AlexAndorra commented Jul 1, 2024

@fonnesbeck: @bwengals and I improved the hierarchical example, to take your feedback into account. Mainly:

  • Implemented an additive HSGP on the mean GP, which makes for better out-of-sample predictions and an even more interesting example, code-wise
  • Tweaked the data generating process to increase the diversity between the offset GPs, to make them more distinguishable

I think we're in a great position now, so feel free to merge if that looks good to you 🥳

@AlexAndorra AlexAndorra requested a review from OriolAbril July 1, 2024 21:54
Copy link
Collaborator

@bwengals bwengals left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this turned out really great. Thanks Alex!!

Copy link

review-notebook-app bot commented Jul 4, 2024

View / edit / reply to this conversation on ReviewNB

fonnesbeck commented on 2024-07-04T19:49:01Z
----------------------------------------------------------------

The intervals don't look quite right here. Plotting issue?


AlexAndorra commented on 2024-07-04T19:53:27Z
----------------------------------------------------------------

No that's because the true GP is randomly centered around -5, while the prior is centered on 0; and at the same time I'm sharing the y-axis on the plot

Copy link
Collaborator Author

No that's because the true GP is randomly centered around -5, while the prior is centered on 0; and at the same time I'm sharing the y-axis on the plot


View entire conversation on ReviewNB

@AlexAndorra AlexAndorra merged commit 5f718dc into main Jul 4, 2024
2 checks passed
@AlexAndorra AlexAndorra deleted the hsgp-advanced branch July 4, 2024 20:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants