https://github.com/juliagaussianprocesses/temporalgps.jl

Fast inference for Gaussian processes in problems involving time. Partly built on results from https://proceedings.mlr.press/v161/tebbutt21a.html

https://github.com/juliagaussianprocesses/temporalgps.jl

Science Score: 36.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    2 of 8 committers (25.0%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (15.3%) to scientific vocabulary

Keywords

bayesian-inference gaussian-processes julia-language time-series

Keywords from Contributors

probabilistic-programming numeric fluxes symbolic-computation mathematical-modelling exoplanets control hybrid-differential-equations finite-volume probability-distributions
Last synced: 5 months ago · JSON representation

Repository

Fast inference for Gaussian processes in problems involving time. Partly built on results from https://proceedings.mlr.press/v161/tebbutt21a.html

Basic Info
  • Host: GitHub
  • Owner: JuliaGaussianProcesses
  • License: mit
  • Language: Julia
  • Default Branch: master
  • Homepage:
  • Size: 3.68 MB
Statistics
  • Stars: 120
  • Watchers: 3
  • Forks: 6
  • Open Issues: 12
  • Releases: 42
Topics
bayesian-inference gaussian-processes julia-language time-series
Created almost 6 years ago · Last pushed 11 months ago
Metadata Files
Readme Changelog License

README.md

TemporalGPs

CI Coverage Status ColPrac: Contributor's Guide on Collaborative Practices for Community Packages

TemporalGPs.jl is a tool to make Gaussian processes (GPs) defined using AbstractGPs.jl fast for time-series. It provides a single-function public API that lets you specify that this package should perform inference, rather than AbstractGPs.jl.

JuliaCon 2020 Talk

Installation

TemporalGPs.jl is registered, so simply type the following at the REPL: julia ] add AbstractGPs KernelFunctions TemporalGPs While you can install TemporalGPs without AbstractGPs and KernelFunctions, in practice the latter are needed for all common tasks in TemporalGPs.

Example Usage

Most examples can be found in the examples directory. In particular see the associated README.

The following is a small problem by TemporalGPs' standard. See timing results below for expected performance on larger problems.

```julia using AbstractGPs, KernelFunctions, TemporalGPs

Specify a AbstractGPs.jl GP as usual

f_naive = GP(Matern32Kernel())

Wrap it in an object that TemporalGPs knows how to handle.

f = tosde(fnaive, SArrayStorage(Float64))

Project onto finite-dimensional distribution as usual.

x = range(-5.0; step=0.1, length=10_000)

x = RegularSpacing(0.0, 0.1, 10_000) # Hack for AD. fx = f(x, 0.1)

Sample from the prior as usual.

y = rand(fx)

Compute the log marginal likelihood of the data as usual.

logpdf(fx, y)

Construct the posterior distribution over f having observed y at x.

f_post = posterior(fx, y)

Compute the posterior marginals.

marginals(f_post(x))

Draw a sample from the posterior. Note: same API as prior.

rand(f_post(x))

Compute posterior log predictive probability of y. Note: same API as prior.

logpdf(f_post(x), y) ```

Learning kernel parameters with Optim.jl, ParameterHandling.jl, and Mooncake.jl

TemporalGPs.jl doesn't provide scikit-learn-like functionality to train your model (find good kernel parameter settings). Instead, we offer the functionality needed to easily implement your own training functionality using standard tools from the Julia ecosystem. See exacttimelearning.jl.

In this example we optimised the parameters, but we could just as easily have utilised e.g. AdvancedHMC.jl in conjunction with a prior over the parameters to perform approximate Bayesian inference in them -- indeed, this is often a very good idea. We leave this as an exercise for the interested user (see e.g. the examples in Stheno.jl for inspiration).

Moreover, it should be possible to plug this into probabilistic programming framework such as Turing and Soss with minimal effort, since f(x, params.var_noise) is a plain old Distributions.MultivariateDistribution.

Performance Optimisations

There are a couple of ways that TemporalGPs.jl can represent things internally. In particular, it can use regular Julia Vector and Matrix objects, or the StaticArrays.jl package to optimise in certain cases. The default is the former. To employ the latter, just add an extra argument to the to_sde function: julia f = to_sde(f_naive, SArrayStorage(Float64)) This tells TemporalGPs that you want all parameters of f and anything derived from it to be a subtype of a SArray with element-type Float64, rather than (for example) a Matrix{Float64}s and Vector{Float64}. The decision made here can have quite a dramatic effect on performance, as shown in the graph below. For "larger" kernels (large sums, spatio-temporal problems), you might want to consider ArrayStorage(Float64) instead.

Benchmarking Results (Old)

"naive" timings are with the usual AbstractGPs.jl inference routines, and is the default implementation for GPs. "lgssm" timings are conducted using to_sde with no additional arguments. "static-lgssm" uses the SArrayStorage(Float64) option discussed above.

