Input arguments annotations
Background: tracing rule inputs
During inference, every message flowing along an edge is computed by a message update rule. InputArgumentsAnnotations records what went into each rule call — the MessageMapping (which node and interface the rule was for), the incoming messages, the incoming marginals, and the result distribution — and propagates that record through subsequent message products.
This is useful for debugging and for implementing callbacks that need to inspect the full provenance of a message: rather than re-running or re-examining the model structure, the record travels with the message itself.
What gets stored
After each rule execution a RuleInputArgumentsRecord is written into the message's annotation dict under the :rule_input_arguments key. When two messages are multiplied, their records are merged into a ProductInputArgumentsRecord that contains all contributing records as a flat list, regardless of how deeply nested the products were.
Reading input arguments from a message
using ReactiveMP
# ann is the AnnotationDict of some message
record = get_rule_input_arguments(ann)
if record isa RuleInputArgumentsRecord
println("single rule: ", record.mapping)
println("messages: ", record.messages)
println("marginals: ", record.marginals)
println("result: ", record.result)
elseif record isa ProductInputArgumentsRecord
for r in record.mappings
println("contributed rule: ", r.mapping)
end
endAPI
ReactiveMP.InputArgumentsAnnotations — Type
InputArgumentsAnnotations <: AbstractAnnotationsAnnotation processor that records the input arguments and result of each message update rule execution and propagates them through message products.
After a rule executes, stores a RuleInputArgumentsRecord under the :rule_input_arguments key of the annotation dict. During message products, merges the records from the two sides into a ProductInputArgumentsRecord.
ReactiveMP.RuleInputArgumentsRecord — Type
RuleInputArgumentsRecordStores the inputs and result of a single message update rule execution: the MessageMapping, the incoming messages tuple, the incoming marginals tuple, and the computed result distribution.
ReactiveMP.ProductInputArgumentsRecord — Type
ProductInputArgumentsRecordStores the collection of RuleInputArgumentsRecord objects that were combined during one or more message products. Each element corresponds to one rule execution that contributed to the product.
ReactiveMP.get_rule_input_arguments — Function
get_rule_input_arguments(ann::AnnotationDict)Return the rule input arguments stored in ann. The value is a RuleInputArgumentsRecord when the message came directly from a single rule execution, or a ProductInputArgumentsRecord when it is the result of one or more message products. Throws KeyError if the annotation has not been set.
ReactiveMP.AddonMemory — Function
AddonMemory(args...; kwargs...)Deprecated: AddonMemory has been removed in ReactiveMP v6. Use InputArgumentsAnnotations instead. See the migration guide in the documentation for details.