Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/just-cameron/TuringTest.
Something went wrong. Try again.
---
title: Public API
permalink: /docs/library/
excerpt: "How to quickly install and setup Minimal Mistakes for use with GitHub Pages."
last_modified_at: 2018-07-19T11:31:38-04:00
redirect_from:
- /theme-setup/
toc: true
---
<a id='Function-Documentation-1'></a>
# Function Documentation
<a id='Modelling-1'></a>
## Modelling
<a id='Turing.@model' href='#Turing.@model'>#</a>
**`Turing.@model`** — *Macro*.
```
@model(name, fbody)
```
Macro to specify a probabilistic model.
Example:
```julia
@model Gaussian(x) = begin
s ~ InverseGamma(2,3)
m ~ Normal(0,sqrt.(s))
for i in 1:length(x)
x[i] ~ Normal(m, sqrt.(s))
end
return (s, m)
end
```
Compiler design: `sample(fname(x,y), sampler)`.
```julia
fname(x=nothing,y=nothing; compiler=compiler) = begin
ex = quote
# Pour in kwargs for those args where value != nothing.
fname_model(vi::VarInfo, sampler::Sampler; x = x, y = y) = begin
vi.logp = zero(Real)
# Pour in model definition.
x ~ Normal(0,1)
y ~ Normal(x, 1)
return x, y
end
end
return Main.eval(ex)
end
```
<a target='_blank' href='https://github.com/cpfiffer/Turing.jl/blob/337864f8aee1734befb283b73d167b912e8718ad/src/core/compiler.jl#L177-L212' class='documenter-source'>source</a><br>
---
<a id='Turing.@~' href='#Turing.@~'>#</a>
**`Turing.@~`** — *Macro*.
```
macro: @~ var Distribution()
```
Tilde notation macro. This macro constructs Turing.observe or Turing.assume calls depending on the left-hand argument. Note that the macro is interconnected with the @model macro and assumes that a `compiler` struct is available.
Example:
```julia
@~ x Normal()
```
<a target='_blank' href='https://github.com/cpfiffer/Turing.jl/blob/337864f8aee1734befb283b73d167b912e8718ad/src/core/compiler.jl#L97-L109' class='documenter-source'>source</a><br>
<a id='Samplers-1'></a>
## Samplers
<a id='Turing.Sampler' href='#Turing.Sampler'>#</a>
**`Turing.Sampler`** — *Type*.
…