-
Notifications
You must be signed in to change notification settings - Fork 26
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
Example using Turing + Stheno #140
Comments
Hmmm looks like I need to update how some of Stheno's internals are implemented. Will open a PR and add this example to our tests. |
Is there any workaround at the moment? Maybe somewhat similar to your example with Soss.jl as described in the docs. No pressure though :) |
Hey, sorry for the delay with this. I'm a bit swamped, so I can't promise I'll be able to work on it any time soon :( IIRC there were more things preventing me making this work that I had initially anticipated. |
With Stheno 0.7 this issue seems to be solved. For completeness, here is modified example from above: using Turing
using Distributions
using Random
using Stheno
using AbstractGPs
# make some fake data
l = 0.4
σ² = 1.3
σ²_n = 0.05 # noise
x_ = collect(range(-4.0, 4.0; length=100))
k = σ²*transform(Matern52Kernel(), 1/l)
f = GP(k)
fx = f(x_,σ²_n)
y_ = rand(fx)
# prior model
@model gp0(y,x) = begin
# priors
σ² ~ LogNormal(0, 1)
l ~ LogNormal(0, 1)
σ²_n ~ LogNormal(0, 1)
k = σ²*transform(Matern52Kernel(), 1/l)
gp = GP(k)
y ~ gp(x,σ²_n + 1e-3)
end
# sample from posterior
m = gp0(y_, x_)
chain = sample(m, HMC(0.01, 100), 1000)
using StatsPlots
chain = chain[200:end, :, :]
plot(chain) |
I was trying to put together a simple example using Stheno and Turing. Based on other examples I thought the below would work but I am getting an error about a missing method. Any ideas what is going wrong? I'm using Julia 1.5.2, Stheno v0.6.15 and Turing v0.14.10.
Resulting error message:
Thanks for any help - really like the package.
The text was updated successfully, but these errors were encountered: