Skip to content

Commit 3f8d59f

Browse files
committed
delete whatever i wrote
1 parent 9945107 commit 3f8d59f

File tree

1 file changed

+1
-130
lines changed

1 file changed

+1
-130
lines changed

index.qmd

Lines changed: 1 addition & 130 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ description: |
1313

1414
::: {.panel}
1515
##### Expressive {.panel-title .pb-1}
16-
Turing models are easy to write and communicate.
16+
Turing models are easy to write and communicate, with syntax that is close to the mathematical specification of the model.
1717
:::
1818

1919
::: {.panel}
@@ -26,135 +26,6 @@ Turing supports models with discrete parameters and stochastic control flow.
2626
Turing is written entirely in Julia, and is interoperable with its powerful ecosystem.
2727
:::
2828

29-
:::::
30-
31-
32-
::::: {.d-flex .flex-row .flex-wrap .panel-wrapper .gap-3 .pb-2}
33-
34-
::: {.example-text style="text-align:right;padding:0.5rem;"}
35-
36-
<div class="fs-4 fw-bold pb-1">Intuitive syntax</div>
37-
38-
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)
62-
```
63-
:::
64-
65-
:::::
66-
67-
::::: {.d-flex .flex-row-reverse .flex-wrap .panel-wrapper .gap-3 .pt-2 .section-end-space}
68-
69-
::: {.example-text style="padding:0.5rem;"}
70-
71-
<div class="fs-4 fw-bold pb-1">Flexible parameter inference</div>
72-
73-
Turing.jl provides full support for sampling one or more MCMC chains from the posterior distribution, including options for parallel sampling.
74-
75-
Variational inference and point estimation methods are also available.
76-
77-
:::
78-
79-
::: {.example-code style="overflow-x: scroll;"}
80-
```{.julia .code-overflow-scroll}
81-
# Sample one chain
82-
chain = sample(model, NUTS(), 1000)
83-
84-
# Sample four chains, one per thread
85-
# Note: to obtain speedups, Julia must be started
86-
# with multiple threads enabled, e.g. `julia -t 4`
87-
chains = sample(model, NUTS(), MCMCThreads(), 1000, 4)
88-
```
89-
:::
90-
91-
:::::
92-
93-
94-
::::: {.d-flex .flex-row .flex-wrap .panel-wrapper .gap-3 .pb-2}
95-
96-
::: {.example-text style="text-align:right;padding:0.5rem;"}
97-
98-
<div class="fs-4 fw-bold pb-1">MCMC sampling algorithms</div>
99-
100-
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.
103-
104-
:::
105-
106-
::: {.example-code style="overflow-x: scroll;"}
107-
```{.julia .code-overflow-scroll}
108-
sample(model, NUTS(), 1000)
109-
110-
sample(model, MH(), 1000)
111-
112-
using SliceSampling
113-
sample(model, externalsampler(SliceSteppingOut(2.0)), 1000)
114-
```
115-
:::
116-
117-
:::::
118-
119-
::::: {.d-flex .flex-row-reverse .flex-wrap .panel-wrapper .gap-3 .pt-2 .section-end-space}
120-
121-
::: {.example-text style="padding:0.5rem;"}
122-
123-
<div class="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.
129-
130-
:::
131-
132-
::: {.example-code style="overflow-x: scroll;"}
133-
```{.julia .code-overflow-scroll}
134-
# Define the system of equations
135-
using DifferentialEquations
136-
function lotka_volterra(du, u, params, t)
137-
α, β, δ, γ = params
138-
x, y = u
139-
du[1] = (α * x) - (β * x * y)
140-
du[2] = (δ * x * y) - (γ * y)
141-
end
142-
prob = ODEProblem(lotka_volterra, ...)
143-
144-
# Use it in a model
145-
@model function fit_lotka_volterra()
146-
# Priors on ODE parameters
147-
α ~ Normal(0, 1) # and others...
148-
# Solve the ODE
149-
predictions = solve(prob, Tsit5(); params=(α, ...))
150-
# Calculate likelihood
151-
data ~ Poisson.(predictions, ...)
152-
end
153-
```
154-
:::
155-
156-
:::::
157-
15829
{{< include _includes/news.qmd >}}
15930

16031
```{=html}

0 commit comments

Comments
 (0)