Skip to content

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

Latest commit

 

History

89 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)

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