**Jaynes.jl** (Jaynes) is a domain-specific compiler for the generative function interface of Gen.jl^{[1]}. The modeling language is (mostly) all of Julia.

```
jmodel = @jaynes function model()
z = ({:z} ~ Bernoulli(0.5))
if z
m1 = ({:m1} ~ Gamma(1, 1))
m2 = ({:m2} ~ Gamma(1, 1))
else
m = ({:m} ~ Gamma(1, 1))
(m1, m2) = (m, m)
end
{:y1} ~ Normal(m1, 0.1)
{:y2} ~ Normal(m2, 0.1)
end
```

The interfaces between Julia code and modeling code is intentionally kept very minimal.

```
function model()
z = trace(:z, Bernoulli(0.5))
if z
m1 = trace(:m1, Gamma(1, 1))
m2 = trace(:m2, Gamma(1, 1))
else
m = trace(:m, Gamma(1, 1))
(m1, m2) = (m, m)
end
y1 = trace(:y1, Normal(m1, 0.1))
y2 = trace(:y2, Normal(m2, 0.1))
end
jmodel = JFunction(model)
```

This package is in open alpha. Expect some bumps, especially as new compiler interfaces stabilize in Julia

`VERSION`

> 1.6.

[1] | Roughly, this interface describes the set of capabilities which, when implemented for a model class, allows for the construction of customizable sampling-based inference algorithms. This idea originally appeared under stochastic procedure interface in Venture. |

© McCoy R. Becker. Last modified: November 26, 2020. Website built with Franklin.jl.