@@ -55,9 +55,11 @@ Observe it has three columns:
55
55
We will use a Binomial model for the data, whose success probability is parametrised by a
56
56
transformation of a GP. Something along the lines of:
57
57
$$
58
- f \sim \operatorname{GP}(0, k) \\
59
- y_j \mid f(d_j) \sim \operatorname{Binomial}(n_j, g(f(d_j))) \\
60
- g(x) := \frac{1}{1 + e^{-x}}
58
+ \begin{aligned}
59
+ f & \sim \operatorname{GP}(0, k) \\
60
+ y_j \mid f(d_j) & \sim \operatorname{Binomial}(n_j, g(f(d_j))) \\
61
+ g(x) & := \frac{1}{1 + e^{-x}}
62
+ \end{aligned}
61
63
$$
62
64
63
65
To do this, let's define our Turing.jl model:
@@ -79,10 +81,10 @@ We first define an `AbstractGPs.GP`, which represents a distribution over functi
79
81
is entirely separate from Turing.jl.
80
82
We place a prior over its variance ` v ` and length-scale ` l ` .
81
83
` f(d, jitter) ` constructs the multivariate Gaussian comprising the random variables
82
- in ` f ` whose indices are in ` d ` (+ a bit of independent Gaussian noise with variance
84
+ in ` f ` whose indices are in ` d ` (plus a bit of independent Gaussian noise with variance
83
85
` jitter ` -- see [ the docs] ( https://juliagaussianprocesses.github.io/AbstractGPs.jl/dev/api/#FiniteGP-and-AbstractGP )
84
86
for more details).
85
- ` f(d, jitter) isa AbstractMvNormal ` , and is the bit of AbstractGPs.jl that implements the
87
+ ` f(d, jitter) ` has the type ` AbstractMvNormal ` , and is the bit of AbstractGPs.jl that implements the
86
88
Distributions.jl interface, so it's legal to put it on the right-hand side
87
89
of a ` ~ ` .
88
90
From this you should deduce that ` f_latent ` is distributed according to a multivariate
@@ -145,7 +147,7 @@ this example. See Turing.jl's docs on Automatic Differentiation for more info.
145
147
using Random, ReverseDiff
146
148
147
149
m_post = m | (y=df.y,)
148
- chn = sample(Xoshiro(123456), m_post, NUTS(;adtype=AutoReverseDiff()), 1_000, progress=false)
150
+ chn = sample(Xoshiro(123456), m_post, NUTS(; adtype=AutoReverseDiff()), 1_000, progress=false)
149
151
```
150
152
151
153
We can use these samples and the ` posterior ` function from ` AbstractGPs ` to sample from the
0 commit comments