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

A Flux model #10

Closed
wants to merge 25 commits into from
Closed

A Flux model #10

wants to merge 25 commits into from

Conversation

rossviljoen
Copy link
Collaborator

@rossviljoen rossviljoen commented Jul 10, 2021

Adds a high level API for a model which can easily be used with Flux (although doesn't add a dependency on Flux itself).

Examples have been updated to use the model.

It should also be straightforward to adapt the model to support something like ParameterHandling.jl for use with general optimisers - this will probably be left to a future PR though.

@rossviljoen rossviljoen changed the title [WIP] A Flux model Flux models Jul 14, 2021
@rossviljoen rossviljoen changed the title Flux models A Flux model Jul 14, 2021
@rossviljoen rossviljoen marked this pull request as ready for review July 14, 2021 01:24
@rossviljoen rossviljoen mentioned this pull request Jul 14, 2021
Copy link
Member

@theogf theogf left a comment

Choose a reason for hiding this comment

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

Did not review everything in details but here are some comments.
Additionally, should we have some internal train and predict functions? We could add a dependency on Flux via Requires.jl?

src/models.jl Outdated Show resolved Hide resolved
src/utils.jl Outdated Show resolved Hide resolved
src/models.jl Outdated Show resolved Hide resolved
return m, A
end

function _init_variational_params(
Copy link
Member

Choose a reason for hiding this comment

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

Should we add a keyword argument to enforce the eltype and type of \mu and \Sigma?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I added an eltype parameter, but I can't think of a reason why you wouldn't want to use Vector / Matrix, so maybe a type parameter isn't needed?

Copy link
Member

Choose a reason for hiding this comment

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

Well in the crazy case where someone would like to use GPUs, one would need pass CuArrays but I guess they would just have to make the effort of passing their own variational parameters.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Since it's a functor, isn't it easiest to just use Flux.gpu for that after it's initialised?

@rossviljoen
Copy link
Collaborator Author

Did not review everything in details but here are some comments.
Additionally, should we have some internal train and predict functions? We could add a dependency on Flux via Requires.jl?

Training works with Flux's default training loop, so I'm not sure an internal train function would even make things much easier (besides setting defaults perhaps).

src/utils.jl Show resolved Hide resolved
Base automatically changed from base_implementation to master August 2, 2021 13:32
examples/classification.jl Outdated Show resolved Hide resolved
examples/classification.jl Outdated Show resolved Hide resolved
examples/regression.jl Outdated Show resolved Hide resolved
examples/regression.jl Outdated Show resolved Hide resolved
src/SparseGPs.jl Outdated Show resolved Hide resolved
src/models.jl Outdated Show resolved Hide resolved
src/models.jl Outdated Show resolved Hide resolved
src/models.jl Outdated Show resolved Hide resolved
src/utils.jl Outdated Show resolved Hide resolved
test/equivalences.jl Outdated Show resolved Hide resolved
@rossviljoen rossviljoen deleted the models branch August 20, 2021 21:24
@rossviljoen rossviljoen restored the models branch August 20, 2021 21:26
@rossviljoen rossviljoen reopened this Aug 20, 2021
@rossviljoen rossviljoen marked this pull request as draft October 12, 2021 15:28
@rossviljoen
Copy link
Collaborator Author

Pretty much everything useful in this PR is in the regression/classification examples already, so closing

@rossviljoen rossviljoen deleted the models branch February 27, 2022 03:32
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.

3 participants