AlgebraicInference.jl

Build Status Dev Docs Code Coverage

AlgebraicInference.jl is a library for performing Bayesian inference on wiring diagrams, building on Catlab.jl. See the documentation for example notebooks and an API.

How to Use

using AlgebraicInference
using Catlab.Programs

wd = @relation (X,) where (X::m, Y::n) begin
    prior(X)
    likelihood(X, Y)
    evidence(Y)
end

hom_map = Dict{Symbol, DenseGaussianSystem{Float64}}(
    :prior => normal(0, 1),           # p(X) = N(0, 1)
    :likelihood => kernel([1], 0, 1), # p(Y | X = x) = N(x, 1)
    :evidence => normal(2, 0))        # Y = 2

ob_map = Dict(
    :m => 1, # X ∈ ℝ¹
    :n => 1) # Y ∈ ℝ¹

problem = InferenceProblem(wd, hom_map, ob_map)

Σ = solve(problem)

inference