Created
October 8, 2018 19:58
-
-
Save jrevels/cfd0af1e09321b0e990a552bb5fb4c88 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Basic example. | |
using Stheno | |
using Stheno: GPC | |
# Define model. | |
function gp(σ, l) | |
g = GP(EQ(), GPC()) | |
f = σ * g ∘ (x->l * x) | |
return g, f | |
end | |
x = collect(range(-5.0, stop=5.0, length=1000)); | |
# Generate toy data from prior. | |
g, f = gp(1.0, 2.0) | |
f_ = rand(f(x)) | |
function lml(θ) | |
g, f = gp(θ[1], θ[2]) | |
return logpdf(f(x), f_) | |
end | |
# Need to be able to differentiate this w.r.t. the input. | |
# Only tricky operation is the cholesky really. | |
lml([1.0, 2.0]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment