Skip to content

Commit

Permalink
Updated README and a docstring.
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelsonric committed Jun 5, 2023
1 parent bf8ae84 commit 9019d9f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,11 @@ These wiring diagrams look a lot like
is that wiring diagrams can contain half-edges, which specify which variables are
marginalized out during composition. Hence, a wiring diagram can be thought of as an
*inference problem*: a graphical model paired with a query.

## Message Passing

Bayesian inference problem on large graphs are often solved using
[message passing](https://en.wikipedia.org/wiki/Belief_propagation). AlgebraicInference.jl
can compose large numbers of Gaussian systems by translating undirected wiring diagrams into
inference problems over a [valuation algebra](https://en.wikipedia.org/wiki/Information_algebra).
These problems can then be solved using generic inference algorithms.
16 changes: 6 additions & 10 deletions src/valuations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ struct IdentityValuation{T} <: Valuation{T} end

"""
LabeledBox{T₁, T₂} <: Valuation{T₁}
A filler for a box in an undirected wiring diagram, labeled with the junctions to which the
box is incident.
"""
struct LabeledBox{T₁, T₂} <: Valuation{T₁}
labels::Vector{T₁}
Expand Down Expand Up @@ -143,21 +146,14 @@ end
"""
inference_problem(wd::UndirectedWiringDiagram, boxes::AbstractVector)
Let ``f`` be an operation in **Cospan** of the form
Translate an undirected wiring diagram
```math
B \\xleftarrow{\\mathtt{box}} P \\xrightarrow{\\mathtt{junc}} J
\\xleftarrow{\\mathtt{junc'}} Q
```
and ``(b_1, \\dots, b_n)`` a sequence of fillers for the boxes in ``f``. Then
`inference_problem(wd, boxes)` constructs a knowledge base
``\\{\\phi_1, \\dots, \\phi_n\\}`` and query ``x \\subseteq J`` such that
```math
(\\phi_1 \\otimes \\dots \\otimes \\phi_n)^{\\downarrow x} \\cong
F(f)(b_1, \\dots, b_n),
```
where ``F`` is the **Cospan**-algebra computed by `oapply`.
into an inference problem in a valuation algebra.
The operation ``f`` must satify must satisfy the following constraints:
The diagram must satisfy the following constraints:
- ``\\mathtt{junc'}`` is injective.
- ``\\mathtt{image}(\\mathtt{junc'}) \\subseteq \\mathtt{image}(\\mathtt{junc})``
- For all ``x, y \\in P``, ``\\mathtt{box}(x) = \\mathtt{box}(y)`` and
Expand Down

0 comments on commit 9019d9f

Please sign in to comment.