Trace callbacks

RxInfer provides a built-in callback structure called RxInferTraceCallbacks for recording all callback events during the inference procedure. Each event is stored as a TracedEvent containing the event name (as a Symbol) and the event object itself. This is useful for debugging, understanding the inference flow, and inspecting what happens at each stage. For general information about the callbacks system, see Callbacks.

Basic usage

using RxInfer

@model function iid_normal(y)
    μ  ~ Normal(mean = 0.0, variance = 100.0)
    γ  ~ Gamma(shape = 1.0, rate = 1.0)
    y .~ Normal(mean = μ, precision = γ)
end

init = @initialization begin
    q(μ) = vague(NormalMeanVariance)
end

# Create a trace callbacks instance
trace = RxInferTraceCallbacks()

result = infer(
    model = iid_normal(),
    data = (y = randn(10),),
    constraints = MeanField(),
    iterations = 3,
    initialization = init,
    callbacks = trace,
)

events = RxInfer.tracedevents(trace)

println("Recorded $(length(events)) events")
for i in 1:10
    println("  ", events[i])
end
println("...")
Recorded 302 events
  TracedEvent(BeforeModelCreationEvent{Base.UUID}(Base.UUID("d9299e0b-990b-4a86-bc8a-3c65dc71fe2e")), 0x0000006248a20c7c)
  TracedEvent(AfterModelCreationEvent{ProbabilisticModel{GraphPPL.Model{MetaGraphsNext.MetaGraph{Int64, Graphs.SimpleGraphs.SimpleGraph{Int64}, GraphPPL.NodeLabel, GraphPPL.NodeData, GraphPPL.EdgeLabel, GraphPPL.Context, MetaGraphsNext.var"#MetaGraph##6#MetaGraph##7", Float64}, GraphPPL.PluginsCollection{Tuple{GraphPPL.VariationalConstraintsPlugin{MeanField}, GraphPPL.MetaPlugin{GraphPPL.MetaSpecification}, RxInfer.InitializationPlugin{RxInfer.InitSpecification}, RxInfer.ReactiveMPInferencePlugin{RxInfer.ReactiveMPInferenceOptions{Nothing, Nothing, Nothing, RxInferTraceCallbacks}}}}, RxInfer.ReactiveMPGraphPPLBackend{Static.False}, String}}, Base.UUID}(ProbabilisticModel{GraphPPL.Model{MetaGraphsNext.MetaGraph{Int64, Graphs.SimpleGraphs.SimpleGraph{Int64}, GraphPPL.NodeLabel, GraphPPL.NodeData, GraphPPL.EdgeLabel, GraphPPL.Context, MetaGraphsNext.var"#MetaGraph##6#MetaGraph##7", Float64}, GraphPPL.PluginsCollection{Tuple{GraphPPL.VariationalConstraintsPlugin{MeanField}, GraphPPL.MetaPlugin{GraphPPL.MetaSpecification}, RxInfer.InitializationPlugin{RxInfer.InitSpecification}, RxInfer.ReactiveMPInferencePlugin{RxInfer.ReactiveMPInferenceOptions{Nothing, Nothing, Nothing, RxInferTraceCallbacks}}}}, RxInfer.ReactiveMPGraphPPLBackend{Static.False}, String}}(GraphPPL.Model{MetaGraphsNext.MetaGraph{Int64, Graphs.SimpleGraphs.SimpleGraph{Int64}, GraphPPL.NodeLabel, GraphPPL.NodeData, GraphPPL.EdgeLabel, GraphPPL.Context, MetaGraphsNext.var"#MetaGraph##6#MetaGraph##7", Float64}, GraphPPL.PluginsCollection{Tuple{GraphPPL.VariationalConstraintsPlugin{MeanField}, GraphPPL.MetaPlugin{GraphPPL.MetaSpecification}, RxInfer.InitializationPlugin{RxInfer.InitSpecification}, RxInfer.ReactiveMPInferencePlugin{RxInfer.ReactiveMPInferenceOptions{Nothing, Nothing, Nothing, RxInferTraceCallbacks}}}}, RxInfer.ReactiveMPGraphPPLBackend{Static.False}, String}(Meta graph based on a Graphs.SimpleGraphs.SimpleGraph{Int64} with vertex labels of type GraphPPL.NodeLabel, vertex metadata of type GraphPPL.NodeData, edge metadata of type GraphPPL.EdgeLabel, graph metadata given by GraphPPL.Context(0, Main.var"Main".iid_normal, "", nothing, {NormalMeanPrecision = 10, NormalMeanVariance = 1, GammaShapeRate = 1}, {}, {(NormalMeanPrecision, 5) = NormalMeanPrecision_23, (NormalMeanPrecision, 3) = NormalMeanPrecision_21, (NormalMeanPrecision, 7) = NormalMeanPrecision_25, (NormalMeanPrecision, 6) = NormalMeanPrecision_24, (NormalMeanVariance, 1) = NormalMeanVariance_4, (NormalMeanPrecision, 8) = NormalMeanPrecision_26, (NormalMeanPrecision, 1) = NormalMeanPrecision_19, (NormalMeanPrecision, 9) = NormalMeanPrecision_27, (NormalMeanPrecision, 10) = NormalMeanPrecision_28, (NormalMeanPrecision, 2) = NormalMeanPrecision_20, (NormalMeanPrecision, 4) = NormalMeanPrecision_22, (GammaShapeRate, 1) = GammaShapeRate_8}, {:γ = γ_5, :μ = μ_1, :constvar_6 = constvar_6, :constvar_7 = constvar_7, :constvar_2 = constvar_2, :constvar_3 = constvar_3}, {:y = ResizableArray{GraphPPL.NodeLabel,1}(GraphPPL.NodeLabel[y_9, y_10, y_11, y_12, y_13, y_14, y_15, y_16, y_17, y_18])}, {}, {}, Base.RefValue{Any}(GraphPPL.NodeLabel[y_9, y_10, y_11, y_12, y_13, y_14, y_15, y_16, y_17, y_18])), and default weight 1.0, GraphPPL.PluginsCollection{Tuple{GraphPPL.VariationalConstraintsPlugin{MeanField}, GraphPPL.MetaPlugin{GraphPPL.MetaSpecification}, RxInfer.InitializationPlugin{RxInfer.InitSpecification}, RxInfer.ReactiveMPInferencePlugin{RxInfer.ReactiveMPInferenceOptions{Nothing, Nothing, Nothing, RxInferTraceCallbacks}}}}((GraphPPL.VariationalConstraintsPlugin{MeanField}(MeanField()), GraphPPL.MetaPlugin{GraphPPL.MetaSpecification}(Meta:
), RxInfer.InitializationPlugin{RxInfer.InitSpecification}(Initial state:
  q(μ) = NormalMeanVariance{Float64}(μ=0.0, v=1.0e12)
), RxInfer.ReactiveMPInferencePlugin{RxInfer.ReactiveMPInferenceOptions{Nothing, Nothing, Nothing, RxInferTraceCallbacks}}(RxInfer.ReactiveMPInferenceOptions{Nothing, Nothing, Nothing, RxInferTraceCallbacks}(nothing, nothing, true, false, nothing, RxInferTraceCallbacks (302 events recorded)
  :before_model_creation
  :after_model_creation
  :before_inference
  :before_iteration
  :before_data_update
  :before_marginal_computation
  :before_product_of_messages
  :before_message_rule_call
  :after_message_rule_call
  :before_product_of_two_messages
  :after_product_of_two_messages
  :before_form_constraint_applied
  :after_form_constraint_applied
  :after_product_of_messages
  :after_marginal_computation
  :on_marginal_update
  :after_data_update
  :after_iteration
  :after_inference
Use `?BeforeModelCreationEvent or @doc(BeforeModelCreationEvent)` to see the documentation for an event.)))), RxInfer.ReactiveMPGraphPPLBackend{Static.False}(static(false)), "function iid_normal(y)\n    μ ~ Normal(mean = 0.0, variance = 100.0)\n    γ ~ Gamma(shape = 1.0, rate = 1.0)\n    y .~ Normal(mean = μ, precision = γ)\nend", Base.RefValue{Int64}(28)), Dict{Any, Any}(:trace => RxInferTraceCallbacks (302 events recorded)
  :before_model_creation
  :after_model_creation
  :before_inference
  :before_iteration
  :before_data_update
  :before_marginal_computation
  :before_product_of_messages
  :before_message_rule_call
  :after_message_rule_call
  :before_product_of_two_messages
  :after_product_of_two_messages
  :before_form_constraint_applied
  :after_form_constraint_applied
  :after_product_of_messages
  :after_marginal_computation
  :on_marginal_update
  :after_data_update
  :after_iteration
  :after_inference
Use `?BeforeModelCreationEvent or @doc(BeforeModelCreationEvent)` to see the documentation for an event.)), Base.UUID("d9299e0b-990b-4a86-bc8a-3c65dc71fe2e")), 0x00000062dfded139)
  TracedEvent(BeforeInferenceEvent{ProbabilisticModel{GraphPPL.Model{MetaGraphsNext.MetaGraph{Int64, Graphs.SimpleGraphs.SimpleGraph{Int64}, GraphPPL.NodeLabel, GraphPPL.NodeData, GraphPPL.EdgeLabel, GraphPPL.Context, MetaGraphsNext.var"#MetaGraph##6#MetaGraph##7", Float64}, GraphPPL.PluginsCollection{Tuple{GraphPPL.VariationalConstraintsPlugin{MeanField}, GraphPPL.MetaPlugin{GraphPPL.MetaSpecification}, RxInfer.InitializationPlugin{RxInfer.InitSpecification}, RxInfer.ReactiveMPInferencePlugin{RxInfer.ReactiveMPInferenceOptions{Nothing, Nothing, Nothing, RxInferTraceCallbacks}}}}, RxInfer.ReactiveMPGraphPPLBackend{Static.False}, String}}, Base.UUID}(ProbabilisticModel{GraphPPL.Model{MetaGraphsNext.MetaGraph{Int64, Graphs.SimpleGraphs.SimpleGraph{Int64}, GraphPPL.NodeLabel, GraphPPL.NodeData, GraphPPL.EdgeLabel, GraphPPL.Context, MetaGraphsNext.var"#MetaGraph##6#MetaGraph##7", Float64}, GraphPPL.PluginsCollection{Tuple{GraphPPL.VariationalConstraintsPlugin{MeanField}, GraphPPL.MetaPlugin{GraphPPL.MetaSpecification}, RxInfer.InitializationPlugin{RxInfer.InitSpecification}, RxInfer.ReactiveMPInferencePlugin{RxInfer.ReactiveMPInferenceOptions{Nothing, Nothing, Nothing, RxInferTraceCallbacks}}}}, RxInfer.ReactiveMPGraphPPLBackend{Static.False}, String}}(GraphPPL.Model{MetaGraphsNext.MetaGraph{Int64, Graphs.SimpleGraphs.SimpleGraph{Int64}, GraphPPL.NodeLabel, GraphPPL.NodeData, GraphPPL.EdgeLabel, GraphPPL.Context, MetaGraphsNext.var"#MetaGraph##6#MetaGraph##7", Float64}, GraphPPL.PluginsCollection{Tuple{GraphPPL.VariationalConstraintsPlugin{MeanField}, GraphPPL.MetaPlugin{GraphPPL.MetaSpecification}, RxInfer.InitializationPlugin{RxInfer.InitSpecification}, RxInfer.ReactiveMPInferencePlugin{RxInfer.ReactiveMPInferenceOptions{Nothing, Nothing, Nothing, RxInferTraceCallbacks}}}}, RxInfer.ReactiveMPGraphPPLBackend{Static.False}, String}(Meta graph based on a Graphs.SimpleGraphs.SimpleGraph{Int64} with vertex labels of type GraphPPL.NodeLabel, vertex metadata of type GraphPPL.NodeData, edge metadata of type GraphPPL.EdgeLabel, graph metadata given by GraphPPL.Context(0, Main.var"Main".iid_normal, "", nothing, {NormalMeanPrecision = 10, NormalMeanVariance = 1, GammaShapeRate = 1}, {}, {(NormalMeanPrecision, 5) = NormalMeanPrecision_23, (NormalMeanPrecision, 3) = NormalMeanPrecision_21, (NormalMeanPrecision, 7) = NormalMeanPrecision_25, (NormalMeanPrecision, 6) = NormalMeanPrecision_24, (NormalMeanVariance, 1) = NormalMeanVariance_4, (NormalMeanPrecision, 8) = NormalMeanPrecision_26, (NormalMeanPrecision, 1) = NormalMeanPrecision_19, (NormalMeanPrecision, 9) = NormalMeanPrecision_27, (NormalMeanPrecision, 10) = NormalMeanPrecision_28, (NormalMeanPrecision, 2) = NormalMeanPrecision_20, (NormalMeanPrecision, 4) = NormalMeanPrecision_22, (GammaShapeRate, 1) = GammaShapeRate_8}, {:γ = γ_5, :μ = μ_1, :constvar_6 = constvar_6, :constvar_7 = constvar_7, :constvar_2 = constvar_2, :constvar_3 = constvar_3}, {:y = ResizableArray{GraphPPL.NodeLabel,1}(GraphPPL.NodeLabel[y_9, y_10, y_11, y_12, y_13, y_14, y_15, y_16, y_17, y_18])}, {}, {}, Base.RefValue{Any}(GraphPPL.NodeLabel[y_9, y_10, y_11, y_12, y_13, y_14, y_15, y_16, y_17, y_18])), and default weight 1.0, GraphPPL.PluginsCollection{Tuple{GraphPPL.VariationalConstraintsPlugin{MeanField}, GraphPPL.MetaPlugin{GraphPPL.MetaSpecification}, RxInfer.InitializationPlugin{RxInfer.InitSpecification}, RxInfer.ReactiveMPInferencePlugin{RxInfer.ReactiveMPInferenceOptions{Nothing, Nothing, Nothing, RxInferTraceCallbacks}}}}((GraphPPL.VariationalConstraintsPlugin{MeanField}(MeanField()), GraphPPL.MetaPlugin{GraphPPL.MetaSpecification}(Meta:
), RxInfer.InitializationPlugin{RxInfer.InitSpecification}(Initial state:
  q(μ) = NormalMeanVariance{Float64}(μ=0.0, v=1.0e12)
), RxInfer.ReactiveMPInferencePlugin{RxInfer.ReactiveMPInferenceOptions{Nothing, Nothing, Nothing, RxInferTraceCallbacks}}(RxInfer.ReactiveMPInferenceOptions{Nothing, Nothing, Nothing, RxInferTraceCallbacks}(nothing, nothing, true, false, nothing, RxInferTraceCallbacks (302 events recorded)
  :before_model_creation
  :after_model_creation
  :before_inference
  :before_iteration
  :before_data_update
  :before_marginal_computation
  :before_product_of_messages
  :before_message_rule_call
  :after_message_rule_call
  :before_product_of_two_messages
  :after_product_of_two_messages
  :before_form_constraint_applied
  :after_form_constraint_applied
  :after_product_of_messages
  :after_marginal_computation
  :on_marginal_update
  :after_data_update
  :after_iteration
  :after_inference
Use `?BeforeModelCreationEvent or @doc(BeforeModelCreationEvent)` to see the documentation for an event.)))), RxInfer.ReactiveMPGraphPPLBackend{Static.False}(static(false)), "function iid_normal(y)\n    μ ~ Normal(mean = 0.0, variance = 100.0)\n    γ ~ Gamma(shape = 1.0, rate = 1.0)\n    y .~ Normal(mean = μ, precision = γ)\nend", Base.RefValue{Int64}(28)), Dict{Any, Any}(:trace => RxInferTraceCallbacks (302 events recorded)
  :before_model_creation
  :after_model_creation
  :before_inference
  :before_iteration
  :before_data_update
  :before_marginal_computation
  :before_product_of_messages
  :before_message_rule_call
  :after_message_rule_call
  :before_product_of_two_messages
  :after_product_of_two_messages
  :before_form_constraint_applied
  :after_form_constraint_applied
  :after_product_of_messages
  :after_marginal_computation
  :on_marginal_update
  :after_data_update
  :after_iteration
  :after_inference
Use `?BeforeModelCreationEvent or @doc(BeforeModelCreationEvent)` to see the documentation for an event.)), Base.UUID("fe2556de-c4c8-4bb2-9ba8-292a44f78d4a")), 0x000000633c67b1ae)
  TracedEvent(BeforeIterationEvent{ProbabilisticModel{GraphPPL.Model{MetaGraphsNext.MetaGraph{Int64, Graphs.SimpleGraphs.SimpleGraph{Int64}, GraphPPL.NodeLabel, GraphPPL.NodeData, GraphPPL.EdgeLabel, GraphPPL.Context, MetaGraphsNext.var"#MetaGraph##6#MetaGraph##7", Float64}, GraphPPL.PluginsCollection{Tuple{GraphPPL.VariationalConstraintsPlugin{MeanField}, GraphPPL.MetaPlugin{GraphPPL.MetaSpecification}, RxInfer.InitializationPlugin{RxInfer.InitSpecification}, RxInfer.ReactiveMPInferencePlugin{RxInfer.ReactiveMPInferenceOptions{Nothing, Nothing, Nothing, RxInferTraceCallbacks}}}}, RxInfer.ReactiveMPGraphPPLBackend{Static.False}, String}}, Base.UUID}(ProbabilisticModel{GraphPPL.Model{MetaGraphsNext.MetaGraph{Int64, Graphs.SimpleGraphs.SimpleGraph{Int64}, GraphPPL.NodeLabel, GraphPPL.NodeData, GraphPPL.EdgeLabel, GraphPPL.Context, MetaGraphsNext.var"#MetaGraph##6#MetaGraph##7", Float64}, GraphPPL.PluginsCollection{Tuple{GraphPPL.VariationalConstraintsPlugin{MeanField}, GraphPPL.MetaPlugin{GraphPPL.MetaSpecification}, RxInfer.InitializationPlugin{RxInfer.InitSpecification}, RxInfer.ReactiveMPInferencePlugin{RxInfer.ReactiveMPInferenceOptions{Nothing, Nothing, Nothing, RxInferTraceCallbacks}}}}, RxInfer.ReactiveMPGraphPPLBackend{Static.False}, String}}(GraphPPL.Model{MetaGraphsNext.MetaGraph{Int64, Graphs.SimpleGraphs.SimpleGraph{Int64}, GraphPPL.NodeLabel, GraphPPL.NodeData, GraphPPL.EdgeLabel, GraphPPL.Context, MetaGraphsNext.var"#MetaGraph##6#MetaGraph##7", Float64}, GraphPPL.PluginsCollection{Tuple{GraphPPL.VariationalConstraintsPlugin{MeanField}, GraphPPL.MetaPlugin{GraphPPL.MetaSpecification}, RxInfer.InitializationPlugin{RxInfer.InitSpecification}, RxInfer.ReactiveMPInferencePlugin{RxInfer.ReactiveMPInferenceOptions{Nothing, Nothing, Nothing, RxInferTraceCallbacks}}}}, RxInfer.ReactiveMPGraphPPLBackend{Static.False}, String}(Meta graph based on a Graphs.SimpleGraphs.SimpleGraph{Int64} with vertex labels of type GraphPPL.NodeLabel, vertex metadata of type GraphPPL.NodeData, edge metadata of type GraphPPL.EdgeLabel, graph metadata given by GraphPPL.Context(0, Main.var"Main".iid_normal, "", nothing, {NormalMeanPrecision = 10, NormalMeanVariance = 1, GammaShapeRate = 1}, {}, {(NormalMeanPrecision, 5) = NormalMeanPrecision_23, (NormalMeanPrecision, 3) = NormalMeanPrecision_21, (NormalMeanPrecision, 7) = NormalMeanPrecision_25, (NormalMeanPrecision, 6) = NormalMeanPrecision_24, (NormalMeanVariance, 1) = NormalMeanVariance_4, (NormalMeanPrecision, 8) = NormalMeanPrecision_26, (NormalMeanPrecision, 1) = NormalMeanPrecision_19, (NormalMeanPrecision, 9) = NormalMeanPrecision_27, (NormalMeanPrecision, 10) = NormalMeanPrecision_28, (NormalMeanPrecision, 2) = NormalMeanPrecision_20, (NormalMeanPrecision, 4) = NormalMeanPrecision_22, (GammaShapeRate, 1) = GammaShapeRate_8}, {:γ = γ_5, :μ = μ_1, :constvar_6 = constvar_6, :constvar_7 = constvar_7, :constvar_2 = constvar_2, :constvar_3 = constvar_3}, {:y = ResizableArray{GraphPPL.NodeLabel,1}(GraphPPL.NodeLabel[y_9, y_10, y_11, y_12, y_13, y_14, y_15, y_16, y_17, y_18])}, {}, {}, Base.RefValue{Any}(GraphPPL.NodeLabel[y_9, y_10, y_11, y_12, y_13, y_14, y_15, y_16, y_17, y_18])), and default weight 1.0, GraphPPL.PluginsCollection{Tuple{GraphPPL.VariationalConstraintsPlugin{MeanField}, GraphPPL.MetaPlugin{GraphPPL.MetaSpecification}, RxInfer.InitializationPlugin{RxInfer.InitSpecification}, RxInfer.ReactiveMPInferencePlugin{RxInfer.ReactiveMPInferenceOptions{Nothing, Nothing, Nothing, RxInferTraceCallbacks}}}}((GraphPPL.VariationalConstraintsPlugin{MeanField}(MeanField()), GraphPPL.MetaPlugin{GraphPPL.MetaSpecification}(Meta:
), RxInfer.InitializationPlugin{RxInfer.InitSpecification}(Initial state:
  q(μ) = NormalMeanVariance{Float64}(μ=0.0, v=1.0e12)
), RxInfer.ReactiveMPInferencePlugin{RxInfer.ReactiveMPInferenceOptions{Nothing, Nothing, Nothing, RxInferTraceCallbacks}}(RxInfer.ReactiveMPInferenceOptions{Nothing, Nothing, Nothing, RxInferTraceCallbacks}(nothing, nothing, true, false, nothing, RxInferTraceCallbacks (302 events recorded)
  :before_model_creation
  :after_model_creation
  :before_inference
  :before_iteration
  :before_data_update
  :before_marginal_computation
  :before_product_of_messages
  :before_message_rule_call
  :after_message_rule_call
  :before_product_of_two_messages
  :after_product_of_two_messages
  :before_form_constraint_applied
  :after_form_constraint_applied
  :after_product_of_messages
  :after_marginal_computation
  :on_marginal_update
  :after_data_update
  :after_iteration
  :after_inference
Use `?BeforeModelCreationEvent or @doc(BeforeModelCreationEvent)` to see the documentation for an event.)))), RxInfer.ReactiveMPGraphPPLBackend{Static.False}(static(false)), "function iid_normal(y)\n    μ ~ Normal(mean = 0.0, variance = 100.0)\n    γ ~ Gamma(shape = 1.0, rate = 1.0)\n    y .~ Normal(mean = μ, precision = γ)\nend", Base.RefValue{Int64}(28)), Dict{Any, Any}(:trace => RxInferTraceCallbacks (302 events recorded)
  :before_model_creation
  :after_model_creation
  :before_inference
  :before_iteration
  :before_data_update
  :before_marginal_computation
  :before_product_of_messages
  :before_message_rule_call
  :after_message_rule_call
  :before_product_of_two_messages
  :after_product_of_two_messages
  :before_form_constraint_applied
  :after_form_constraint_applied
  :after_product_of_messages
  :after_marginal_computation
  :on_marginal_update
  :after_data_update
  :after_iteration
  :after_inference
Use `?BeforeModelCreationEvent or @doc(BeforeModelCreationEvent)` to see the documentation for an event.)), 1, false, Base.UUID("cedfeffe-7bcf-44ff-9c99-4bc0d76891f7")), 0x000000633c6903ad)
  TracedEvent(BeforeDataUpdateEvent{ProbabilisticModel{GraphPPL.Model{MetaGraphsNext.MetaGraph{Int64, Graphs.SimpleGraphs.SimpleGraph{Int64}, GraphPPL.NodeLabel, GraphPPL.NodeData, GraphPPL.EdgeLabel, GraphPPL.Context, MetaGraphsNext.var"#MetaGraph##6#MetaGraph##7", Float64}, GraphPPL.PluginsCollection{Tuple{GraphPPL.VariationalConstraintsPlugin{MeanField}, GraphPPL.MetaPlugin{GraphPPL.MetaSpecification}, RxInfer.InitializationPlugin{RxInfer.InitSpecification}, RxInfer.ReactiveMPInferencePlugin{RxInfer.ReactiveMPInferenceOptions{Nothing, Nothing, Nothing, RxInferTraceCallbacks}}}}, RxInfer.ReactiveMPGraphPPLBackend{Static.False}, String}}, @NamedTuple{y::Vector{Float64}}, Base.UUID}(ProbabilisticModel{GraphPPL.Model{MetaGraphsNext.MetaGraph{Int64, Graphs.SimpleGraphs.SimpleGraph{Int64}, GraphPPL.NodeLabel, GraphPPL.NodeData, GraphPPL.EdgeLabel, GraphPPL.Context, MetaGraphsNext.var"#MetaGraph##6#MetaGraph##7", Float64}, GraphPPL.PluginsCollection{Tuple{GraphPPL.VariationalConstraintsPlugin{MeanField}, GraphPPL.MetaPlugin{GraphPPL.MetaSpecification}, RxInfer.InitializationPlugin{RxInfer.InitSpecification}, RxInfer.ReactiveMPInferencePlugin{RxInfer.ReactiveMPInferenceOptions{Nothing, Nothing, Nothing, RxInferTraceCallbacks}}}}, RxInfer.ReactiveMPGraphPPLBackend{Static.False}, String}}(GraphPPL.Model{MetaGraphsNext.MetaGraph{Int64, Graphs.SimpleGraphs.SimpleGraph{Int64}, GraphPPL.NodeLabel, GraphPPL.NodeData, GraphPPL.EdgeLabel, GraphPPL.Context, MetaGraphsNext.var"#MetaGraph##6#MetaGraph##7", Float64}, GraphPPL.PluginsCollection{Tuple{GraphPPL.VariationalConstraintsPlugin{MeanField}, GraphPPL.MetaPlugin{GraphPPL.MetaSpecification}, RxInfer.InitializationPlugin{RxInfer.InitSpecification}, RxInfer.ReactiveMPInferencePlugin{RxInfer.ReactiveMPInferenceOptions{Nothing, Nothing, Nothing, RxInferTraceCallbacks}}}}, RxInfer.ReactiveMPGraphPPLBackend{Static.False}, String}(Meta graph based on a Graphs.SimpleGraphs.SimpleGraph{Int64} with vertex labels of type GraphPPL.NodeLabel, vertex metadata of type GraphPPL.NodeData, edge metadata of type GraphPPL.EdgeLabel, graph metadata given by GraphPPL.Context(0, Main.var"Main".iid_normal, "", nothing, {NormalMeanPrecision = 10, NormalMeanVariance = 1, GammaShapeRate = 1}, {}, {(NormalMeanPrecision, 5) = NormalMeanPrecision_23, (NormalMeanPrecision, 3) = NormalMeanPrecision_21, (NormalMeanPrecision, 7) = NormalMeanPrecision_25, (NormalMeanPrecision, 6) = NormalMeanPrecision_24, (NormalMeanVariance, 1) = NormalMeanVariance_4, (NormalMeanPrecision, 8) = NormalMeanPrecision_26, (NormalMeanPrecision, 1) = NormalMeanPrecision_19, (NormalMeanPrecision, 9) = NormalMeanPrecision_27, (NormalMeanPrecision, 10) = NormalMeanPrecision_28, (NormalMeanPrecision, 2) = NormalMeanPrecision_20, (NormalMeanPrecision, 4) = NormalMeanPrecision_22, (GammaShapeRate, 1) = GammaShapeRate_8}, {:γ = γ_5, :μ = μ_1, :constvar_6 = constvar_6, :constvar_7 = constvar_7, :constvar_2 = constvar_2, :constvar_3 = constvar_3}, {:y = ResizableArray{GraphPPL.NodeLabel,1}(GraphPPL.NodeLabel[y_9, y_10, y_11, y_12, y_13, y_14, y_15, y_16, y_17, y_18])}, {}, {}, Base.RefValue{Any}(GraphPPL.NodeLabel[y_9, y_10, y_11, y_12, y_13, y_14, y_15, y_16, y_17, y_18])), and default weight 1.0, GraphPPL.PluginsCollection{Tuple{GraphPPL.VariationalConstraintsPlugin{MeanField}, GraphPPL.MetaPlugin{GraphPPL.MetaSpecification}, RxInfer.InitializationPlugin{RxInfer.InitSpecification}, RxInfer.ReactiveMPInferencePlugin{RxInfer.ReactiveMPInferenceOptions{Nothing, Nothing, Nothing, RxInferTraceCallbacks}}}}((GraphPPL.VariationalConstraintsPlugin{MeanField}(MeanField()), GraphPPL.MetaPlugin{GraphPPL.MetaSpecification}(Meta:
), RxInfer.InitializationPlugin{RxInfer.InitSpecification}(Initial state:
  q(μ) = NormalMeanVariance{Float64}(μ=0.0, v=1.0e12)
), RxInfer.ReactiveMPInferencePlugin{RxInfer.ReactiveMPInferenceOptions{Nothing, Nothing, Nothing, RxInferTraceCallbacks}}(RxInfer.ReactiveMPInferenceOptions{Nothing, Nothing, Nothing, RxInferTraceCallbacks}(nothing, nothing, true, false, nothing, RxInferTraceCallbacks (302 events recorded)
  :before_model_creation
  :after_model_creation
  :before_inference
  :before_iteration
  :before_data_update
  :before_marginal_computation
  :before_product_of_messages
  :before_message_rule_call
  :after_message_rule_call
  :before_product_of_two_messages
  :after_product_of_two_messages
  :before_form_constraint_applied
  :after_form_constraint_applied
  :after_product_of_messages
  :after_marginal_computation
  :on_marginal_update
  :after_data_update
  :after_iteration
  :after_inference
Use `?BeforeModelCreationEvent or @doc(BeforeModelCreationEvent)` to see the documentation for an event.)))), RxInfer.ReactiveMPGraphPPLBackend{Static.False}(static(false)), "function iid_normal(y)\n    μ ~ Normal(mean = 0.0, variance = 100.0)\n    γ ~ Gamma(shape = 1.0, rate = 1.0)\n    y .~ Normal(mean = μ, precision = γ)\nend", Base.RefValue{Int64}(28)), Dict{Any, Any}(:trace => RxInferTraceCallbacks (302 events recorded)
  :before_model_creation
  :after_model_creation
  :before_inference
  :before_iteration
  :before_data_update
  :before_marginal_computation
  :before_product_of_messages
  :before_message_rule_call
  :after_message_rule_call
  :before_product_of_two_messages
  :after_product_of_two_messages
  :before_form_constraint_applied
  :after_form_constraint_applied
  :after_product_of_messages
  :after_marginal_computation
  :on_marginal_update
  :after_data_update
  :after_iteration
  :after_inference
Use `?BeforeModelCreationEvent or @doc(BeforeModelCreationEvent)` to see the documentation for an event.)), (y = [2.197667102692395, 1.5309443338855064, 1.704848299104551, -1.048695772879144, -0.8832761465486111, -1.7380409466777764, 1.9803892096103175, -0.8642351143843388, 0.45001037746077177, -1.2142631471334342],), Base.UUID("99e9fca1-a38b-4482-b95f-33ffd39b436e")), 0x000000633cec15eb)
  TracedEvent(ReactiveMP.BeforeMarginalComputationEvent{RandomVariable, ReactiveMP.MessageProductContext{GenericProd, CompositeFormConstraint{Tuple{UnspecifiedFormConstraint, RxInfer.EnsureSupportedFunctionalForm}}, FormConstraintCheckLast, ReactiveMP.MessagesProductFromLeftToRight, Nothing, RxInferTraceCallbacks}, Vector{AbstractMessage}, Base.UUID}(RandomVariable(ReactiveMP.MessageObservable{AbstractMessage}[ReactiveMP.MessageObservable{AbstractMessage}(RecentSubject(AbstractMessage, Subject{AbstractMessage, AsapScheduler, AsapScheduler}), LazyObservable(AbstractMessage)), ReactiveMP.MessageObservable{AbstractMessage}(RecentSubject(AbstractMessage, Subject{AbstractMessage, AsapScheduler, AsapScheduler}), LazyObservable(AbstractMessage)), ReactiveMP.MessageObservable{AbstractMessage}(RecentSubject(AbstractMessage, Subject{AbstractMessage, AsapScheduler, AsapScheduler}), LazyObservable(AbstractMessage)), ReactiveMP.MessageObservable{AbstractMessage}(RecentSubject(AbstractMessage, Subject{AbstractMessage, AsapScheduler, AsapScheduler}), LazyObservable(AbstractMessage)), ReactiveMP.MessageObservable{AbstractMessage}(RecentSubject(AbstractMessage, Subject{AbstractMessage, AsapScheduler, AsapScheduler}), LazyObservable(AbstractMessage)), ReactiveMP.MessageObservable{AbstractMessage}(RecentSubject(AbstractMessage, Subject{AbstractMessage, AsapScheduler, AsapScheduler}), LazyObservable(AbstractMessage)), ReactiveMP.MessageObservable{AbstractMessage}(RecentSubject(AbstractMessage, Subject{AbstractMessage, AsapScheduler, AsapScheduler}), LazyObservable(AbstractMessage)), ReactiveMP.MessageObservable{AbstractMessage}(RecentSubject(AbstractMessage, Subject{AbstractMessage, AsapScheduler, AsapScheduler}), LazyObservable(AbstractMessage)), ReactiveMP.MessageObservable{AbstractMessage}(RecentSubject(AbstractMessage, Subject{AbstractMessage, AsapScheduler, AsapScheduler}), LazyObservable(AbstractMessage)), ReactiveMP.MessageObservable{AbstractMessage}(RecentSubject(AbstractMessage, Subject{AbstractMessage, AsapScheduler, AsapScheduler}), LazyObservable(AbstractMessage)), ReactiveMP.MessageObservable{AbstractMessage}(RecentSubject(AbstractMessage, Subject{AbstractMessage, AsapScheduler, AsapScheduler}), LazyObservable(AbstractMessage))], ReactiveMP.MessageObservable{Message}[ReactiveMP.MessageObservable{Message}(RecentSubject(Message, Subject{Message, AsapScheduler, AsapScheduler}), LazyObservable(Message)), ReactiveMP.MessageObservable{Message}(RecentSubject(Message, Subject{Message, AsapScheduler, AsapScheduler}), LazyObservable(Message)), ReactiveMP.MessageObservable{Message}(RecentSubject(Message, Subject{Message, AsapScheduler, AsapScheduler}), LazyObservable(Message)), ReactiveMP.MessageObservable{Message}(RecentSubject(Message, Subject{Message, AsapScheduler, AsapScheduler}), LazyObservable(Message)), ReactiveMP.MessageObservable{Message}(RecentSubject(Message, Subject{Message, AsapScheduler, AsapScheduler}), LazyObservable(Message)), ReactiveMP.MessageObservable{Message}(RecentSubject(Message, Subject{Message, AsapScheduler, AsapScheduler}), LazyObservable(Message)), ReactiveMP.MessageObservable{Message}(RecentSubject(Message, Subject{Message, AsapScheduler, AsapScheduler}), LazyObservable(Message)), ReactiveMP.MessageObservable{Message}(RecentSubject(Message, Subject{Message, AsapScheduler, AsapScheduler}), LazyObservable(Message)), ReactiveMP.MessageObservable{Message}(RecentSubject(Message, Subject{Message, AsapScheduler, AsapScheduler}), LazyObservable(Message)), ReactiveMP.MessageObservable{Message}(RecentSubject(Message, Subject{Message, AsapScheduler, AsapScheduler}), LazyObservable(Message)), ReactiveMP.MessageObservable{Message}(RecentSubject(Message, Subject{Message, AsapScheduler, AsapScheduler}), LazyObservable(Message))], ReactiveMP.MarginalObservable(RecentSubject(Marginal, Subject{Marginal, AsapScheduler, AsapScheduler}), LazyObservable(Marginal)), name = γ, index = nothing), ReactiveMP.MessageProductContext{GenericProd, CompositeFormConstraint{Tuple{UnspecifiedFormConstraint, RxInfer.EnsureSupportedFunctionalForm}}, FormConstraintCheckLast, ReactiveMP.MessagesProductFromLeftToRight, Nothing, RxInferTraceCallbacks}(GenericProd(), UnspecifiedFormConstraint() :: RxInfer.EnsureSupportedFunctionalForm(:q, :γ, nothing), FormConstraintCheckLast(), ReactiveMP.MessagesProductFromLeftToRight(), nothing, RxInferTraceCallbacks (302 events recorded)
  :before_model_creation
  :after_model_creation
  :before_inference
  :before_iteration
  :before_data_update
  :before_marginal_computation
  :before_product_of_messages
  :before_message_rule_call
  :after_message_rule_call
  :before_product_of_two_messages
  :after_product_of_two_messages
  :before_form_constraint_applied
  :after_form_constraint_applied
  :after_product_of_messages
  :after_marginal_computation
  :on_marginal_update
  :after_data_update
  :after_iteration
  :after_inference
Use `?BeforeModelCreationEvent or @doc(BeforeModelCreationEvent)` to see the documentation for an event.), AbstractMessage[DeferredMessage(GammaShapeRate{Float64}(a=1.0, b=1.0)), DeferredMessage(Gamma{Float64}(α=1.5, θ=0.168510925134612)), DeferredMessage(Gamma{Float64}(α=1.5, θ=0.20741245188238308)), DeferredMessage(Gamma{Float64}(α=1.5, θ=0.19728637633843232)), DeferredMessage(Gamma{Float64}(α=1.5, θ=0.21267078636658743)), DeferredMessage(Gamma{Float64}(α=1.5, θ=0.2217261582265662)), DeferredMessage(Gamma{Float64}(α=1.5, θ=0.17250368906854938)), DeferredMessage(Gamma{Float64}(α=1.5, θ=0.18106809836217666)), DeferredMessage(Gamma{Float64}(α=1.5, θ=0.22273107794346012)), DeferredMessage(Gamma{Float64}(α=1.5, θ=0.2524386224487514)), DeferredMessage(Gamma{Float64}(α=1.5, θ=0.20318138921781104))], Base.UUID("b946fb55-dc58-4b99-bc77-cf8d359057d3")), 0x0000006340dd0727)
  TracedEvent(ReactiveMP.BeforeProductOfMessagesEvent{RandomVariable, ReactiveMP.MessageProductContext{GenericProd, CompositeFormConstraint{Tuple{UnspecifiedFormConstraint, RxInfer.EnsureSupportedFunctionalForm}}, FormConstraintCheckLast, ReactiveMP.MessagesProductFromLeftToRight, Nothing, RxInferTraceCallbacks}, Vector{AbstractMessage}, Base.UUID}(RandomVariable(ReactiveMP.MessageObservable{AbstractMessage}[ReactiveMP.MessageObservable{AbstractMessage}(RecentSubject(AbstractMessage, Subject{AbstractMessage, AsapScheduler, AsapScheduler}), LazyObservable(AbstractMessage)), ReactiveMP.MessageObservable{AbstractMessage}(RecentSubject(AbstractMessage, Subject{AbstractMessage, AsapScheduler, AsapScheduler}), LazyObservable(AbstractMessage)), ReactiveMP.MessageObservable{AbstractMessage}(RecentSubject(AbstractMessage, Subject{AbstractMessage, AsapScheduler, AsapScheduler}), LazyObservable(AbstractMessage)), ReactiveMP.MessageObservable{AbstractMessage}(RecentSubject(AbstractMessage, Subject{AbstractMessage, AsapScheduler, AsapScheduler}), LazyObservable(AbstractMessage)), ReactiveMP.MessageObservable{AbstractMessage}(RecentSubject(AbstractMessage, Subject{AbstractMessage, AsapScheduler, AsapScheduler}), LazyObservable(AbstractMessage)), ReactiveMP.MessageObservable{AbstractMessage}(RecentSubject(AbstractMessage, Subject{AbstractMessage, AsapScheduler, AsapScheduler}), LazyObservable(AbstractMessage)), ReactiveMP.MessageObservable{AbstractMessage}(RecentSubject(AbstractMessage, Subject{AbstractMessage, AsapScheduler, AsapScheduler}), LazyObservable(AbstractMessage)), ReactiveMP.MessageObservable{AbstractMessage}(RecentSubject(AbstractMessage, Subject{AbstractMessage, AsapScheduler, AsapScheduler}), LazyObservable(AbstractMessage)), ReactiveMP.MessageObservable{AbstractMessage}(RecentSubject(AbstractMessage, Subject{AbstractMessage, AsapScheduler, AsapScheduler}), LazyObservable(AbstractMessage)), ReactiveMP.MessageObservable{AbstractMessage}(RecentSubject(AbstractMessage, Subject{AbstractMessage, AsapScheduler, AsapScheduler}), LazyObservable(AbstractMessage)), ReactiveMP.MessageObservable{AbstractMessage}(RecentSubject(AbstractMessage, Subject{AbstractMessage, AsapScheduler, AsapScheduler}), LazyObservable(AbstractMessage))], ReactiveMP.MessageObservable{Message}[ReactiveMP.MessageObservable{Message}(RecentSubject(Message, Subject{Message, AsapScheduler, AsapScheduler}), LazyObservable(Message)), ReactiveMP.MessageObservable{Message}(RecentSubject(Message, Subject{Message, AsapScheduler, AsapScheduler}), LazyObservable(Message)), ReactiveMP.MessageObservable{Message}(RecentSubject(Message, Subject{Message, AsapScheduler, AsapScheduler}), LazyObservable(Message)), ReactiveMP.MessageObservable{Message}(RecentSubject(Message, Subject{Message, AsapScheduler, AsapScheduler}), LazyObservable(Message)), ReactiveMP.MessageObservable{Message}(RecentSubject(Message, Subject{Message, AsapScheduler, AsapScheduler}), LazyObservable(Message)), ReactiveMP.MessageObservable{Message}(RecentSubject(Message, Subject{Message, AsapScheduler, AsapScheduler}), LazyObservable(Message)), ReactiveMP.MessageObservable{Message}(RecentSubject(Message, Subject{Message, AsapScheduler, AsapScheduler}), LazyObservable(Message)), ReactiveMP.MessageObservable{Message}(RecentSubject(Message, Subject{Message, AsapScheduler, AsapScheduler}), LazyObservable(Message)), ReactiveMP.MessageObservable{Message}(RecentSubject(Message, Subject{Message, AsapScheduler, AsapScheduler}), LazyObservable(Message)), ReactiveMP.MessageObservable{Message}(RecentSubject(Message, Subject{Message, AsapScheduler, AsapScheduler}), LazyObservable(Message)), ReactiveMP.MessageObservable{Message}(RecentSubject(Message, Subject{Message, AsapScheduler, AsapScheduler}), LazyObservable(Message))], ReactiveMP.MarginalObservable(RecentSubject(Marginal, Subject{Marginal, AsapScheduler, AsapScheduler}), LazyObservable(Marginal)), name = γ, index = nothing), ReactiveMP.MessageProductContext{GenericProd, CompositeFormConstraint{Tuple{UnspecifiedFormConstraint, RxInfer.EnsureSupportedFunctionalForm}}, FormConstraintCheckLast, ReactiveMP.MessagesProductFromLeftToRight, Nothing, RxInferTraceCallbacks}(GenericProd(), UnspecifiedFormConstraint() :: RxInfer.EnsureSupportedFunctionalForm(:q, :γ, nothing), FormConstraintCheckLast(), ReactiveMP.MessagesProductFromLeftToRight(), nothing, RxInferTraceCallbacks (302 events recorded)
  :before_model_creation
  :after_model_creation
  :before_inference
  :before_iteration
  :before_data_update
  :before_marginal_computation
  :before_product_of_messages
  :before_message_rule_call
  :after_message_rule_call
  :before_product_of_two_messages
  :after_product_of_two_messages
  :before_form_constraint_applied
  :after_form_constraint_applied
  :after_product_of_messages
  :after_marginal_computation
  :on_marginal_update
  :after_data_update
  :after_iteration
  :after_inference
Use `?BeforeModelCreationEvent or @doc(BeforeModelCreationEvent)` to see the documentation for an event.), AbstractMessage[DeferredMessage(GammaShapeRate{Float64}(a=1.0, b=1.0)), DeferredMessage(Gamma{Float64}(α=1.5, θ=0.168510925134612)), DeferredMessage(Gamma{Float64}(α=1.5, θ=0.20741245188238308)), DeferredMessage(Gamma{Float64}(α=1.5, θ=0.19728637633843232)), DeferredMessage(Gamma{Float64}(α=1.5, θ=0.21267078636658743)), DeferredMessage(Gamma{Float64}(α=1.5, θ=0.2217261582265662)), DeferredMessage(Gamma{Float64}(α=1.5, θ=0.17250368906854938)), DeferredMessage(Gamma{Float64}(α=1.5, θ=0.18106809836217666)), DeferredMessage(Gamma{Float64}(α=1.5, θ=0.22273107794346012)), DeferredMessage(Gamma{Float64}(α=1.5, θ=0.2524386224487514)), DeferredMessage(Gamma{Float64}(α=1.5, θ=0.20318138921781104))], Base.UUID("5b62cfbe-088a-449a-8aa3-cb6faa94ecb5")), 0x0000006340dd0d06)
  TracedEvent(ReactiveMP.BeforeMessageRuleCallEvent{ReactiveMP.MessageMapping{GammaShapeRate, Val{:out}, Marginalisation, Nothing, Val{(:α, :β)}, Nothing, Nothing, Nothing, Nothing, RxInferTraceCallbacks}, Nothing, Tuple{Marginal{PointMass{Float64}}, Marginal{PointMass{Float64}}}, Base.UUID}(ReactiveMP.MessageMapping{GammaShapeRate, Val{:out}, Marginalisation, Nothing, Val{(:α, :β)}, Nothing, Nothing, Nothing, Nothing, RxInferTraceCallbacks}(Val{:out}(), Marginalisation(), nothing, Val{(:α, :β)}(), nothing, nothing, nothing, nothing, RxInferTraceCallbacks (302 events recorded)
  :before_model_creation
  :after_model_creation
  :before_inference
  :before_iteration
  :before_data_update
  :before_marginal_computation
  :before_product_of_messages
  :before_message_rule_call
  :after_message_rule_call
  :before_product_of_two_messages
  :after_product_of_two_messages
  :before_form_constraint_applied
  :after_form_constraint_applied
  :after_product_of_messages
  :after_marginal_computation
  :on_marginal_update
  :after_data_update
  :after_iteration
  :after_inference
Use `?BeforeModelCreationEvent or @doc(BeforeModelCreationEvent)` to see the documentation for an event.), nothing, (Marginal(PointMass{Float64}(1.0)), Marginal(PointMass{Float64}(1.0))), Base.UUID("a6235a0c-8850-4b88-b197-fa299c284898")), 0x0000006345032b61)
  TracedEvent(ReactiveMP.AfterMessageRuleCallEvent{ReactiveMP.MessageMapping{GammaShapeRate, Val{:out}, Marginalisation, Nothing, Val{(:α, :β)}, Nothing, Nothing, Nothing, Nothing, RxInferTraceCallbacks}, Nothing, Tuple{Marginal{PointMass{Float64}}, Marginal{PointMass{Float64}}}, GammaShapeRate{Float64}, ReactiveMP.AnnotationDict, Base.UUID}(ReactiveMP.MessageMapping{GammaShapeRate, Val{:out}, Marginalisation, Nothing, Val{(:α, :β)}, Nothing, Nothing, Nothing, Nothing, RxInferTraceCallbacks}(Val{:out}(), Marginalisation(), nothing, Val{(:α, :β)}(), nothing, nothing, nothing, nothing, RxInferTraceCallbacks (302 events recorded)
  :before_model_creation
  :after_model_creation
  :before_inference
  :before_iteration
  :before_data_update
  :before_marginal_computation
  :before_product_of_messages
  :before_message_rule_call
  :after_message_rule_call
  :before_product_of_two_messages
  :after_product_of_two_messages
  :before_form_constraint_applied
  :after_form_constraint_applied
  :after_product_of_messages
  :after_marginal_computation
  :on_marginal_update
  :after_data_update
  :after_iteration
  :after_inference
Use `?BeforeModelCreationEvent or @doc(BeforeModelCreationEvent)` to see the documentation for an event.), nothing, (Marginal(PointMass{Float64}(1.0)), Marginal(PointMass{Float64}(1.0))), GammaShapeRate{Float64}(a=1.0, b=1.0), AnnotationDict(), Base.UUID("a6235a0c-8850-4b88-b197-fa299c284898")), 0x000000634503304f)
  TracedEvent(ReactiveMP.BeforeMessageRuleCallEvent{ReactiveMP.MessageMapping{NormalMeanPrecision, Val{:τ}, Marginalisation, Nothing, Val{(:out, :μ)}, Nothing, Nothing, Nothing, Nothing, RxInferTraceCallbacks}, Nothing, Tuple{Marginal{PointMass{Float64}}, Marginal{NormalMeanVariance{Float64}}}, Base.UUID}(ReactiveMP.MessageMapping{NormalMeanPrecision, Val{:τ}, Marginalisation, Nothing, Val{(:out, :μ)}, Nothing, Nothing, Nothing, Nothing, RxInferTraceCallbacks}(Val{:τ}(), Marginalisation(), nothing, Val{(:out, :μ)}(), nothing, nothing, nothing, nothing, RxInferTraceCallbacks (302 events recorded)
  :before_model_creation
  :after_model_creation
  :before_inference
  :before_iteration
  :before_data_update
  :before_marginal_computation
  :before_product_of_messages
  :before_message_rule_call
  :after_message_rule_call
  :before_product_of_two_messages
  :after_product_of_two_messages
  :before_form_constraint_applied
  :after_form_constraint_applied
  :after_product_of_messages
  :after_marginal_computation
  :on_marginal_update
  :after_data_update
  :after_iteration
  :after_inference
Use `?BeforeModelCreationEvent or @doc(BeforeModelCreationEvent)` to see the documentation for an event.), nothing, (Marginal(PointMass{Float64}(2.197667102692395)), Marginal(NormalMeanVariance{Float64}(μ=0.0, v=1.0e12))), Base.UUID("b0917edb-0f6b-44fc-9703-fef88cf028f3")), 0x0000006347145251)
...

Using trace = true

Instead of creating a RxInferTraceCallbacks instance manually, you can use the trace = true keyword argument in the infer function. This automatically merges a RxInferTraceCallbacks instance with any user-provided callbacks and saves it to the model's metadata:

result = infer(
    model = iid_normal(),
    data = (y = randn(10),),
    constraints = MeanField(),
    iterations = 3,
    initialization = init,
    trace = true,
)


trace = result.model.metadata[:trace]
events = RxInfer.tracedevents(trace)
println("Recorded $(length(events)) events via trace = true")
Recorded 302 events via trace = true

Accessing from model metadata

After model creation, the trace callbacks instance is automatically saved into the model's metadata under the :trace key. This makes it accessible from the inference result without needing to hold onto the callbacks object separately:

result = infer(
    model = iid_normal(),
    data = (y = randn(10),),
    constraints = MeanField(),
    iterations = 3,
    initialization = init,
    callbacks = RxInferTraceCallbacks(),
)


trace = result.model.metadata[:trace]
events = RxInfer.tracedevents(trace)
println("Recorded $(length(events)) events via trace = true")
Recorded 302 events via trace = true

Inspecting traced events

Each TracedEvent has a single field:

  • event::ReactiveMP.Event — the original event object that was passed to the callback

You can retrieve the event name via ReactiveMP.event_name(typeof(traced_event.event)) and access event-specific fields directly on traced_event.event.

using RxInfer.ReactiveMP: event_name
events = RxInfer.tracedevents(trace)

# Filter for specific events
iteration_events = filter(e -> event_name(typeof(e.event)) === :before_iteration, events)
println("Number of iterations: ", length(iteration_events))
Number of iterations: 3

Combining with other callbacks

trace = true is compatible with other callbacks, including benchmark = true and custom callbacks:

result = infer(
    model = iid_normal(),
    data = (y = randn(10),),
    constraints = MeanField(),
    iterations = 3,
    initialization = init,
    trace = true,
    benchmark = true,
)


println("Trace included: ", haskey(result.model.metadata, :trace))
println("Benchmark included: ", haskey(result.model.metadata, :benchmark))
Trace included: true
Benchmark included: true

API Reference

RxInfer.RxInferTraceCallbacksType
RxInferTraceCallbacks()

A callback structure that records all callback events during the inference procedure. Each event is stored as a TracedEvent wrapping the original event object.

After model creation, the trace callbacks instance is automatically saved into the model's metadata under the :trace key (i.e., model.metadata[:trace]), making it accessible from the inference result via result.model.metadata[:trace].

Use RxInfer.tracedevents(callbacks) to retrieve the vector of traced events.

Example

# Create a trace callbacks instance
trace = RxInferTraceCallbacks()

result = infer(
    model = my_model(),
    data = my_data,
    callbacks = trace,
)

# Access the traced events
events = RxInfer.tracedevents(trace)
for event in events
    println(event_name(event.event))
end

# Or access via model metadata
result.model.metadata[:trace] === trace # true
source
RxInfer.TracedEventType
TracedEvent

A single traced event recorded by RxInferTraceCallbacks. Wraps the original event object (a subtype of ReactiveMP.Event).

Fields

  • event::ReactiveMP.Event: the event object that was passed to the callback
  • time_ns::UInt64: the timestamp of the event in nanoseconds, uses time_ns() function from Julia

Use ReactiveMP.event_name(traced_event.event) to retrieve the event name as a Symbol.

source