Skip to content

Latest commit

 

History

83 Commits

Folders and files

Repository files navigation

MessagePassingRulesBase

CI Docs: stable Docs: dev Coverage Code style: Runic

The rule system of the ReactiveMP ecosystem: the macros that declare factor nodes, their message update rules, marginal rules, average energies and dependencies, and the lookup an engine uses to find and run a rule for a node, a target and the types of its inputs. Rules are ordinary Julia functions, found through dispatch whichever loaded package defines them, and callable and testable without an engine. It also holds the math helpers the rule packages share, linear and Gaussian algebra such as add_outer and gaussian_second_moment, public and documented. The ReactiveMP ecosystem's rule packages build on it, and ReactiveMP runs its rules.

import Pkg; Pkg.add("MessagePassingRulesBase")
using MessagePassingRulesBase

struct Shift end   # out = in + 1

@define_factor_node(node = Shift, type = Deterministic, interfaces = [:out, :in])

@define_message_update_rule(
    node = Shift, target = :out, args = (m[:in]::Real,), logscale = 0,
    body = (args) -> args.m[:in] + 1,
)

result = @call_message_update_rule(node = Shift, target = :out, m = (in = 1.0,))
getresult(result), getlogscale(result)   # (2.0, 0)
  • Documentation: https://reactivebayes.github.io/MessagePassingRulesBase.jl/stable/. make docs builds it locally, into docs/build.
  • Tests: make test runs the suite as CI does; make test test_args="tag:alloc name:routing" selects items by tag, by name or by file. make help lists the other targets: docs, docs-serve, format, check-format, test-fast.
  • Depends on BayesBase, MacroTools, Compat, FastCholesky, IrrationalConstants and LinearAlgebra: no distribution package and no engine. Julia 1.10 or later. MIT licence.

About

A base package that defines methods for message passing rules and factor nodes within ReactiveMP.jl

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages