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

Base implementation of SVGP #9

Merged
merged 69 commits into from
Jul 30, 2021
Merged

Base implementation of SVGP #9

merged 69 commits into from
Jul 30, 2021

Conversation

rossviljoen
Copy link
Collaborator

@rossviljoen rossviljoen commented Jul 10, 2021

This PR has the core implementation of stochastic variational GPs.

The approximate posterior in svgp.jl quite closely follows that in AbstractGPs. elbo.jl has the implementations of both the closed form Gaussian likelihood ELBO and quadrature for non-conjugate - I'll add other closed form likelihoods and MC estimation in other PRs.

The examples in this PR are extremely rough, and will be superseded soon, but give working examples of how to train the SVGP end to end.

@rossviljoen rossviljoen marked this pull request as ready for review July 13, 2021 21:48
Copy link
Member

@willtebbutt willtebbutt left a comment

Choose a reason for hiding this comment

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

Just a minor typo I think?

src/elbo.jl Outdated Show resolved Hide resolved
examples/classification.jl Outdated Show resolved Hide resolved
src/elbo.jl Outdated
Comment on lines 46 to 49
fx::FiniteGP{<:AbstractGP, <:AbstractVector, <:Diagonal{<:Real, <:Fill}},
y::AbstractVector{<:Real},
fz::FiniteGP,
q::AbstractMvNormal;
Copy link
Member

Choose a reason for hiding this comment

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

does this count as type piracy?

maybe we should leave this for separate discussion in an issue / future refactoring, but I'm wondering about whether it'd be helpful to have an object that contains everything needed for p(f | u) [for u=f(Z) that might be fz already, but might need to be something different for interdomain inducing variables] as well as q(u) = q]

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

I think refactoring this a little to put more information in a single object would be a good idea, but I'm happy for this to go in as-is for now.

src/elbo.jl Outdated
Comment on lines 87 to 88
f_mean, f_var = mean_and_var(post, fx.x)
variational_exp = expected_loglik(method, y, f_mean, f_var, lik)
Copy link
Member

Choose a reason for hiding this comment

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

The only reason _elbo needs fx is to access x, right? what do you think of passing x as an explicit argument and writing

Suggested change
f_mean, f_var = mean_and_var(post, fx.x)
variational_exp = expected_loglik(method, y, f_mean, f_var, lik)
variational_exp = expected_loglik(method, y, post(x), lik)
  • how would that work ?

src/elbo.jl Outdated Show resolved Hide resolved
src/svgp.jl Outdated Show resolved Hide resolved
@rossviljoen
Copy link
Collaborator Author

@st-- @willtebbutt @theogf
I'd like to merge this PR soon because it's getting pretty big - could you give it another quick review when you get the chance?

Copy link
Member

@willtebbutt willtebbutt left a comment

Choose a reason for hiding this comment

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

I'm happy with this modulo some style stuff. Please feel free to merge when you're happy.

src/elbo.jl Outdated
Comment on lines 46 to 49
fx::FiniteGP{<:AbstractGP, <:AbstractVector, <:Diagonal{<:Real, <:Fill}},
y::AbstractVector{<:Real},
fz::FiniteGP,
q::AbstractMvNormal;
Copy link
Member

Choose a reason for hiding this comment

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

I think refactoring this a little to put more information in a single object would be a good idea, but I'm happy for this to go in as-is for now.

src/elbo.jl Outdated Show resolved Hide resolved
src/elbo.jl Outdated Show resolved Hide resolved
src/elbo.jl Outdated Show resolved Hide resolved
src/svgp.jl Outdated Show resolved Hide resolved
@rossviljoen rossviljoen merged commit ffa3fa5 into master Jul 30, 2021
@rossviljoen rossviljoen deleted the base_implementation branch August 2, 2021 13:32
@rossviljoen rossviljoen mentioned this pull request Aug 25, 2021
2 tasks
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.

4 participants