Gradient computations were performed using Zygote.jl, and required many custom adjoints. You should see similar results to this using Mooncake.jl or Enzyme.jl.

Relevant literature

See chapter 12 of [1] for the basics.

[1] - Särkkä, Simo, and Arno Solin. Applied stochastic differential equations. Vol. 10. Cambridge University Press, 2019.

Gotchas

  • And time-rescaling is assumed to be a strictly increasing function of time. If this is not the case, then your code will fail silently. Ideally an error would be thrown.

Owner

  • Name: Gaussian Processes for Machine Learning in Julia
  • Login: JuliaGaussianProcesses
  • Kind: organization

GitHub Events

Total
  • Create event: 8
  • Commit comment event: 4
  • Release event: 2
  • Issues event: 4
  • Watch event: 2
  • Delete event: 13
  • Issue comment event: 15
  • Push event: 13
  • Pull request event: 12
  • Fork event: 1
Last Year
  • Create event: 8
  • Commit comment event: 4
  • Release event: 2
  • Issues event: 4
  • Watch event: 2
  • Delete event: 13
  • Issue comment event: 15
  • Push event: 13
  • Pull request event: 12
  • Fork event: 1

Committers

Last synced: 9 months ago

All Time
  • Total Commits: 281
  • Total Committers: 8
  • Avg Commits per committer: 35.125
  • Development Distribution Score (DDS): 0.406
Past Year
  • Commits: 8
  • Committers: 1
  • Avg Commits per committer: 8.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Théo Galy-Fajou t****u@g****m 167
willtebbutt w****1@m****k 68
Simone Carlo Surace s****e@g****t 24
Simone Carlo Surace s****e@a****m 17
github-actions[bot] 4****] 2
andreaskoher a****h@d****k 1
Nick Robinson n****1@g****m 1
CompatHelper Julia c****y@j****g 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 31
  • Total pull requests: 102
  • Average time to close issues: about 1 year
  • Average time to close pull requests: 3 months
  • Total issue authors: 11
  • Total pull request authors: 7
  • Average comments per issue: 3.23
  • Average comments per pull request: 2.01
  • Merged pull requests: 62
  • Bot issues: 0
  • Bot pull requests: 25
Past Year
  • Issues: 1
  • Pull requests: 14
  • Average time to close issues: 3 months
  • Average time to close pull requests: 22 days
  • Issue authors: 1
  • Pull request authors: 2
  • Average comments per issue: 4.0
  • Average comments per pull request: 0.86
  • Merged pull requests: 10
  • Bot issues: 0
  • Bot pull requests: 2
Top Authors
Issue Authors
  • theogf (9)
  • willtebbutt (5)
  • andreaskoher (3)
  • simsurace (3)
  • sefffal (2)
  • XiufeiLi (1)
  • mjyshin (1)
  • azev77 (1)
  • ga72kud (1)
  • JoachimSchaeffer (1)
  • JuliaTagBot (1)
Pull Request Authors
  • willtebbutt (60)
  • github-actions[bot] (25)
  • simsurace (13)
  • theogf (12)
  • sefffal (2)
  • andreaskoher (1)
  • nickrobinson251 (1)
Top Labels
Issue Labels
bug (2) enhancement (1) good first issue (1) documentation (1) testing (1)
Pull Request Labels
needs version bump (22)

Packages

  • Total packages: 1
  • Total downloads: unknown
  • Total dependent packages: 4
  • Total dependent repositories: 0
  • Total versions: 42
juliahub.com: TemporalGPs

Fast inference for Gaussian processes in problems involving time. Partly built on results from https://proceedings.mlr.press/v161/tebbutt21a.html

  • Versions: 42
  • Dependent Packages: 4
  • Dependent Repositories: 0
Rankings
Stargazers count: 7.9%
Dependent repos count: 9.9%
Average: 14.0%
Dependent packages count: 16.6%
Forks count: 21.7%
Last synced: 6 months ago

Dependencies

.github/workflows/TagBot.yml actions
  • JuliaRegistries/TagBot v1 composite
.github/workflows/VersionVigilante_pull_request.yml actions
  • actions/checkout v1.0.0 composite
  • actions/github-script 0.3.0 composite
  • julia-actions/setup-julia latest composite
.github/workflows/cancel.yml actions
  • styfle/cancel-workflow-action 0.9.0 composite
.github/workflows/ci.yml actions
  • actions/cache v1 composite
  • actions/checkout v2 composite
  • coverallsapp/github-action master composite
  • julia-actions/julia-buildpkg v1 composite
  • julia-actions/julia-processcoverage v1 composite
  • julia-actions/julia-runtest v1 composite
  • julia-actions/setup-julia v1 composite
.github/workflows/examples.yml actions
  • actions/cache v1 composite
  • actions/checkout v2 composite
  • julia-actions/julia-buildpkg v1 composite
  • julia-actions/julia-runtest v1 composite
  • julia-actions/setup-julia v1 composite