An open API service indexing awesome lists of open source software.

https://github.com/stecrotti/beliefpropagation.jl

The Belief Propagation approximation for probability distributions on sparse graphs
https://github.com/stecrotti/beliefpropagation.jl

belief-propagation graphical-models inference markov-random-fields stat-mech

Last synced: 8 months ago
JSON representation

The Belief Propagation approximation for probability distributions on sparse graphs

Awesome Lists containing this project

README

          

# BeliefPropagation
[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://stecrotti.github.io/BeliefPropagation.jl/stable/)
[![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://stecrotti.github.io/BeliefPropagation.jl/dev/)
[![Build Status](https://github.com/stecrotti/BeliefPropagation.jl/actions/workflows/CI.yml/badge.svg?branch=main)](https://github.com/stecrotti/BeliefPropagation.jl/actions/workflows/CI.yml?query=branch%3Amain)
[![Coverage](https://codecov.io/gh/stecrotti/BeliefPropagation.jl/graph/badge.svg?token=KjSnA3UPCt)](https://codecov.io/gh/stecrotti/BeliefPropagation.jl)
[![Aqua](https://raw.githubusercontent.com/JuliaTesting/Aqua.jl/master/badge.svg)](https://github.com/JuliaTesting/Aqua.jl)

This package implements a generic version of the [Belief Propagation](https://en.wikipedia.org/wiki/Belief_propagation) (BP) algorithm for the approximation of probability distributions factorized on a graph
```math
\begin{equation}
p(x_1,x_2,\ldots,x_n) \propto \prod_{a\in F} \psi_a(\underline{x}_a) \prod_{i\in V} \phi_i(x_i)
\end{equation}
```
where $F$ is the set of factors, $V$ the set of variables, and $\underline{x}_a$ is the set of variables involved in factor $a$.

## Installation
```julia
import Pkg; Pkg.add("BeliefPropagation")
```

## Quickstart
Check out the [examples](https://github.com/stecrotti/BeliefPropagation.jl/tree/main/examples) folder.

## Overview
The goal of this package is to provide a simple, flexible, and ready-to-use interface to the BP algorithm. It is enough for the user to provide the factor graph (encoded in an adjacency matrix or as a [Graphs.jl](https://github.com/JuliaGraphs/Graphs.jl) graph) and the factors, everything else is taken care of.

At the same time, the idea is that refinements can be made to improve performance on a case-by-case basis. For example, messages are stored as `Vector`s by default, but when working with binary variables, one real number is enough, allowing for considerable speed-ups (see the [Ising](https://github.com/stecrotti/BeliefPropagation.jl/blob/9cbc01d6bbd0266531d6047482b8617bb6eb71ab/src/Models/ising.jl#L56) example).
Also, a version of BP for continuous variables such as Gaussian BP can be introduced in the framework, although it is not yet implemented.

## See also
- [BeliefPropagation.jl](https://github.com/ArtLabBocconi/BeliefPropagation.jl): implements BP for the Ising model and the matching problem.
- [FactorGraph.jl](https://github.com/mcosovic/FactorGraph.jl): implements Gaussian BP and other message-passing algorithms.
- [ITensorNetworks.jl](https://github.com/ITensor/ITensorNetworks.jl): implements BP as a technique for approximate tensor network contraction.
- [ReactiveMP.jl](https://github.com/ReactiveBayes/ReactiveMP.jl): allows to solve Bayesian inference problems using message-passing.
- [CodingTheory](https://github.com/esabo/CodingTheory/blob/93505402aa1add7d8bb5f06bce24f9fd2bd6a560/src/LDPC/MP_decoders.jl): has a specialized implementation of BP for the coding problem