GraphPPL.jl

DSL for probabilistic models specification and probabilistic programming.
Author ReactiveBayes
Popularity
31 Stars
Updated Last
4 Months Ago
Started In
July 2020

GraphPPL

Documentation Build Status Coverage
DOI Codecov

GraphPPL.jl is a probabilistic programming language focused on probabilistic graphical models. GraphPPL.jl materializes a probabilistic model as a factor graph and provides a set of tools for model specification. GraphPPL.jl is a part of the RxInfer ecosystem, but it does not explicitly depend on any inference backend. GraphPPL exports a high-level DSL for model specification and allows users to append arbitrary information to nodes in the model. This information can be used by inference backends to perform inference on the model.

Installation

To install GraphPPL.jl, you can use the Julia package manager. From the Julia REPL, type ] to enter the Pkg REPL mode and run:

pkg> add GraphPPL

Model Specification in GraphPPL

GraphPPL.jl provides a high-level DSL for model specification. The DSL is based on the Julia's macro system and allows users to specify probabilistic models in a concise and intuitive way. The DSL is based on the following principles:

  • Model specification should read as a Julia program. GraphPPL.jl introduces the ~ syntax for model specification.
  • Any GraphPPL model is a valid submodel. GraphPPL.jl allows users to specify models as a composition of submodels. This allows users to reuse models and specify complex models in a modular way.
  • Model specification should be extensible. GraphPPL.jl allows users to extend the DSL with custom model specification procedures. This allows developers of inference backend to inject desired behavior to the model specification process.

To achieve tihs, GraphPPL.jl specifies a protocol for the @model macro:

@model function beta_bernoulli(x)
    θ ~ Beta(1, 1)
    for i in eachindex(x)
        x[i] ~ Bernoulli(θ)
    end
end

Inference Backend

GraphPPL.jl does not export any Bayesian inference backend. It provides a complex DSL parser, model generation, constraints specification and meta specification helpers. To run inference on generated models a user needs to have a Bayesian inference backend with GraphPPL.jl support (e.g. RxInfer.jl).

Documentation

For more information about GraphPPL.jl please refer to the documentation.

Note

GraphPPL.jl API has been changed in version 4.0.0. See Migration Guide for more details.

License

MIT License Copyright (c) 2021-2024 BIASlab, 2024-present ReactiveBayes

Used By Packages