You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The [modelling syntax of Turing.jl](https://turinglang.org/docs/core-functionality) closely resembles the mathematical specification of a probabilistic model.
39
-
40
-
For example, the following model describes a coin flip experiment with `N` flips, where `p` is the probability of heads.
41
-
42
-
$$
43
-
\begin{align*}
44
-
p &\sim \text{Beta}(1, 1) \\
45
-
y_i &\sim \text{Bernoulli}(p) \quad \text{for } i = 1, \ldots, N
46
-
\end{align*}
47
-
$$
48
-
49
-
:::
50
-
51
-
::: {.example-code style="overflow-x: scroll;"}
52
-
```{.julia .code-overflow-scroll}
53
-
# Define the model
54
-
@model function coinflip(; N::Int)
55
-
p ~ Beta(1, 1)
56
-
y ~ filldist(Bernoulli(p), N)
57
-
end
58
-
59
-
# Condition on data
60
-
data = [0, 1, 1, 0, 1]
61
-
model = coinflip(; N = length(data)) | (; y = data)
A number of MCMC sampling algorithms are available in Turing.jl, including (but not limited to) HMC, NUTS, Metropolis–Hastings, particle samplers, and Gibbs.
101
-
102
-
Turing.jl also supports ['external samplers'](https://turinglang.org/docs/usage/external-samplers/) which conform to the AbstractMCMC.jl interface, meaning that users can implement their own algorithms.
<divclass="fs-4 fw-bold pb-1">Composability with Julia</div>
124
-
125
-
As Turing.jl models are simply Julia functions under the hood, they can contain arbitrary Julia code.
126
-
This allows users to draw on the rich numerical and scientific computing ecosystem of Julia.
127
-
128
-
In the example here, we define an [ordinary differential equations](https://turinglang.org/docs/tutorials/bayesian-differential-equations/) using the `DifferentialEquations.jl` Julia package and use it in a Turing.jl model.
0 commit comments