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

Abstract integrator #283

Merged
merged 14 commits into from
Jun 7, 2023
Merged

Abstract integrator #283

merged 14 commits into from
Jun 7, 2023

Conversation

thomaspinder
Copy link
Collaborator

@thomaspinder thomaspinder commented May 30, 2023

Type of changes

  • Bug fix
  • New feature
  • Documentation / docstrings
  • Tests
  • Other

Checklist

  • I've formatted the new code by running poetry run pre-commit run --all-files --show-diff-on-failure before committing.
  • I've added tests for new code.
  • I've added docstrings for the new code.

Description

This PR enables users to define their own integration strategy for computing the expected log likelihood under the variational distribution.

Note: A lot of docs have been changed here as docs/api had been committed somehwere along the way. The key files that have been changed are gpjax/likelihoods.py and gpjax/integrators.py.

Issue Number: #270 #282

@thomaspinder thomaspinder added the enhancement New feature or request label May 30, 2023
@thomaspinder thomaspinder added this to the v1.0.0 milestone May 30, 2023
@thomaspinder thomaspinder self-assigned this May 30, 2023
Copy link
Member

@daniel-dodd daniel-dodd left a comment

Choose a reason for hiding this comment

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

Hey @thomaspinder, looking good. Like the structure of it. Just left a few thoughts and suggestions.

gpjax/integrators.py Outdated Show resolved Hide resolved
Comment on lines 53 to 54
gh_points, gh_weights = np.polynomial.hermite.hermgauss(self.num_points)
sd = jnp.sqrt(sigma2)
Copy link
Member

Choose a reason for hiding this comment

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

This might be a potential numerical issue to keep an eye on. If sigma2 gets sufficiently small, the gradients will explode.

gpjax/integrators.py Outdated Show resolved Hide resolved
gpjax/integrators.py Outdated Show resolved Hide resolved
gpjax/likelihoods.py Outdated Show resolved Hide resolved
gpjax/base/module.py Outdated Show resolved Hide resolved
@thomaspinder thomaspinder marked this pull request as ready for review May 31, 2023 21:06
Copy link
Member

@daniel-dodd daniel-dodd left a comment

Choose a reason for hiding this comment

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

Looks good @thomaspinder, just minor comment about docstrings, you need likelihood instead of **likelihood_params in each integrator class.

gpjax/integrators.py Outdated Show resolved Hide resolved
@daniel-dodd daniel-dodd merged commit 6408c68 into main Jun 7, 2023
@daniel-dodd daniel-dodd deleted the abstract_integrator branch June 7, 2023 19:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants