Skip to content

Global inducing points implementation#50

Draft
sebastianober wants to merge 20 commits into
developfrom
sebastian/improved-inference
Draft

Global inducing points implementation#50
sebastianober wants to merge 20 commits into
developfrom
sebastian/improved-inference

Conversation

@sebastianober

Copy link
Copy Markdown
Collaborator

Quick implementation of "global inducing" approximate posteriors for basic DGPs (see Ober and Aitchison (2021): https://arxiv.org/abs/2005.08140). TODOs:

  • Fix/better documentation
  • Write tests
  • Investigate broken Keras
  • Support for multioutput kernels + resolve GPflow kernel issue
  • Make sampling compatible with (efficient) sampling in gpflux.sampling
  • See if more GPflow functionalities can be used (e.g. conditionals)

@sebastianober sebastianober changed the title Sebastian/improved inference Global inducing points implementation Sep 10, 2021

@vdutor vdutor left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is a good draft PR. Left some comments and questions. Would be good to have a notebook to see how to use the code. A few tests (as discussed in person) will also be required. I also think the formatting is off in some places; make sure to run make format before pushing.

Comment thread gpflux/layers/gi_gp_layer.py Outdated
Comment thread gpflux/layers/gi_gp_layer.py Outdated
class GIGPLayer(tf.keras.layers.Layer):
"""
A sparse variational multioutput GP layer. This layer holds the kernel,
inducing variables and variational distribution, and mean function.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
inducing variables and variational distribution, and mean function.
inducing variables, variational distribution, and mean function.

Calculates the log probability of a zero-mean multivariate Gaussian with covariance sigma
and evaluation points X, with batching of both the covariance and X.

TODO: look into whether this can be replaced with a tfp.distributions.Distribution

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

yes, this should be possible and I would advice doing that.

from gpflux.layers import LayerWithObservations, SampleBasedGaussianLikelihoodLayer


class GIDeepGP(Module):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

There appears to be a lot of code duplication from DeepGP. Can you not inherit from DeepGP and overwrite the appropriate methods?

"""
mean_function = self.mean_function(inputs)

Kuu = self.kernel(inputs[..., :self.num_inducing, :])

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can you give some information in the form of comments how inputs is structured. What exactly are the inputs and outputs of call?

"""
Samples function values f based off samples of u.

:param u: Samples of the inducing points, shape [S, Lout, M, 1]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

what is Lout?

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.

2 participants