GPLinearODEMaker

Multivariate, linear combinations of GPs and their derivatives

https://github.com/christiangil/gplinearodemaker.jl

Science Score: 38.0%

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

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: arxiv.org, zenodo.org
  • Committers with academic emails
    1 of 7 committers (14.3%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (5.5%) to scientific vocabulary

Keywords from Contributors

exoplanets astrostatistics radial-velocities spectroscopy raytracer
Last synced: 10 months ago · JSON representation ·

Repository

Multivariate, linear combinations of GPs and their derivatives

Basic Info
Statistics
  • Stars: 5
  • Watchers: 1
  • Forks: 3
  • Open Issues: 0
  • Releases: 0
Created about 6 years ago · Last pushed about 3 years ago
Metadata Files
Readme License Citation

README.md

GPLinearODEMaker.jl

arXiv DOI

GPLinearODEMaker (GLOM) is a package for finding the likelihood (and derivatives thereof) of multivariate Gaussian processes (GP) that are composed of a linear combination of a univariate GP and its derivatives.

q_0(t) = m_0(t) + a_{00}X(t) + a_{01}\dot{X}(t) + a_{02}\ddot{X}(t)

q_1(t) = m_1(t) + a_{10}X(t) + a_{11}\dot{X}(t) + a_{12}\ddot{X}(t)

\vdots

q_l(t) = m_l(t) + a_{l0}X(t) + a_{l1}\dot{X}(t) + a_{l2}\ddot{X}(t)

where each X(t) is the latent GP and the qs are the time series of the outputs.

Here's an example using sine and cosines as the outputs to be modelled. The f, g!, and h! functions at the end give the likelihood, gradient, and Hessian, respectively.

```julia import GPLinearODEMaker; GLOM = GPLinearODEMaker

kernel, nkernhyper = GLOM.include_kernel("se")

n = 100 xs = 20 .* sort(rand(n)) noise1 = 0.1 .* ones(n) noise2 = 0.2 .* ones(n) y1 = sin.(xs) .+ (noise1 .* randn(n)) y2 = cos.(xs) .+ (noise2 .* randn(n))

ys = collect(Iterators.flatten(zip(y1, y2))) noise = collect(Iterators.flatten(zip(noise1, noise2)))

glo = GLOM.GLO(kernel, nkernhyper, 2, 2, xs, ys; noise = noise, a=[[1. 0.1];[0.1 1]]) totalhyperparameters = append!(collect(Iterators.flatten(glo.a)), [10]) workspace = GLOM.nlogLmatrixworkspace(glo, totalhyperparameters)

function f(nonzerohyper::Vector{T} where T<:Real) = GLOM.nlogLGLOM!(workspace, glo, nonzerohyper) # feel free to add priors here to optimize on the posterior! function g!(G::Vector{T}, nonzerohyper::Vector{T}) where T<:Real G[:] = GLOM.∇nlogLGLOM!(workspace, glo, nonzerohyper) # feel free to add priors here to optimize on the posterior! end function h!(H::Matrix{T}, nonzerohyper::Vector{T}) where T<:Real H[:, :] = GLOM.∇∇nlogLGLOM!(workspace, glo, nonzero_hyper) # feel free to add priors here to optimize on the posterior! end ```

You can use f, g!, and h! to optimize the GP hyperparameters with external packages like Optim.jl or Flux.jl

```julia initialx = GLOM.removezeros(total_hyperparameters)

using Optim

@time result = optimize(f, initial_x, NelderMead()) # slow or wrong

@time result = optimize(f, g!, initial_x, LBFGS()) # faster and usually right

@time result = optimize(f, g!, h!, initial_x, NewtonTrustRegion()) # fastest and usually right

fittotalhyperparameters = GLOM.reconstructtotalhyperparameters(glo, result.minimizer) ```

Once you have the best fit hyperparameters, you can easily calculate the GP conditioned on the data (i.e. the GP posterior)

```julia nsamppoints = convert(Int64, max(500, round(2 * sqrt(2) * length(glo.xobs)))) xsamp = collect(range(minimum(glo.xobs); stop=maximum(glo.xobs), length=nsamppoints)) ntotalsamppoints = nsamppoints * glo.nout nmeas = length(glo.xobs)

meanGP, σ, meanGPobs, Σ = GLOM.GPposteriors(glo, xsamp, fittotalhyperparameters; returnmean_obs=true) ```

and use Plots to visualize the results

```julia using Plots

function makeplot(output::Integer, label::String) sampleoutputindices = output:glo.nout:ntotalsamppoints obsoutputindices = output:glo.nout:length(ys) p = scatter(xs, ys[obsoutputindices], yerror=noise1, label=label) plot!(xsamp, meanGP[sampleoutputindices]; ribbon=σ[sampleoutputindices], alpha=0.3, label="GP") return p end

plot(makeplot(1, "Sin"), makeplot(2, "Cos"), layout=(2,1), size=(960,540))

```

Documentation

For more details and options, see the documentation

You can read about the first usage of this package in our paper

Also check out our companion repository which has some examples of using GLOM to fit stellar variability and planets

Installation

The most current, tagged version of GPLinearODEMaker.jl can be easily installed using Julia's Pkg

julia Pkg.add("GPLinearODEMaker")

If you would like to contribute to the package, or just want to run the latest (untagged) version, you can use the following

julia Pkg.develop("GPLinearODEMaker")

Citation

If you use GPLinearODEMaker.jl in your work, please cite the BibTeX entry given in CITATION.bib

The formula images in this README created with this website

Owner

  • Name: Christian Gilbertson
  • Login: christiangil
  • Kind: user

Citation (CITATION.bib)

@ARTICLE{2020ApJ...905..155G,
       author = {{Gilbertson}, Christian and {Ford}, Eric B. and {Jones}, David E. and {Stenning}, David C.},
        title = "{Toward Extremely Precise Radial Velocities. II. A Tool for Using Multivariate Gaussian Processes to Model Stellar Activity}",
      journal = {\apj},
     keywords = {Exoplanet detection methods, Astronomy software, Stellar activity, Gaussian Processes regression, Time series analysis, 489, 1855, 1580, 1930, 1916, Astrophysics - Instrumentation and Methods for Astrophysics, Astrophysics - Earth and Planetary Astrophysics, Astrophysics - Solar and Stellar Astrophysics},
         year = 2020,
        month = dec,
       volume = {905},
       number = {2},
          eid = {155},
        pages = {155},
          doi = {10.3847/1538-4357/abc627},
archivePrefix = {arXiv},
       eprint = {2009.01085},
 primaryClass = {astro-ph.IM},
       adsurl = {https://ui.adsabs.harvard.edu/abs/2020ApJ...905..155G},
      adsnote = {Provided by the SAO/NASA Astrophysics Data System}
}

GitHub Events

Total
Last Year

Committers

Last synced: over 3 years ago

All Time
  • Total Commits: 85
  • Total Committers: 7
  • Avg Commits per committer: 12.143
  • Development Distribution Score (DDS): 0.541
Top Committers
Name Email Commits
Chistian Gilbertson c****n@g****m 39
Chistian Gilbertson 3****l@u****m 20
christiangil c****n@g****m 20
Eric Ford e****d@p****u 2
github-actions[bot] 4****]@u****m 2
CompatHelper Julia c****y@j****g 1
Eric Ford e****d@u****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 12 months ago

All Time
  • Total issues: 2
  • Total pull requests: 8
  • Average time to close issues: about 2 hours
  • Average time to close pull requests: 30 days
  • Total issue authors: 2
  • Total pull request authors: 3
  • Average comments per issue: 8.0
  • Average comments per pull request: 0.13
  • Merged pull requests: 6
  • Bot issues: 0
  • Bot pull requests: 5
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • elnjensen (1)
  • JuliaTagBot (1)
Pull Request Authors
  • github-actions[bot] (5)
  • christiangil (2)
  • eford (1)
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads: unknown
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 13
juliahub.com: GPLinearODEMaker

Multivariate, linear combinations of GPs and their derivatives

  • Versions: 13
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 9.9%
Forks count: 28.1%
Average: 31.4%
Dependent packages count: 38.9%
Stargazers count: 48.5%
Last synced: 11 months ago

Dependencies

.github/workflows/Documenter.yml actions
  • actions/checkout v2 composite
  • julia-actions/setup-julia latest composite
.github/workflows/TagBot.yml actions
  • JuliaRegistries/TagBot v1 composite