## Sigma.jl

Sigma is a probabilistic programming environment implemented in Julia
Popularity
65 Stars
Updated Last
10 Months Ago
Started In
October 2014

# Sigma

Sigma is a probabilistic programming environment implemented in Julia. You can use it to specify probabilistic models as normal Julia programs, and perform inference. # Installation

Sigma is built on top of Julia. Sigma currently runs on linux only. Sigma is currently highly unstable, beware. Install from a REPL with

`Pkg.add("Sigma")`

Sigma is then loaded with

`using Sigma`

# Usage

Read the documentation, look at the examples, or see the quick start below.

# Quick Start

First we need to include Sigma

`julia> using Sigma`

Then, we create a uniform distribution `x` and draw 100 samples from it using `rand`:

```julia> x = uniform(0,1)
RandVar{Float64}

julia> rand(x, 100)
100-element Array{Float64,1}:
0.376264
0.492391
...```

Then we can find the probability that `x^2` is greater than 0.6:

```julia> prob(x^2 > 0.6)
[0.225463867187499 0.225463867187499]```

Then we can introduce an exponentially distributed variable `y`, and find the probability that `x^2` is greater than 0.6 under the condition that the sum of `x` and `y` is less than 1

```julia> y = exponential(0.5)
julia> prob(x^2 > 0.6, x + y < 1)
[0.053548951048950494 0.06132144691466614]```

Then, instead of computing conditional probabilities, we can sample from `x` under the same condition:

```julia> rand(x, x + y < 1)
0.04740462764340371```