Which operations can be done with beliefs, and where each one lives. The organising principle: an operation between variables is a factor, and the operation on beliefs is that factor’s message, one per polarity. Today only pooling (
combine) exists, and only partially. This note lists the rest, what each needs, the order in which to build them, and where they should live (§6).
Sources: Loeliger, An introduction to factor graphs, IEEE Signal Processing Magazine 2004; Loeliger, Dauwels, Hu, Korl, Ping & Kschischang, The factor graph approach to model-based signal processing, Proc. IEEE 2007 (message tables for equality, addition and matrix nodes); Minka, Expectation Propagation for approximate Bayesian inference, UAI 2001; Fritz, A synthetic approach to Markov kernels, conditional independence and theorems on sufficient statistics, Adv. Math. 2020 (Markov categories); code:
Mycelium/messages.jl(combine),LenticulumCore/open_model.jl(pushforward)Bibliography: Loeliger 2004 · Loeliger et al. 2007 · Minka 2001 · Fritz 2020
Theory (CT-ML wiki): Markov Category · Bayesian Inversion · Bayesian Lens
1. Operations are factors
In a Forney-style factor graph a variable is a wire and everything else is a factor (Everything is a Factor). So “add two beliefs”, “mix two beliefs” or “x implies y” is not an operation on the graph’s variables; it is a factor connecting them, and what happens to the beliefs is the message that factor sends.
A factor sends a different message for each choice of output, which is Lenticulum’s polarity (Channels and Polarity). Take the addition factor :
| polarity | message | operation on beliefs |
|---|---|---|
| convolution | ||
| deconvolution (correlation) | ||
| the same, with and swapped |
The “operation” is one relation; the three operations on beliefs are its three readings. That is the same move the implicit learners make for learned relations, applied to the building blocks.
2. The catalogue
| operation | as a factor | on beliefs | Gaussian | Dirac | Sample | status |
|---|---|---|---|---|---|---|
| identification | equality node; the copy map of a Markov category | product of the incoming beliefs | exact | absorbing | needs densities | implicit: a variable node is an equality node |
| fusion (pooling) | the variable node | product of densities, normalised | add | absorbing | importance reweighting | combine: Gaussian, Dirac, Trivial, categorical; samples reweighted by any density; mixtures componentwise (Beliefs) |
| addition, linear maps | linear factor | convolution / deconvolution | exact | shift | pairwise sums (forward) | Gaussian through the linear factors only |
| deterministic function | function factor | forward: pushforward; backward: inversion | linearised or unscented | exact | exact forward | forward pushforward; backward is the implicit learners’ job |
| mixture | factor with a categorical switch , | weighted sum of components | a Gaussian mixture | a weighted point set | union with weights | MixtureBelief (Mixture Belief): density, products, reduce_mixture; the switch factor itself is not built |
| marginalisation | delete a wire (the delete map) | integrate out | drop blocks | drop coordinates | drop coordinates | Gaussian only, inside the linear-Gaussian code |
| conditioning | clamp | restrict and renormalise | Schur complement | reweight | Gaussian only | |
| logic: implication, AND, OR, XOR | factor on Bernoulli variables | discrete sum-product | beliefs exist (Categorical Belief); the logic factors are not built | |||
| projection onto a family | moment matching | the nearest Gaussian in | identity | degenerate | sample moments | moment_match for samples and Gaussian mixtures; an EP outcome factor is not built |
| tempering , division | power EP, cavity distributions, counting numbers | scale / subtract natural parameters | exact | missing as operations; counting_number in Mycelium already assumes them | ||
| composition with a kernel | transition factor (a random walk in time) | Chapman–Kolmogorov | exact for linear-Gaussian | propagate particles | Gaussian through the linear factors | |
| max instead of sum | the semiring | max-product: MAP rather than marginals | same algebra, different meaning | natural | not a separate mode; point inference already behaves this way |
3. The categorical reading
Copy, delete, tensor and composition are the structure of a Markov category: they exist for every belief type that is a probability measure, and they compose freely. Mixture is the convex structure of the distribution monad. Fusion is different: the product of two densities is not a morphism of the Markov category but conditioning, a Bayesian inversion (Inversions and Bayesian Lenses). That is why it is the one operation that is partial, needs densities, and can fail (two contradictory Diracs). Everything else in the catalogue is easy in principle; fusion and projection are where the approximations live.
4. What to build, by what it unlocks
Status: items 1–3 are built (categorical and mixture beliefs, densities, sample
reweighting, mixture products and reduction, moment_match, and the first non-Gaussian
factor with Gaussian messages, LikelihoodFactor); item 4 and the relocation of
§6 are not.
belief_logdensitybeyond Gaussians, and moment projection (EP). Pooling of Sample beliefs (densities exist for Gaussians only, Beliefs), and the first non-Gaussian factor whose messages stay Gaussian: built asLikelihoodFactor, a latent Gaussian observed through a Poisson, bivariate-Poisson or ordinal-probit likelihood, with Laplace and EP messages and a predictive over the discrete outcomes (likelihood).- A mixture belief. The important one for the implicit learners: today point inference returns one branch of a multivalued relation (Inference Signatures §3). A mixture holds both, e.g. the circle’s or the robot arm’s elbow up and down. The cost is combinatorial growth under products, so it comes with merging and pruning, as in Gaussian-sum filters.
- Bernoulli and categorical beliefs. Logic factors, and switch variables: “is this enzyme active?” (Metabolomics and Proteomics) is a Bernoulli latent that turns a reaction on or off, and the mixture factor’s switch is a categorical.
- Addition and linear maps for Sample and Dirac beliefs. Bookkeeping, but it lets the particle path compose with the linear factors.
Each item is a belief type or a message rule, not a change to the graph machinery: combine
dispatches on belief types, and a factor’s messages are its inversions
(Messages are Inversions), so the catalogue extends by adding methods.
5. The nearest existing implementation
RxInfer.jl (and ForneyLab.jl before it) implements exactly such message rules, per node type and distribution family, including mixtures, addition and equality nodes (Related Julia Projects §5). Its rules are the reference to check against; what this project adds is that the factors themselves can be learned relations queried in any polarity. Using it as the engine, and what that would gain and lose, is in RxInfer as a Backend.
6. Interop and package layout (for later)
Where the beliefs live was the real constraint, and step 1 below is done (October 2026).
All six belief types, GaussianBelief included, are now in LenticulumCore; their rules
(combine, densities, entropy, products, and mixture reduction reduce_mixture) are in
Mycelium; only the projection moment_match and kl_divergence stay in the top-level package. The
diffusion factors use it at once: laplace_belief, implicit_mixture, and Gaussian messages
from ImplicitProx(…; message = :gaussian) (implicit_factor §5).
The plan:
-
One low layer for all beliefs and their algebra — done, as
LenticulumCore(types) plusMycelium(rules). Every factor package can now produce and consume every belief type. -
Connectors as package extensions on that layer, not as a second graph package. The first one exists:
as_distribution/as_beliefto and from the BayesBase / ExponentialFamily / Distributions types RxInfer uses, for all six belief types (interop, RxInfer as a Backend §4). Still open from the table below:connector (Distributions.jl extension) what it enables SampleBelief(rng, d::Distribution, n)any distribution as a particle belief GaussianBelief(::MvNormal), and back toMvNormalCanoninterop with the ecosystem belief densities through logpdfdensities beyond Gaussians, hence pooling of particle beliefs by importance reweighting (§4, item 1) fit(Family, ::SampleBelief)infer a distribution from particles: projection onto a family, the EP step A later ExponentialFamily.jl / BayesBase.jl extension could lend
combinetheir closed-form products (prodwithClosedProd), the most developed product rules in Julia. -
Split
Myceliuminto a core and a full package only if the graph machinery itself acquires heavy dependencies. Today it does not, and extensions cover the connectors.
Other Julia belief representations worth connecting or checking against: MonteCarloMeasurements.jl (particles with arithmetic, so addition is convolution), ParticleFilters.jl, KernelDensity.jl, MeasureTheory.jl (densities relative to base measures), AbstractGPs.jl (beliefs over functions), Bijectors.jl (pushforward beliefs), and IncrementalInference.jl with ApproxManifoldProducts.jl (multimodal, kernel-density beliefs on manifolds: the existing Julia take on non-Gaussian SLAM).
Related: Beliefs, Gaussian Belief, Dirac Belief, Sample Belief, Trivial Belief, Messages are Inversions, Everything is a Factor, Inference Signatures, Related Julia Projects