e# Library Reference

Systems

AlgebraicInference.CanonicalForm — Type
CanonicalForm{T₁, T₂} = GaussianSystem{
    T₁,
    ZerosMatrix{Bool, Tuple{OneTo{Int}, OneTo{Int}}},
    T₂,
    ZerosVector{Bool, Tuple{OneTo{Int}}},
    Bool}

A canonical form.

source
AlgebraicInference.GaussianSystem — Method
GaussianSystem(
    P::AbstractMatrix,
    S::AbstractMatrix,
    p::AbstractVector,
    s::AbstractVector,
    σ::Real)

Construct a Gaussian system by specifying its energy function. You should set

σ  = dot(s, pinv(S) * s)
source
AlgebraicInference.CanonicalForm — Method
CanonicalForm(K::AbstractMatrix, h::AbstractVector)

Construct the canonical form

\[\mathcal{C}(K, h, g),\]

where the normalization constant $g$ is inferred from $K$ and $h$.

source
AlgebraicInference.normal — Function
normal(μ::AbstractVector, Σ::AbstractMatrix)

Construct a multivariate normal distribution with mean vector μ and covariance matrix Σ.

source
normal(μ::Real, σ::Real)

Construct a normal distribution with mean μ and standard deviation σ.

source
AlgebraicInference.kernel — Function
kernel(L::AbstractMatrix, μ::AbstractVector, Σ::AbstractMatrix)

Construct a conditional distribution of the form

\[p(Y \mid X = x) = \mathcal{N}(Lx + \mu, \Sigma).\]

source
kernel(l::AbstractVector, μ::Real, σ::Real)

Construct a conditional distribution of the form

\[p(Y \mid X = x) = \mathcal{N}(l^\mathsf{T}x + \mu, \sigma^2).\]

source
Statistics.cov — Method
cov(Σ::GaussianSystem; atol::Real=1e-8)

Get the covariance matrix of Σ.

source

Problems

AlgebraicInference.InferenceProblem — Method
InferenceProblem(
    diagram::RelationDiagram,
    hom_map::AbstractDict,
    ob_map::AbstractDict;
    hom_attr::Symbol=:name,
    ob_attr::Symbol=:junction_type,
    var_attr::Symbol=:variable
    check::Bool=true)

Construct an inference problem that performs undirected compositon.

source
CommonSolve.solve — Method
solve(
    problem::InferenceProblem,
    elimination_algorithm::EliminationAlgorithm=MinFill()
    supernode_type::SupernodeType=Node()
    architecture_type::ArchitectureType=ShenoyShafer())

Solve an inference problem. This involves several steps:

interaction graph
    ↓ elimination algorithm
elimination tree
    ↓ supernode type
join tree
    ↓ architecture type
solution

First an elimination agorithm is used to construct an elimination tree from the model's interaction graph. Then, nodes of the elimination tree are merged into supernodes, forming a join (or junction) tree. Finally, a message passing algorithm is used to compute a solution.

source
CommonSolve.init — Method
init(
    problem::InferenceProblem,
    elimination_algorithm::EliminationAlgorithm=MinFill(),
    supernode_type::SupernodeType=Node(),
    architecture_type::ArchitectureType=ShenoyShafer())

Construct a solver for an inference problem. This involves several steps:

interaction graph
    ↓ elimination algorithm
elimination tree
    ↓ supernode type
join tree

First an elimination agorithm is used to construct an elimination tree from the model's interaction graph. Then, nodes of the elimination tree are merged into supernodes, forming a join (or junction) tree.

When solve! is called on the solver, a message passing algorithm is used to compute the solution.

source

Solvers

Base.rand — Method
rand(solver::InferenceSolver{AncestralSampler()})
source
Base.rand — Method
rand(rng::AbstractRNG, solver::InferenceSolver{AncestralSampler()})
source

Elimination

Supernodes

Architectures