e# Library Reference
Systems
AlgebraicInference.GaussianSystem — TypeGaussianSystem{T₁, T₂, T₃, T₄, T₅}A Gaussian system.
AlgebraicInference.CanonicalForm — TypeCanonicalForm{T₁, T₂} = GaussianSystem{
T₁,
ZerosMatrix{Bool, Tuple{OneTo{Int}, OneTo{Int}}},
T₂,
ZerosVector{Bool, Tuple{OneTo{Int}}},
Bool}A canonical form.
AlgebraicInference.DenseGaussianSystem — TypeDenseGaussianSystem{T} = GaussianSystem{
Matrix{T},
Matrix{T},
Vector{T},
Vector{T},
T}A Gaussian system represented by dense matrices and vectors.
AlgebraicInference.DenseCanonicalForm — TypeDenseCanonicalForm{T} = CanonicalForm{
Matrix{T},
Vector{T}}A canonical form represented by a dense matrix and vector.
AlgebraicInference.GaussianSystem — MethodGaussianSystem(
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)AlgebraicInference.CanonicalForm — MethodCanonicalForm(K::AbstractMatrix, h::AbstractVector)Construct the canonical form
\[\mathcal{C}(K, h, g),\]
where the normalization constant $g$ is inferred from $K$ and $h$.
AlgebraicInference.normal — Functionnormal(μ::AbstractVector, Σ::AbstractMatrix)Construct a multivariate normal distribution with mean vector μ and covariance matrix Σ.
normal(μ::Real, σ::Real)Construct a normal distribution with mean μ and standard deviation σ.
AlgebraicInference.kernel — Functionkernel(L::AbstractMatrix, μ::AbstractVector, Σ::AbstractMatrix)Construct a conditional distribution of the form
\[p(Y \mid X = x) = \mathcal{N}(Lx + \mu, \Sigma).\]
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).\]
Base.length — Methodlength(Σ::GaussianSystem)Get the dimension of Σ.
Statistics.cov — Methodcov(Σ::GaussianSystem; atol::Real=1e-8)Get the covariance matrix of Σ.
Distributions.invcov — Methodinvcov(Σ::GaussianSystem)Get the precision matrix of Σ.
Statistics.var — Methodvar(Σ::GaussianSystem; atol::Real=1e-8)Get the variances of Σ.
Statistics.mean — Methodmean(Σ::GaussianSystem; atol::Real=1e-8)Get the mean vector of Σ.
Problems
AlgebraicInference.InferenceProblem — TypeInferenceProblem{T₁, T₂, T₃, T₄}An inference problem.
AlgebraicInference.InferenceProblem — MethodInferenceProblem(
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.
AlgebraicInference.InferenceProblem — MethodInferenceProblem(
network::BayesNet,
query::AbstractVector,
context::AbstractDict)Construct an inference problem that queries a Bayesian network.
CommonSolve.solve — Methodsolve(
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
solutionFirst 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.
CommonSolve.init — Methodinit(
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 treeFirst 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.
Solvers
AlgebraicInference.InferenceSolver — TypeInferenceSolver{T₁, T₂, T₃, T₄, T₅}A solver for an inference problem.
CommonSolve.solve! — Methodsolve!(solver::InferenceSolver)Solve an inference problem.
Statistics.mean — Methodmean(solver::InferenceSolver{AncestralSampler()})Base.rand — Methodrand(solver::InferenceSolver{AncestralSampler()})Base.rand — Methodrand(rng::AbstractRNG, solver::InferenceSolver{AncestralSampler()})Elimination
AlgebraicInference.EliminationAlgorithm — TypeEliminationAlgorithmA graph elimination algorithm. The options are
AlgebraicInference.MaxCardinality — TypeMaxCardinality <: EliminationAlgorithmThe maximum cardinality search algorithm.
AlgebraicInference.MinDegree — TypeMinDegree <: EliminationAlgorithmThe minimum-degree heuristic.
AlgebraicInference.MinFill — TypeMinFill <: EliminationAlgorithmThe minimum-fill heuristic.
AlgebraicInference.ChordalGraph — TypeChordalGraph <: EliminationAlgorithmAn efficient algorithm for chordal graphs.
AlgebraicInference.CuthillMcKeeJL_RCM — TypeCuthillMcKeeJL_RCM <: EliminationAlgorithmThe reverse Cuthill-McKee algorithm. Uses CuthillMckee.jl.
AlgebraicInference.AMDJL_AMD — TypeAMDJL_AMD <: EliminationAlgorithmThe approximate minimum degree algorithm. Uses AMD.jl.
AlgebraicInference.MetisJL_ND — TypeMetisJL_ND <: EliminationAlgorithmThe nested dissection heuristic. Uses Metis.jl.
AlgebraicInference.ischordal — Functionischordal(graph::AbstractGraph)Determine if a graph is chordal.
Supernodes
AlgebraicInference.SupernodeType — TypeAlgebraicInference.Node — TypeNode <: SupernodeTypeThe single-vertex supernode.
AlgebraicInference.MaximalSupernode — TypeMaximalSupernode <: SupernodeTypeThe maximal supernode.
AlgebraicInference.FundamentalSupernode — TypeFundamentalSupernode <: SupernodeTypeThe fundamental supernode.
Architectures
AlgebraicInference.ArchitectureType — TypeArchitectureTypeA message-passing algorithm. The options are
There is one additional type, which you can use for sampling from a graphical model:
AlgebraicInference.ShenoyShafer — TypeShenoyShafer <: ArchitectureTypeThe Shenoy-Shafer architecture.
AlgebraicInference.LauritzenSpiegelhalter — TypeLauritzenSpiegelhalter <: ArchitectureTypeThe Lauritzen-Spiegelhalter architecture.
AlgebraicInference.HUGIN — TypeHUGIN <: ArchitectureTypeThe HUGIN architecture.
AlgebraicInference.Idempotent — TypeIdempotent <: ArchitectureTypeThe idempotent architecture.
AlgebraicInference.AncestralSampler — TypeAncestralSampler <: ArchitectureTypeA type for sampling graphical models.