System identification problem #300
Replies: 5 comments 59 replies
-
I was able to solve the previous error message by restating the model like this: function transition(T, C, R, Φh, Ta, Δt)
return (1 - Δt/(C*R))*T + (Δt/C)*[1/R, 1]'*[Ta, Φh]
end
@model function LGDS(mx, mΦh, mTa, Δt)
# model parameters
C ~ Gamma(7.7, 0.35)
R ~ Gamma(1.6, 0.8)
# initial state
T_prev ~ Normal(μ = 0.0, var = 0.1)
# dynamics
for i in 1:length(mx)
# transition
T[i] ~ Normal(μ = transition(T_prev, C, R, mΦh[i], mTa[i], Δt), var = 0.1)
# observations
mx[i] ~ Normal(μ = T[i], var = 0.1)
T_prev = T[i]
end
end
model = LGDS(Δt = t_int)
conditioned = model | (mx = T_i_sample, mΦh = Φ_h_sample, mTa = ones(length(T_i_sample))*Tambient) Which is now giving the message: |
Beta Was this translation helpful? Give feedback.
-
Hi @langestefan, as @albertpod mentioned this solution can work for your case using CVI. But, keep in mind that the stability of CVI is highly dependent on 1) the choice of hyperparameters (please have a look in the documentation for ProdCVI) and 2) the optimization scheme (i.e., gradient descent).
|
Beta Was this translation helpful? Give feedback.
-
@langestefan Here is another way to run inference on your model with Linearization() or UnscentedTransform() approximation. In your model, I assume that you use Gamma distribution for R and C because of positiveness. Now we can transform R and C to log domain and use function my_transition(T, logC, logR, Φh, Ta, Δt)
return (1 - Δt/(exp(logC)*exp(logR)))*T + (Δt/exp(logC))*[1/exp(logR), 1]'*[Ta, Φh]
end Now we can specify @model function LGDS(mx, mΦh, mTa, Δt)
# model parameters
lC ~ NormalMeanVariance(0, 50)
lR ~ NormalMeanVariance(0, 50)
# initial state
T_prev ~ Normal(μ = 0.0, var = 0.1)
# dynamics
for i in 1:length(mx)
# transition
T[i] ~ Normal(μ = my_transition(T_prev, lC, lR, mΦh[i], mTa[i], Δt), var = 0.1)
# observations
mx[i] ~ Normal(μ = T[i], var = 0.1)
T_prev = T[i]
end
end
my_meta = @meta begin
# my_transition() -> Linearization() #alternative method
my_transition() -> UT()
end Since your model contain loop, we need to initialize messages for init = @initialization begin
μ(lC) =NormalMeanVariance(log(9), 10)
μ(lR) =NormalMeanVariance(log(20), 10)
end
result = infer(
model = LGDS(Δt = t_int,mΦh = Φ_h_sample, mTa = ones(length(T_i_sample))*Tambient, ),
meta = my_meta,
iterations = 51,
initialization = init,
data = (mx = T_i_sample,),
free_energy = true
) Note that you will expect an oscilating behavior in the BFE since we do loopy Belief Propagation here. |
Beta Was this translation helpful? Give feedback.
-
Hi again @albertpod @HoangMHNguyen. I have made quite some progress but I am now a bit stuck getting it to converge. I'm assuming I need to either figure out how to tweak the hyperparameters, which is quite difficult given how many there are, or I need to figure out a better way to specify my model. As you can see there are some matrix multiplications, which I expect is where the problems come from. The model is now of this form, with 3 state variables and 2 output variables: (I have more than triple checked all the equations in the code, they should be correct.) The error is always the same:
Stacktrace{
"name": "ErrorException",
"message": " Failed to compute node bound free energy component. The result is `NaN`.
Use `objective_diagnostics` keyword argument in the `inference` function to suppress this error.
fform = MvNormalMeanCovariance, neighbors = Tuple{GraphPPL.NodeLabel, GraphPPL.EdgeLabel, GraphPPL.NodeData}[(T_prev_31, out, NodeData in context with properties name = T_prev, index = nothing with extra: {:bfe_stream = ProxyObservable(CountingReal, MapProxy(Marginal)), :rmp_variable = 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{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)))}), (constvar_32_33, μ, NodeData in context with properties name = constvar_32, index = nothing with extra: {:rmp_variable = ConstVariable(ReactiveMP.MarginalObservable(RecentSubject(Marginal, Subject{Marginal, AsapScheduler, AsapScheduler}), LazyObservable(Marginal)), ReactiveMP.MessageObservable{AbstractMessage}(RecentSubject(AbstractMessage, Subject{AbstractMessage, AsapScheduler, AsapScheduler}), LazyObservable(AbstractMessage)), [293.15, 293.15, 293.15], 1)}), (constvar_34_35, Σ, NodeData in context with properties name = constvar_34, index = nothing with extra: {:rmp_variable = ConstVariable(ReactiveMP.MarginalObservable(RecentSubject(Marginal, Subject{Marginal, AsapScheduler, AsapScheduler}), LazyObservable(Marginal)), ReactiveMP.MessageObservable{AbstractMessage}(RecentSubject(AbstractMessage, Subject{AbstractMessage, AsapScheduler, AsapScheduler}), LazyObservable(AbstractMessage)), [1.0 0.0 0.0; 0.0 1.0 0.0; 0.0 0.0 1.0], 1)})]
",
"stack": " Failed to compute node bound free energy component. The result is `NaN`.
Use `objective_diagnostics` keyword argument in the `inference` function to suppress this error.
fform = MvNormalMeanCovariance, neighbors = Tuple{GraphPPL.NodeLabel, GraphPPL.EdgeLabel, GraphPPL.NodeData}[(T_prev_31, out, NodeData in context with properties name = T_prev, index = nothing with extra: {:bfe_stream = ProxyObservable(CountingReal, MapProxy(Marginal)), :rmp_variable = 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{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)))}), (constvar_32_33, μ, NodeData in context with properties name = constvar_32, index = nothing with extra: {:rmp_variable = ConstVariable(ReactiveMP.MarginalObservable(RecentSubject(Marginal, Subject{Marginal, AsapScheduler, AsapScheduler}), LazyObservable(Marginal)), ReactiveMP.MessageObservable{AbstractMessage}(RecentSubject(AbstractMessage, Subject{AbstractMessage, AsapScheduler, AsapScheduler}), LazyObservable(AbstractMessage)), [293.15, 293.15, 293.15], 1)}), (constvar_34_35, Σ, NodeData in context with properties name = constvar_34, index = nothing with extra: {:rmp_variable = ConstVariable(ReactiveMP.MarginalObservable(RecentSubject(Marginal, Subject{Marginal, AsapScheduler, AsapScheduler}), LazyObservable(Marginal)), ReactiveMP.MessageObservable{AbstractMessage}(RecentSubject(AbstractMessage, Subject{AbstractMessage, AsapScheduler, AsapScheduler}), LazyObservable(AbstractMessage)), [1.0 0.0 0.0; 0.0 1.0 0.0; 0.0 0.0 1.0], 1)})]
Stacktrace:
[1] try_yieldto(undo::typeof(Base.ensure_rescheduled))
@ Base .\\task.jl:931
[2] wait()
@ Base .\\task.jl:995
[3] wait(c::Condition; first::Bool)
@ Base .\\condition.jl:130
[4] wait
@ .\\condition.jl:125 [inlined]
[5] limitstack(callback::RxInfer.var\"#7#8\"{Rocket.RecentSubjectInstance{AbstractMessage, Subject{AbstractMessage, AsapScheduler, AsapScheduler}}, DefferedMessage{Tuple{ReactiveMP.MessageObservable{Message}}, Tuple{ReactiveMP.MarginalObservable}, ReactiveMP.MessageMapping{DeltaFn{typeof(transition)}, Tuple{Val{:in}, Int64}, Marginalisation, Val{(:in,)}, Val{(:ins,)}, DeltaMeta{Unscented{Float64, Float64, Float64, Nothing}, Nothing}, Nothing, DeltaFnNode{typeof(transition), FixedArguments.FixedCallable{typeof(transition), Tuple{FixedArguments.FixedArgument{FixedArguments.FixedPosition{5}, ConstVariable}, FixedArguments.FixedArgument{FixedArguments.FixedPosition{6}, ConstVariable}, FixedArguments.FixedArgument{FixedArguments.FixedPosition{7}, ConstVariable}, FixedArguments.FixedArgument{FixedArguments.FixedPosition{8}, ConstVariable}, FixedArguments.FixedArgument{FixedArguments.FixedPosition{9}, ConstVariable}}, typeof(ReactiveMP.__unpack_latest_static)}, 4, Tuple{FixedArguments.FixedArgument{FixedArguments.FixedPosition{5}, ConstVariable}, FixedArguments.FixedArgument{FixedArguments.FixedPosition{6}, ConstVariable}, FixedArguments.FixedArgument{FixedArguments.FixedPosition{7}, ConstVariable}, FixedArguments.FixedArgument{FixedArguments.FixedPosition{8}, ConstVariable}, FixedArguments.FixedArgument{FixedArguments.FixedPosition{9}, ConstVariable}}, ReactiveMP.FactorNodeLocalClusters{Tuple{ReactiveMP.FactorNodeLocalMarginal, ReactiveMP.FactorNodeLocalMarginal}, Nothing}}}}}, instance::RxInfer.LimitStackScheduler)
@ RxInfer C:\\Users\\lange\\.julia\\packages\\RxInfer\\AszMu\\src\\rocket.jl:64
[6] scheduled_next!
@ C:\\Users\\lange\\.julia\\packages\\RxInfer\\AszMu\\src\\rocket.jl:86 [inlined]
[7] actor_on_next!
@ C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\actor.jl:255 [inlined]
[8] next!
@ C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\actor.jl:203 [inlined]
[9] on_next!
@ C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\observable\\scheduled.jl:12 [inlined]
[10] next!(actor::Rocket.ScheduledActor{AbstractMessage, RxInfer.LimitStackScheduler, Rocket.RecentSubjectInstance{AbstractMessage, Subject{AbstractMessage, AsapScheduler, AsapScheduler}}}, data::DefferedMessage{Tuple{ReactiveMP.MessageObservable{Message}}, Tuple{ReactiveMP.MarginalObservable}, ReactiveMP.MessageMapping{DeltaFn{typeof(transition)}, Tuple{Val{:in}, Int64}, Marginalisation, Val{(:in,)}, Val{(:ins,)}, DeltaMeta{Unscented{Float64, Float64, Float64, Nothing}, Nothing}, Nothing, DeltaFnNode{typeof(transition), FixedArguments.FixedCallable{typeof(transition), Tuple{FixedArguments.FixedArgument{FixedArguments.FixedPosition{5}, ConstVariable}, FixedArguments.FixedArgument{FixedArguments.FixedPosition{6}, ConstVariable}, FixedArguments.FixedArgument{FixedArguments.FixedPosition{7}, ConstVariable}, FixedArguments.FixedArgument{FixedArguments.FixedPosition{8}, ConstVariable}, FixedArguments.FixedArgument{FixedArguments.FixedPosition{9}, ConstVariable}}, typeof(ReactiveMP.__unpack_latest_static)}, 4, Tuple{FixedArguments.FixedArgument{FixedArguments.FixedPosition{5}, ConstVariable}, FixedArguments.FixedArgument{FixedArguments.FixedPosition{6}, ConstVariable}, FixedArguments.FixedArgument{FixedArguments.FixedPosition{7}, ConstVariable}, FixedArguments.FixedArgument{FixedArguments.FixedPosition{8}, ConstVariable}, FixedArguments.FixedArgument{FixedArguments.FixedPosition{9}, ConstVariable}}, ReactiveMP.FactorNodeLocalClusters{Tuple{ReactiveMP.FactorNodeLocalMarginal, ReactiveMP.FactorNodeLocalMarginal}, Nothing}}}})
@ Rocket C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\actor.jl:206
[11] on_next!
@ C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\operators\\map.jl:62 [inlined]
[12] next!
@ C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\actor.jl:206 [inlined]
--- the last 2 lines are repeated 1 more time ---
[15] next_received!
@ C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\observable\\combined.jl:101 [inlined]
[16] on_next!
@ C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\observable\\combined.jl:68 [inlined]
[17] next!
@ C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\actor.jl:206 [inlined]
--- the last 3 lines are repeated 1 more time ---
[21] next_received!(wrapper::Rocket.CombineLatestUpdatesActorWrapper{Tuple{ReactiveMP.MarginalObservable}, Rocket.CombineLatestInnerActor{Tuple{ReactiveMP.MarginalObservable}, Rocket.CombineLatestActorWrapper{Rocket.MStorage2{Tuple{ReactiveMP.MessageObservable{Message}}, Tuple{ReactiveMP.MarginalObservable}}, Rocket.CombineLatestInnerActor{Tuple{Tuple{ReactiveMP.MessageObservable{Message}}, Tuple{ReactiveMP.MarginalObservable}}, Rocket.CombineLatestActorWrapper{Rocket.MStorage2{Tuple{Tuple{ReactiveMP.MessageObservable{Message}}, Tuple{ReactiveMP.MarginalObservable}}, NTuple{5, AbstractMessage}}, Rocket.MapActor{Tuple{Tuple{Tuple{ReactiveMP.MessageObservable{Message}}, Tuple{ReactiveMP.MarginalObservable}}, NTuple{5, AbstractMessage}}, Rocket.MapActor{Tuple{Tuple{ReactiveMP.MessageObservable{Message}}, Tuple{ReactiveMP.MarginalObservable}}, Rocket.ScheduledActor{AbstractMessage, RxInfer.LimitStackScheduler, Rocket.RecentSubjectInstance{AbstractMessage, Subject{AbstractMessage, AsapScheduler, AsapScheduler}}}, ReactiveMP.var\"#507#509\"{ReactiveMP.MessageMapping{DeltaFn{typeof(transition)}, Tuple{Val{:in}, Int64}, Marginalisation, Val{(:in,)}, Val{(:ins,)}, DeltaMeta{Unscented{Float64, Float64, Float64, Nothing}, Nothing}, Nothing, DeltaFnNode{typeof(transition), FixedArguments.FixedCallable{typeof(transition), Tuple{FixedArguments.FixedArgument{FixedArguments.FixedPosition{5}, ConstVariable}, FixedArguments.FixedArgument{FixedArguments.FixedPosition{6}, ConstVariable}, FixedArguments.FixedArgument{FixedArguments.FixedPosition{7}, ConstVariable}, FixedArguments.FixedArgument{FixedArguments.FixedPosition{8}, ConstVariable}, FixedArguments.FixedArgument{FixedArguments.FixedPosition{9}, ConstVariable}}, typeof(ReactiveMP.__unpack_latest_static)}, 4, Tuple{FixedArguments.FixedArgument{FixedArguments.FixedPosition{5}, ConstVariable}, FixedArguments.FixedArgument{FixedArguments.FixedPosition{6}, ConstVariable}, FixedArguments.FixedArgument{FixedArguments.FixedPosition{7}, ConstVariable}, FixedArguments.FixedArgument{FixedArguments.FixedPosition{8}, ConstVariable}, FixedArguments.FixedArgument{FixedArguments.FixedPosition{9}, ConstVariable}}, ReactiveMP.FactorNodeLocalClusters{Tuple{ReactiveMP.FactorNodeLocalMarginal, ReactiveMP.FactorNodeLocalMarginal}, Nothing}}}}}, typeof(first)}, PushEach, Rocket.UInt8UpdatesStatus}}, PushNew, Rocket.UInt8UpdatesStatus}}, PushNew, Rocket.UInt8UpdatesStatus, typeof(identity), Nothing}, data::Marginal{JointNormal{MvNormalMeanCovariance{Float64, Vector{Float64}, Matrix{Float64}}, NTuple{4, Tuple{Int64}}}, Nothing}, index::Int64)
@ Rocket C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\observable\\combined_updates.jl:72
[22] on_next!
@ C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\observable\\combined_updates.jl:34 [inlined]
[23] scheduled_next!(actor::Rocket.CombineLatestUpdatesInnerActor{Marginal, Rocket.CombineLatestUpdatesActorWrapper{Tuple{ReactiveMP.MarginalObservable}, Rocket.CombineLatestInnerActor{Tuple{ReactiveMP.MarginalObservable}, Rocket.CombineLatestActorWrapper{Rocket.MStorage2{Tuple{ReactiveMP.MessageObservable{Message}}, Tuple{ReactiveMP.MarginalObservable}}, Rocket.CombineLatestInnerActor{Tuple{Tuple{ReactiveMP.MessageObservable{Message}}, Tuple{ReactiveMP.MarginalObservable}}, Rocket.CombineLatestActorWrapper{Rocket.MStorage2{Tuple{Tuple{ReactiveMP.MessageObservable{Message}}, Tuple{ReactiveMP.MarginalObservable}}, NTuple{5, AbstractMessage}}, Rocket.MapActor{Tuple{Tuple{Tuple{ReactiveMP.MessageObservable{Message}}, Tuple{ReactiveMP.MarginalObservable}}, NTuple{5, AbstractMessage}}, Rocket.MapActor{Tuple{Tuple{ReactiveMP.MessageObservable{Message}}, Tuple{ReactiveMP.MarginalObservable}}, Rocket.ScheduledActor{AbstractMessage, RxInfer.LimitStackScheduler, Rocket.RecentSubjectInstance{AbstractMessage, Subject{AbstractMessage, AsapScheduler, AsapScheduler}}}, ReactiveMP.var\"#507#509\"{ReactiveMP.MessageMapping{DeltaFn{typeof(transition)}, Tuple{Val{:in}, Int64}, Marginalisation, Val{(:in,)}, Val{(:ins,)}, DeltaMeta{Unscented{Float64, Float64, Float64, Nothing}, Nothing}, Nothing, DeltaFnNode{typeof(transition), FixedArguments.FixedCallable{typeof(transition), Tuple{FixedArguments.FixedArgument{FixedArguments.FixedPosition{5}, ConstVariable}, FixedArguments.FixedArgument{FixedArguments.FixedPosition{6}, ConstVariable}, FixedArguments.FixedArgument{FixedArguments.FixedPosition{7}, ConstVariable}, FixedArguments.FixedArgument{FixedArguments.FixedPosition{8}, ConstVariable}, FixedArguments.FixedArgument{FixedArguments.FixedPosition{9}, ConstVariable}}, typeof(ReactiveMP.__unpack_latest_static)}, 4, Tuple{FixedArguments.FixedArgument{FixedArguments.FixedPosition{5}, ConstVariable}, FixedArguments.FixedArgument{FixedArguments.FixedPosition{6}, ConstVariable}, FixedArguments.FixedArgument{FixedArguments.FixedPosition{7}, ConstVariable}, FixedArguments.FixedArgument{FixedArguments.FixedPosition{8}, ConstVariable}, FixedArguments.FixedArgument{FixedArguments.FixedPosition{9}, ConstVariable}}, ReactiveMP.FactorNodeLocalClusters{Tuple{ReactiveMP.FactorNodeLocalMarginal, ReactiveMP.FactorNodeLocalMarginal}, Nothing}}}}}, typeof(first)}, PushEach, Rocket.UInt8UpdatesStatus}}, PushNew, Rocket.UInt8UpdatesStatus}}, PushNew, Rocket.UInt8UpdatesStatus, typeof(identity), Nothing}}, value::Marginal{JointNormal{MvNormalMeanCovariance{Float64, Vector{Float64}, Matrix{Float64}}, NTuple{4, Tuple{Int64}}}, Nothing}, ::AsapScheduler)
@ Rocket C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\schedulers\\asap.jl:23
[24] on_next!(subject::Subject{Marginal, AsapScheduler, AsapScheduler}, data::Marginal{JointNormal{MvNormalMeanCovariance{Float64, Vector{Float64}, Matrix{Float64}}, NTuple{4, Tuple{Int64}}}, Nothing})
@ Rocket C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\subjects\\subject.jl:62
[25] actor_on_next!(::BaseActorTrait{Marginal}, actor::Subject{Marginal, AsapScheduler, AsapScheduler}, data::Marginal{JointNormal{MvNormalMeanCovariance{Float64, Vector{Float64}, Matrix{Float64}}, NTuple{4, Tuple{Int64}}}, Nothing})
@ Rocket C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\actor.jl:250
[26] next!
@ C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\actor.jl:202 [inlined]
[27] on_next!
@ C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\subjects\\recent.jl:62 [inlined]
[28] actor_on_next!
@ C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\actor.jl:250 [inlined]
[29] next!(actor::Rocket.RecentSubjectInstance{Marginal, Subject{Marginal, AsapScheduler, AsapScheduler}}, data::Marginal{JointNormal{MvNormalMeanCovariance{Float64, Vector{Float64}, Matrix{Float64}}, NTuple{4, Tuple{Int64}}}, Nothing})
@ Rocket C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\actor.jl:202
[30] next_received!(wrapper::Rocket.CombineLatestUpdatesActorWrapper{Tuple{ProxyObservable{Tuple{ReactiveMP.MessageObservable{Message}, ReactiveMP.ManyOfObservable{Rocket.CombineLatestUpdatesObservable{NTuple{4, ReactiveMP.MessageObservable{Message}}, NTuple{4, ReactiveMP.MessageObservable{Message}}, PushNew, typeof(identity), Nothing}}}, Rocket.CombineLatestObservable{Tuple{Tuple{ReactiveMP.MessageObservable{Message}, ReactiveMP.ManyOfObservable{Rocket.CombineLatestUpdatesObservable{NTuple{4, ReactiveMP.MessageObservable{Message}}, NTuple{4, ReactiveMP.MessageObservable{Message}}, PushNew, typeof(identity), Nothing}}}, NTuple{5, AbstractMessage}}, Tuple{Rocket.CombineLatestUpdatesObservable{Tuple{ReactiveMP.MessageObservable{Message}, ReactiveMP.ManyOfObservable{Rocket.CombineLatestUpdatesObservable{NTuple{4, ReactiveMP.MessageObservable{Message}}, NTuple{4, ReactiveMP.MessageObservable{Message}}, PushNew, typeof(identity), Nothing}}}, Tuple{ReactiveMP.MessageObservable{Message}, ReactiveMP.ManyOfObservable{Rocket.CombineLatestUpdatesObservable{NTuple{4, ReactiveMP.MessageObservable{Message}}, NTuple{4, ReactiveMP.MessageObservable{Message}}, PushNew, typeof(identity), Nothing}}}, PushNew, typeof(identity), Nothing}, Rocket.CombineLatestObservable{NTuple{5, AbstractMessage}, NTuple{5, ReactiveMP.MessageObservable{AbstractMessage}}, PushNew}}, PushEach}, Rocket.MapProxy{Tuple{Tuple{ReactiveMP.MessageObservable{Message}, ReactiveMP.ManyOfObservable{Rocket.CombineLatestUpdatesObservable{NTuple{4, ReactiveMP.MessageObservable{Message}}, NTuple{4, ReactiveMP.MessageObservable{Message}}, PushNew, typeof(identity), Nothing}}}, NTuple{5, AbstractMessage}}, typeof(first)}}, ProxyObservable{Nothing, Rocket.CombineLatestObservable{Tuple{Nothing, NTuple{5, AbstractMessage}}, Tuple{SingleObservable{Nothing, AsapScheduler}, Rocket.CombineLatestObservable{NTuple{5, AbstractMessage}, NTuple{5, ReactiveMP.MessageObservable{AbstractMessage}}, PushNew}}, PushEach}, Rocket.MapProxy{Tuple{Nothing, NTuple{5, AbstractMessage}}, typeof(first)}}}, Rocket.RecentSubjectInstance{Marginal, Subject{Marginal, AsapScheduler, AsapScheduler}}, PushNew, Rocket.UInt8UpdatesStatus, ReactiveMP.MarginalMapping{DeltaFn{typeof(transition)}, Val{:ins}, Val{(:out, :ins)}, Nothing, DeltaMeta{Unscented{Float64, Float64, Float64, Nothing}, Nothing}, DeltaFnNode{typeof(transition), FixedArguments.FixedCallable{typeof(transition), Tuple{FixedArguments.FixedArgument{FixedArguments.FixedPosition{5}, ConstVariable}, FixedArguments.FixedArgument{FixedArguments.FixedPosition{6}, ConstVariable}, FixedArguments.FixedArgument{FixedArguments.FixedPosition{7}, ConstVariable}, FixedArguments.FixedArgument{FixedArguments.FixedPosition{8}, ConstVariable}, FixedArguments.FixedArgument{FixedArguments.FixedPosition{9}, ConstVariable}}, typeof(ReactiveMP.__unpack_latest_static)}, 4, Tuple{FixedArguments.FixedArgument{FixedArguments.FixedPosition{5}, ConstVariable}, FixedArguments.FixedArgument{FixedArguments.FixedPosition{6}, ConstVariable}, FixedArguments.FixedArgument{FixedArguments.FixedPosition{7}, ConstVariable}, FixedArguments.FixedArgument{FixedArguments.FixedPosition{8}, ConstVariable}, FixedArguments.FixedArgument{FixedArguments.FixedPosition{9}, ConstVariable}}, ReactiveMP.FactorNodeLocalClusters{Tuple{ReactiveMP.FactorNodeLocalMarginal, ReactiveMP.FactorNodeLocalMarginal}, Nothing}}}, typeof(ReactiveMP.reset_vstatus)}, data::Tuple{ReactiveMP.MessageObservable{Message}, ReactiveMP.ManyOfObservable{Rocket.CombineLatestUpdatesObservable{NTuple{4, ReactiveMP.MessageObservable{Message}}, NTuple{4, ReactiveMP.MessageObservable{Message}}, PushNew, typeof(identity), Nothing}}}, index::Int64)
@ Rocket C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\observable\\combined_updates.jl:72
[31] on_next!
@ C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\observable\\combined_updates.jl:34 [inlined]
[32] next!
@ C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\actor.jl:206 [inlined]
[33] on_next!
@ C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\operators\\map.jl:62 [inlined]
[34] next!
@ C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\actor.jl:206 [inlined]
[35] next_received!
@ C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\observable\\combined.jl:101 [inlined]
[36] on_next!
@ C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\observable\\combined.jl:68 [inlined]
[37] next!
@ C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\actor.jl:206 [inlined]
[38] next_received!
@ C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\observable\\combined_updates.jl:72 [inlined]
[39] on_next!
@ C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\observable\\combined_updates.jl:34 [inlined]
[40] scheduled_next!(actor::Rocket.CombineLatestUpdatesInnerActor{Message, Rocket.CombineLatestUpdatesActorWrapper{Tuple{ReactiveMP.MessageObservable{Message}, ReactiveMP.ManyOfObservable{Rocket.CombineLatestUpdatesObservable{NTuple{4, ReactiveMP.MessageObservable{Message}}, NTuple{4, ReactiveMP.MessageObservable{Message}}, PushNew, typeof(identity), Nothing}}}, Rocket.CombineLatestInnerActor{Tuple{ReactiveMP.MessageObservable{Message}, ReactiveMP.ManyOfObservable{Rocket.CombineLatestUpdatesObservable{NTuple{4, ReactiveMP.MessageObservable{Message}}, NTuple{4, ReactiveMP.MessageObservable{Message}}, PushNew, typeof(identity), Nothing}}}, Rocket.CombineLatestActorWrapper{Rocket.MStorage2{Tuple{ReactiveMP.MessageObservable{Message}, ReactiveMP.ManyOfObservable{Rocket.CombineLatestUpdatesObservable{NTuple{4, ReactiveMP.MessageObservable{Message}}, NTuple{4, ReactiveMP.MessageObservable{Message}}, PushNew, typeof(identity), Nothing}}}, NTuple{5, AbstractMessage}}, Rocket.MapActor{Tuple{Tuple{ReactiveMP.MessageObservable{Message}, ReactiveMP.ManyOfObservable{Rocket.CombineLatestUpdatesObservable{NTuple{4, ReactiveMP.MessageObservable{Message}}, NTuple{4, ReactiveMP.MessageObservable{Message}}, PushNew, typeof(identity), Nothing}}}, NTuple{5, AbstractMessage}}, Rocket.CombineLatestUpdatesInnerActor{Tuple{ReactiveMP.MessageObservable{Message}, ReactiveMP.ManyOfObservable{Rocket.CombineLatestUpdatesObservable{NTuple{4, ReactiveMP.MessageObservable{Message}}, NTuple{4, ReactiveMP.MessageObservable{Message}}, PushNew, typeof(identity), Nothing}}}, Rocket.CombineLatestUpdatesActorWrapper{Tuple{ProxyObservable{Tuple{ReactiveMP.MessageObservable{Message}, ReactiveMP.ManyOfObservable{Rocket.CombineLatestUpdatesObservable{NTuple{4, ReactiveMP.MessageObservable{Message}}, NTuple{4, ReactiveMP.MessageObservable{Message}}, PushNew, typeof(identity), Nothing}}}, Rocket.CombineLatestObservable{Tuple{Tuple{ReactiveMP.MessageObservable{Message}, ReactiveMP.ManyOfObservable{Rocket.CombineLatestUpdatesObservable{NTuple{4, ReactiveMP.MessageObservable{Message}}, NTuple{4, ReactiveMP.MessageObservable{Message}}, PushNew, typeof(identity), Nothing}}}, NTuple{5, AbstractMessage}}, Tuple{Rocket.CombineLatestUpdatesObservable{Tuple{ReactiveMP.MessageObservable{Message}, ReactiveMP.ManyOfObservable{Rocket.CombineLatestUpdatesObservable{NTuple{4, ReactiveMP.MessageObservable{Message}}, NTuple{4, ReactiveMP.MessageObservable{Message}}, PushNew, typeof(identity), Nothing}}}, Tuple{ReactiveMP.MessageObservable{Message}, ReactiveMP.ManyOfObservable{Rocket.CombineLatestUpdatesObservable{NTuple{4, ReactiveMP.MessageObservable{Message}}, NTuple{4, ReactiveMP.MessageObservable{Message}}, PushNew, typeof(identity), Nothing}}}, PushNew, typeof(identity), Nothing}, Rocket.CombineLatestObservable{NTuple{5, AbstractMessage}, NTuple{5, ReactiveMP.MessageObservable{AbstractMessage}}, PushNew}}, PushEach}, Rocket.MapProxy{Tuple{Tuple{ReactiveMP.MessageObservable{Message}, ReactiveMP.ManyOfObservable{Rocket.CombineLatestUpdatesObservable{NTuple{4, ReactiveMP.MessageObservable{Message}}, NTuple{4, ReactiveMP.MessageObservable{Message}}, PushNew, typeof(identity), Nothing}}}, NTuple{5, AbstractMessage}}, typeof(first)}}, ProxyObservable{Nothing, Rocket.CombineLatestObservable{Tuple{Nothing, NTuple{5, AbstractMessage}}, Tuple{SingleObservable{Nothing, AsapScheduler}, Rocket.CombineLatestObservable{NTuple{5, AbstractMessage}, NTuple{5, ReactiveMP.MessageObservable{AbstractMessage}}, PushNew}}, PushEach}, Rocket.MapProxy{Tuple{Nothing, NTuple{5, AbstractMessage}}, typeof(first)}}}, Rocket.RecentSubjectInstance{Marginal, Subject{Marginal, AsapScheduler, AsapScheduler}}, PushNew, Rocket.UInt8UpdatesStatus, ReactiveMP.MarginalMapping{DeltaFn{typeof(transition)}, Val{:ins}, Val{(:out, :ins)}, Nothing, DeltaMeta{Unscented{Float64, Float64, Float64, Nothing}, Nothing}, DeltaFnNode{typeof(transition), FixedArguments.FixedCallable{typeof(transition), Tuple{FixedArguments.FixedArgument{FixedArguments.FixedPosition{5}, ConstVariable}, FixedArguments.FixedArgument{FixedArguments.FixedPosition{6}, ConstVariable}, FixedArguments.FixedArgument{FixedArguments.FixedPosition{7}, ConstVariable}, FixedArguments.FixedArgument{FixedArguments.FixedPosition{8}, ConstVariable}, FixedArguments.FixedArgument{FixedArguments.FixedPosition{9}, ConstVariable}}, typeof(ReactiveMP.__unpack_latest_static)}, 4, Tuple{FixedArguments.FixedArgument{FixedArguments.FixedPosition{5}, ConstVariable}, FixedArguments.FixedArgument{FixedArguments.FixedPosition{6}, ConstVariable}, FixedArguments.FixedArgument{FixedArguments.FixedPosition{7}, ConstVariable}, FixedArguments.FixedArgument{FixedArguments.FixedPosition{8}, ConstVariable}, FixedArguments.FixedArgument{FixedArguments.FixedPosition{9}, ConstVariable}}, ReactiveMP.FactorNodeLocalClusters{Tuple{ReactiveMP.FactorNodeLocalMarginal, ReactiveMP.FactorNodeLocalMarginal}, Nothing}}}, typeof(ReactiveMP.reset_vstatus)}}, typeof(first)}, PushEach, Rocket.UInt8UpdatesStatus}}, PushNew, Rocket.UInt8UpdatesStatus, typeof(identity), Nothing}}, value::Message{MvNormalMeanCovariance{Float64, Vector{Float64}, Matrix{Float64}}, Nothing}, ::AsapScheduler)
@ Rocket C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\schedulers\\asap.jl:23
[41] on_next!(subject::Subject{Message, AsapScheduler, AsapScheduler}, data::Message{MvNormalMeanCovariance{Float64, Vector{Float64}, Matrix{Float64}}, Nothing})
@ Rocket C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\subjects\\subject.jl:62
[42] actor_on_next!(::BaseActorTrait{Message}, actor::Subject{Message, AsapScheduler, AsapScheduler}, data::Message{MvNormalMeanCovariance{Float64, Vector{Float64}, Matrix{Float64}}, Nothing})
@ Rocket C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\actor.jl:250
[43] next!
@ C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\actor.jl:202 [inlined]
[44] on_next!
@ C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\subjects\\recent.jl:62 [inlined]
[45] actor_on_next!
@ C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\actor.jl:250 [inlined]
[46] next!(actor::Rocket.RecentSubjectInstance{Message, Subject{Message, AsapScheduler, AsapScheduler}}, data::Message{MvNormalMeanCovariance{Float64, Vector{Float64}, Matrix{Float64}}, Nothing})
@ Rocket C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\actor.jl:202
[47] next_received!(wrapper::Rocket.CollectLatestObservableWrapper{AbstractMessage, Rocket.RecentSubjectInstance{Message, Subject{Message, AsapScheduler, AsapScheduler}}, Vector{AbstractMessage}, BitVector, Vector{Teardown}, ReactiveMP.var\"#15#17\"{GenericProd, UnspecifiedFormConstraint}, typeof(ReactiveMP.reset_vstatus)}, data::DefferedMessage{Tuple{ReactiveMP.MessageObservable{Message}}, Tuple{ReactiveMP.MarginalObservable}, ReactiveMP.MessageMapping{MvNormalMeanPrecision, Val{:μ}, Marginalisation, Val{(:out,)}, Val{(:Λ,)}, Nothing, Nothing, Nothing}}, index::CartesianIndex{1})
@ Rocket C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\observable\\collected.jl:104
[48] on_next!
@ C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\observable\\collected.jl:93 [inlined]
[49] scheduled_next!(actor::Rocket.CollectLatestObservableInnerActor{AbstractMessage, CartesianIndex{1}, Rocket.CollectLatestObservableWrapper{AbstractMessage, Rocket.RecentSubjectInstance{Message, Subject{Message, AsapScheduler, AsapScheduler}}, Vector{AbstractMessage}, BitVector, Vector{Teardown}, ReactiveMP.var\"#15#17\"{GenericProd, UnspecifiedFormConstraint}, typeof(ReactiveMP.reset_vstatus)}}, value::DefferedMessage{Tuple{ReactiveMP.MessageObservable{Message}}, Tuple{ReactiveMP.MarginalObservable}, ReactiveMP.MessageMapping{MvNormalMeanPrecision, Val{:μ}, Marginalisation, Val{(:out,)}, Val{(:Λ,)}, Nothing, Nothing, Nothing}}, ::AsapScheduler)
@ Rocket C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\schedulers\\asap.jl:23
[50] on_next!(subject::Subject{AbstractMessage, AsapScheduler, AsapScheduler}, data::DefferedMessage{Tuple{ReactiveMP.MessageObservable{Message}}, Tuple{ReactiveMP.MarginalObservable}, ReactiveMP.MessageMapping{MvNormalMeanPrecision, Val{:μ}, Marginalisation, Val{(:out,)}, Val{(:Λ,)}, Nothing, Nothing, Nothing}})
@ Rocket C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\subjects\\subject.jl:62
[51] actor_on_next!
@ C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\actor.jl:250 [inlined]
[52] next!
@ C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\actor.jl:202 [inlined]
[53] on_next!
@ C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\subjects\\recent.jl:62 [inlined]
[54] #7
@ C:\\Users\\lange\\.julia\\packages\\RxInfer\\AszMu\\src\\rocket.jl:86 [inlined]
[55] limitstack(callback::RxInfer.var\"#7#8\"{Rocket.RecentSubjectInstance{AbstractMessage, Subject{AbstractMessage, AsapScheduler, AsapScheduler}}, DefferedMessage{Tuple{ReactiveMP.MessageObservable{Message}}, Tuple{ReactiveMP.MarginalObservable}, ReactiveMP.MessageMapping{MvNormalMeanPrecision, Val{:μ}, Marginalisation, Val{(:out,)}, Val{(:Λ,)}, Nothing, Nothing, Nothing}}}, instance::RxInfer.LimitStackScheduler)
@ RxInfer C:\\Users\\lange\\.julia\\packages\\RxInfer\\AszMu\\src\\rocket.jl:52
[56] scheduled_next!
@ C:\\Users\\lange\\.julia\\packages\\RxInfer\\AszMu\\src\\rocket.jl:86 [inlined]
[57] actor_on_next!
@ C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\actor.jl:255 [inlined]
[58] next!
@ C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\actor.jl:203 [inlined]
[59] on_next!
@ C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\observable\\scheduled.jl:12 [inlined]
--- the last 28 lines are repeated 1 more time ---
--- the last 78 lines are repeated 48 more times ---
[3832] next!
@ C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\actor.jl:206 [inlined]
[3833] on_next!
@ C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\operators\\map.jl:62 [inlined]
[3834] next!
@ C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\actor.jl:206 [inlined]
[3835] next_received!
@ C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\observable\\combined.jl:101 [inlined]
[3836] on_next!
@ C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\observable\\combined.jl:68 [inlined]
[3837] next!
@ C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\actor.jl:206 [inlined]
[3838] next_received!
@ C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\observable\\combined_updates.jl:72 [inlined]
[3839] on_next!
@ C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\observable\\combined_updates.jl:34 [inlined]
[3840] scheduled_next!(actor::Rocket.CombineLatestUpdatesInnerActor{Message, Rocket.CombineLatestUpdatesActorWrapper{Tuple{ReactiveMP.MessageObservable{Message}, ReactiveMP.MessageObservable{AbstractMessage}}, Rocket.CombineLatestInnerActor{Tuple{ReactiveMP.MessageObservable{Message}, ReactiveMP.MessageObservable{AbstractMessage}}, Rocket.CombineLatestActorWrapper{Rocket.MStorage2{Tuple{ReactiveMP.MessageObservable{Message}, ReactiveMP.MessageObservable{AbstractMessage}}, Nothing}, Rocket.MapActor{Tuple{Tuple{ReactiveMP.MessageObservable{Message}, ReactiveMP.MessageObservable{AbstractMessage}}, Nothing}, Rocket.ScheduledActor{AbstractMessage, RxInfer.LimitStackScheduler, Rocket.RecentSubjectInstance{AbstractMessage, Subject{AbstractMessage, AsapScheduler, AsapScheduler}}}, ReactiveMP.var\"#178#181\"{ReactiveMP.MessageMapping{typeof(*), Val{:in}, Marginalisation, Val{(:out, :A)}, Nothing, MatrixCorrectionTools.ReplaceZeroDiagonalEntries{TinyHugeNumbers.TinyNumber}, Nothing, Nothing}}}, PushNew, Rocket.UInt8UpdatesStatus}}, PushNew, Rocket.UInt8UpdatesStatus, typeof(identity), Nothing}}, value::Message{MvNormalMeanPrecision{Float64, Vector{Float64}, Matrix{Float64}}, Nothing}, ::AsapScheduler)
@ Rocket C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\schedulers\\asap.jl:23
[3841] on_next!(subject::Subject{Message, AsapScheduler, AsapScheduler}, data::Message{MvNormalMeanPrecision{Float64, Vector{Float64}, Matrix{Float64}}, Nothing})
@ Rocket C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\subjects\\subject.jl:62
[3842] actor_on_next!(::BaseActorTrait{Message}, actor::Subject{Message, AsapScheduler, AsapScheduler}, data::Message{MvNormalMeanPrecision{Float64, Vector{Float64}, Matrix{Float64}}, Nothing})
@ Rocket C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\actor.jl:250
[3843] next!
@ C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\actor.jl:202 [inlined]
[3844] on_next!
@ C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\subjects\\recent.jl:62 [inlined]
[3845] actor_on_next!
@ C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\actor.jl:250 [inlined]
[3846] next!(actor::Rocket.RecentSubjectInstance{Message, Subject{Message, AsapScheduler, AsapScheduler}}, data::Message{MvNormalMeanPrecision{Float64, Vector{Float64}, Matrix{Float64}}, Nothing})
@ Rocket C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\actor.jl:202
[3847] next_received!(wrapper::Rocket.CollectLatestObservableWrapper{AbstractMessage, Rocket.RecentSubjectInstance{Message, Subject{Message, AsapScheduler, AsapScheduler}}, Vector{AbstractMessage}, BitVector, Vector{Teardown}, ReactiveMP.var\"#15#17\"{GenericProd, UnspecifiedFormConstraint}, typeof(ReactiveMP.reset_vstatus)}, data::DefferedMessage{Nothing, Tuple{ReactiveMP.MarginalObservable, ReactiveMP.MarginalObservable}, ReactiveMP.MessageMapping{MvNormalMeanPrecision, Val{:μ}, Marginalisation, Nothing, Val{(:out, :Λ)}, Nothing, Nothing, Nothing}}, index::CartesianIndex{1})
@ Rocket C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\observable\\collected.jl:104
[3848] on_next!
@ C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\observable\\collected.jl:93 [inlined]
[3849] scheduled_next!(actor::Rocket.CollectLatestObservableInnerActor{AbstractMessage, CartesianIndex{1}, Rocket.CollectLatestObservableWrapper{AbstractMessage, Rocket.RecentSubjectInstance{Message, Subject{Message, AsapScheduler, AsapScheduler}}, Vector{AbstractMessage}, BitVector, Vector{Teardown}, ReactiveMP.var\"#15#17\"{GenericProd, UnspecifiedFormConstraint}, typeof(ReactiveMP.reset_vstatus)}}, value::DefferedMessage{Nothing, Tuple{ReactiveMP.MarginalObservable, ReactiveMP.MarginalObservable}, ReactiveMP.MessageMapping{MvNormalMeanPrecision, Val{:μ}, Marginalisation, Nothing, Val{(:out, :Λ)}, Nothing, Nothing, Nothing}}, ::AsapScheduler)
@ Rocket C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\schedulers\\asap.jl:23
[3850] on_next!(subject::Subject{AbstractMessage, AsapScheduler, AsapScheduler}, data::DefferedMessage{Nothing, Tuple{ReactiveMP.MarginalObservable, ReactiveMP.MarginalObservable}, ReactiveMP.MessageMapping{MvNormalMeanPrecision, Val{:μ}, Marginalisation, Nothing, Val{(:out, :Λ)}, Nothing, Nothing, Nothing}})
@ Rocket C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\subjects\\subject.jl:62
[3851] actor_on_next!
@ C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\actor.jl:250 [inlined]
[3852] next!
@ C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\actor.jl:202 [inlined]
[3853] on_next!
@ C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\subjects\\recent.jl:62 [inlined]
[3854] #7
@ C:\\Users\\lange\\.julia\\packages\\RxInfer\\AszMu\\src\\rocket.jl:86 [inlined]
[3855] limitstack(callback::RxInfer.var\"#7#8\"{Rocket.RecentSubjectInstance{AbstractMessage, Subject{AbstractMessage, AsapScheduler, AsapScheduler}}, DefferedMessage{Nothing, Tuple{ReactiveMP.MarginalObservable, ReactiveMP.MarginalObservable}, ReactiveMP.MessageMapping{MvNormalMeanPrecision, Val{:μ}, Marginalisation, Nothing, Val{(:out, :Λ)}, Nothing, Nothing, Nothing}}}, instance::RxInfer.LimitStackScheduler)
@ RxInfer C:\\Users\\lange\\.julia\\packages\\RxInfer\\AszMu\\src\\rocket.jl:52
[3856] scheduled_next!
@ C:\\Users\\lange\\.julia\\packages\\RxInfer\\AszMu\\src\\rocket.jl:86 [inlined]
[3857] actor_on_next!
@ C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\actor.jl:255 [inlined]
[3858] next!
@ C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\actor.jl:203 [inlined]
[3859] on_next!
@ C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\observable\\scheduled.jl:12 [inlined]
[3860] next!
@ C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\actor.jl:206 [inlined]
[3861] on_next!
@ C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\operators\\map.jl:62 [inlined]
[3862] next!
@ C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\actor.jl:206 [inlined]
[3863] next_received!
@ C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\observable\\combined.jl:101 [inlined]
[3864] on_next!
@ C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\observable\\combined.jl:68 [inlined]
[3865] next!
@ C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\actor.jl:206 [inlined]
[3866] next_received!
@ C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\observable\\combined_updates.jl:72 [inlined]
[3867] on_next!
@ C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\observable\\combined_updates.jl:34 [inlined]
[3868] scheduled_next!(actor::Rocket.CombineLatestUpdatesInnerActor{Marginal, Rocket.CombineLatestUpdatesActorWrapper{Tuple{ReactiveMP.MarginalObservable, ReactiveMP.MarginalObservable}, Rocket.CombineLatestInnerActor{Tuple{ReactiveMP.MarginalObservable, ReactiveMP.MarginalObservable}, Rocket.CombineLatestActorWrapper{Rocket.MStorage2{Nothing, Tuple{ReactiveMP.MarginalObservable, ReactiveMP.MarginalObservable}}, Rocket.MapActor{Tuple{Nothing, Tuple{ReactiveMP.MarginalObservable, ReactiveMP.MarginalObservable}}, Rocket.ScheduledActor{AbstractMessage, RxInfer.LimitStackScheduler, Rocket.RecentSubjectInstance{AbstractMessage, Subject{AbstractMessage, AsapScheduler, AsapScheduler}}}, ReactiveMP.var\"#178#181\"{ReactiveMP.MessageMapping{MvNormalMeanPrecision, Val{:μ}, Marginalisation, Nothing, Val{(:out, :Λ)}, Nothing, Nothing, Nothing}}}, PushNew, Rocket.UInt8UpdatesStatus}}, PushNew, Rocket.UInt8UpdatesStatus, typeof(identity), Nothing}}, value::Marginal{PointMass{Vector{Float64}}, Nothing}, ::AsapScheduler)
@ Rocket C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\schedulers\\asap.jl:23
[3869] on_next!(subject::Subject{Marginal, AsapScheduler, AsapScheduler}, data::Marginal{PointMass{Vector{Float64}}, Nothing})
@ Rocket C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\subjects\\subject.jl:62
[3870] actor_on_next!
@ C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\actor.jl:250 [inlined]
[3871] next!
@ C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\actor.jl:202 [inlined]
[3872] on_next!
@ C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\subjects\\recent.jl:62 [inlined]
[3873] actor_on_next!
@ C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\actor.jl:250 [inlined]
[3874] next!
@ C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\actor.jl:202 [inlined]
[3875] on_next!
@ C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\operators\\map.jl:62 [inlined]
[3876] scheduled_next!(actor::Rocket.MapActor{Message, Rocket.RecentSubjectInstance{Marginal, Subject{Marginal, AsapScheduler, AsapScheduler}}, typeof(as_marginal)}, value::Message{PointMass{Vector{Float64}}, Nothing}, ::AsapScheduler)
@ Rocket C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\schedulers\\asap.jl:23
[3877] on_next!(subject::Subject{Message, AsapScheduler, AsapScheduler}, data::Message{PointMass{Vector{Float64}}, Nothing})
@ Rocket C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\subjects\\subject.jl:62
[3878] actor_on_next!(::BaseActorTrait{Message}, actor::Subject{Message, AsapScheduler, AsapScheduler}, data::Message{PointMass{Vector{Float64}}, Nothing})
@ Rocket C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\actor.jl:250
[3879] next!
@ C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\actor.jl:202 [inlined]
[3880] on_next!
@ C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\subjects\\recent.jl:62 [inlined]
[3881] actor_on_next!
@ C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\actor.jl:250 [inlined]
[3882] next!
@ C:\\Users\\lange\\.julia\\packages\\Rocket\\sUaNu\\src\\actor.jl:202 [inlined]
[3883] update!
@ C:\\Users\\lange\\.julia\\packages\\ReactiveMP\\hqWuG\\src\\variables\\data.jl:79 [inlined]
[3884] #133
@ C:\\Users\\lange\\.julia\\packages\\ReactiveMP\\hqWuG\\src\\variables\\data.jl:87 [inlined]
[3885] foreach(f::ReactiveMP.var\"#133#134\", itr::Base.Iterators.Zip{Tuple{Vector{DataVariable{Rocket.RecentSubjectInstance{Message, Subject{Message, AsapScheduler, AsapScheduler}}, ReactiveMP.MarginalObservable}}, Vector{Vector{Float64}}}})
@ Base .\\abstractarray.jl:3097
[3886] update!(datavars::Vector{DataVariable{Rocket.RecentSubjectInstance{Message, Subject{Message, AsapScheduler, AsapScheduler}}, ReactiveMP.MarginalObservable}}, data::Vector{Vector{Float64}})
@ ReactiveMP C:\\Users\\lange\\.julia\\packages\\ReactiveMP\\hqWuG\\src\\variables\\data.jl:86
[3887] batch_inference(; model::GraphPPL.ModelGenerator{typeof(LGDS), @Kwargs{param::Dict{Symbol, Any}, mΦhp::Vector{Float64}, mΦcv::Vector{Float64}, mΦs::Vector{Float64}, mTa::Vector{Float64}, Δt::Float64}, GraphPPL.PluginsCollection{Tuple{}}, RxInfer.ReactiveMPGraphPPLBackend}, data::@NamedTuple{x::Vector{Vector{Float64}}}, initialization::RxInfer.InitSpecification, constraints::GraphPPL.Constraints{Vector{GraphPPL.FactorizationConstraint}, Vector{GraphPPL.MarginalFormConstraint}, Vector{GraphPPL.MessageFormConstraint}, Dict{Function, GraphPPL.GeneralSubModelConstraints}, Dict{GraphPPL.FactorID, GraphPPL.SpecificSubModelConstraints}}, meta::GraphPPL.MetaSpecification, options::@NamedTuple{limit_stack_depth::Int64}, returnvars::Nothing, predictvars::Nothing, iterations::Int64, free_energy::Bool, free_energy_diagnostics::Tuple{RxInfer.ObjectiveDiagnosticCheckNaNs, RxInfer.ObjectiveDiagnosticCheckInfs}, showprogress::Bool, callbacks::Nothing, addons::Nothing, postprocess::DefaultPostprocess, warn::Bool, catch_exception::Bool)
@ RxInfer C:\\Users\\lange\\.julia\\packages\\RxInfer\\AszMu\\src\\inference\\batch.jl:300
[3888] batch_inference
@ C:\\Users\\lange\\.julia\\packages\\RxInfer\\AszMu\\src\\inference\\batch.jl:94 [inlined]
[3889] #infer#230
@ C:\\Users\\lange\\.julia\\packages\\RxInfer\\AszMu\\src\\inference\\inference.jl:306 [inlined]"
} The second sentence:
Confuses me a bit because this option Sometimes I get it to make a few iterations, but it always dies after less than 5 iterations. When it does make an iteration the variances are so high the results are useless. I would be really grateful if you could give me some pointers on how to tweak the model, the hyperparameters or how to circumvent the NaN computation :) The code I am working on now can be found here: For convenience I also put the most important parts below: Prior parametersn_states = length(unknowns(sys))
n_measured = length(T_sample)
IdT = diageye(n_states)
IdM = diageye(n_measured)
# initial state
μ_T0 = [T_bias for _ in 1:n_states]
Σ_T0 = IdT * 1
# thermal capacitance prior
μ_C = [10 for _ in 1:n_states]
Σ_C = IdT * 1e2
# thermal resistance prior
μ_R = [10 for _ in 1:n_states]
Σ_R = IdT * 1e2
# area prior
n_areas = 2
μ_A = [10 for _ in 1:n_areas]
Σ_A = IdM * 1e2
# process noise
ν_p = n_states
Λ_p = IdT * 1e1
# measurement noise
ν_m = n_measured
Λ_m = IdM * 1e1
# buid prior params dict
prior_params = Dict{Symbol,Any}(
:μ_T0 => μ_T0,
:Σ_T0 => Σ_T0,
:μ_C => μ_C,
:Σ_C => Σ_C,
:μ_R => μ_R,
:Σ_R => Σ_R,
:μ_A => μ_A,
:Σ_A => Σ_A,
:ν_p => ν_p,
:Λ_p => Λ_p,
:ν_m => ν_m,
:Λ_m => Λ_m
) Transition functionfunction transition(T, lC, lR, lA, Φ_hp, Φ_cv, Φ_s, T_a, Δt)
"""
Transition function for the thermal model
Args:
params: Dict{Symbol,Any} - prior parameters for the model [-]
T: Array{Float64,1} - state vector [T_i, T_e, T_h] [K]
lC: Array{Float64,1} - log capacitance parameter vector [J/K]
lR: Array{Float64,1} - log resistance parameter vector [K/W]
lA: Array{Float64,1} - log area parameter vector [m^2]
Φ_hp: Float64 - thermal power injected by heat pump [W]
Φ_cv: Float64 - thermal power injected by boiler [W]
Φ_s: Float64 - solar power [W/m^2]
T_a: Float64 - ambient temperature [K]
"""
# unpack parameter vectors
lCi, lCe, lCh = lC
lRie, lRea, lRih = lR
lAw, lAe = lA
# define A matrix
A = [
-exp(-lCi - lRih) - exp(-lCi - lRie) exp(-lCi - lRie) exp(-lCi - lRih);
exp(-lCe - lRie) -exp(-lCe - lRea) - exp(-lCe - lRie) 0;
exp(-lCh - lRih) 0 -exp(-lCh - lRih)
]
# define B matrix
B = [
0 0 0 exp(lAw - lCi) 0;
exp(-lCe - lRea) 0 0 0 exp(lAe - lCe);
0 exp(-lCh) exp(-lCh) 0 0
]
# discrete transition matrices
A_d = IdT + A * Δt
B_d = B * Δt
# input vector
u = [T_a, Φ_hp, Φ_cv, Φ_s, Φ_s]
# state transition to T_new
return A_d * T + B_d * u
end
# emission matrix
C = [
1 0 0;
0 0 1
] Model definition@model function LGDS(param, x, mΦhp, mΦcv, mΦs, mTa, Δt)
"""
Build the probabilistic parameter/state estimation model for the thermal model
Args:
x: Array{Float64,2} - [x_i, x_h] measured interior and heater temp. [K]
mΦhp: Array{Float64,1} - measured heat pump power [W]
mΦcv: Array{Float64,1} - measured boiler power [W]
mΦs: Array{Float64,1} - measured solar irradiance [W/m^2]
mTa: Array{Float64,1} - measured ambient temperature [K]
Δt: Float64 - time step between measurements [s]
"""
# model parameter priors
lC ~ MvNormalMeanCovariance(param[:μ_C], param[:Σ_C])
lR ~ MvNormalMeanCovariance(param[:μ_R], param[:Σ_R])
lA ~ MvNormalMeanCovariance(param[:μ_A], param[:Σ_A])
# process noise
W ~ Wishart(param[:ν_p], param[:Λ_p])
# measurement noise
V ~ Wishart(param[:ν_m], param[:Λ_m])
# initialize state
T_prev ~ MvNormalMeanCovariance(param[:μ_T0], param[:Σ_T0])
# dynamics
for i in 1:size(x)[1]
# deterministic transition variable
trans[i] := transition(T_prev, lC, lR, lA, mΦhp[i], mΦcv[i], mΦs[i], mTa[i], Δt)
# Gaussian state
T[i] ~ MvNormalMeanPrecision(trans[i], W)
# Gaussian observations
x[i] ~ MvNormalMeanPrecision(C * T[i], V)
# update state
T_prev = T[i]
end
end
# meta data such as approximation techniques
meta = @meta begin
transition() -> UT()
end
# model initialization due to loops
init = @initialization begin
# initial messages
μ(lC) = MvNormalMeanPrecision(zeros(n_states), 1e-3 * diageye(n_states))
μ(lR) = MvNormalMeanPrecision(zeros(n_states), 1e-3 * diageye(n_states))
μ(lA) = MvNormalMeanPrecision(zeros(n_measured), 1e-3 * diageye(2))
# initial marginals
q(W) = Wishart(n_states, diageye(n_states))
q(V) = Wishart(n_measured, diageye(n_measured))
end
# model factorization constraints (for variational inference)
my_constraints = @constraints begin
q(T, trans, W, V) = q(T, trans)q(W)q(V)
end Inference functiondataset = (x = [collect(i) for i in zip(T_sample["C_i"], T_sample["C_h"])],);
n_iter = 100
result = infer(
model = LGDS(param = prior_params,
mΦhp = U_sample[:Φ_hp],
mΦcv = U_sample[:Φ_cv],
mΦs = U_sample[:Φ_s],
mTa = U_sample[:T_a],
Δt = t_int),
meta = meta,
iterations = n_iter,
constraints = my_constraints,
initialization = init,
data = dataset,
free_energy = true,
options = (limit_stack_depth = 100,),
showprogress = true
) |
Beta Was this translation helpful? Give feedback.
-
Hi @langestefan, Sorry for not getting back to you sooner. I've managed to redefine your model so that we can run coupled function transition_A(lCRA)
lC = lCRA[1:n_states]
lR = lCRA[n_states+1:n_states*2]
lA = lCRA[n_states*2+1:end]
lCi, lCe, lCh = lC
lRie, lRea, lRih = lR
lAw, lAe = lA
A = [
-exp(-lCi - lRih) - exp(-lCi - lRie) exp(-lCi - lRie) exp(-lCi - lRih);
exp(-lCe - lRie) -exp(-lCe - lRea) - exp(-lCe - lRie) 0;
exp(-lCh - lRih) 0 -exp(-lCh - lRih)
]
Δt = 0.1
A_d = IdT + A * Δt
end
function transition_B(lCRA)
lC = lCRA[1:n_states]
lR = lCRA[n_states+1:n_states*2]
lA = lCRA[n_states*2+1:end]
lCi, lCe, lCh = lC
lRie, lRea, lRih = lR
lAw, lAe = lA
B = [
0 0 0 exp(lAw - lCi) 0;
exp(-lCe - lRea) 0 0 0 exp(lAe - lCe);
0 exp(-lCh) exp(-lCh) 0 0
]
Δt = 0.1
B_d = B * Δt
end
@model function LGDS(param, x, mΦhp, mΦcv, mΦs, mTa, Δt)
lCRA ~ MvNormalMeanPrecision([param[:μ_C]; param[:μ_R]; param[:μ_A]], diageye(length(param[:μ_C]) + length(param[:μ_R]) + length(param[:μ_A])) * 1e-2)
W ~ Wishart(param[:ν_p], param[:Λ_p])
V ~ Wishart(param[:ν_m], param[:Λ_m])
T_prev ~ MvNormalMeanCovariance(param[:μ_T0], inv(param[:Σ_T0]))
for i in 1:size(x)[1]
u[i] ~ MvNormalMeanPrecision([mTa[i], mΦhp[i], mΦcv[i], mΦs[i], mΦs[i]], 1e2diageye(5)) # we will pass it as RV as ContinuousTransition doesn't support (yet) passing data as input
uB[i] ~ ContinuousTransition(u[i], lCRA, diageye(3)) where {meta = CTMeta(transition_B)}
Ta[i] ~ ContinuousTransition(T_prev, lCRA, diageye(3)) where {meta = CTMeta(transition_A)}
T[i] ~ MvNormalMeanPrecision(Ta[i] + uB[i], W)
x[i] ~ MvNormalMeanPrecision(C * T[i], V)
T_prev = T[i]
end
end
init = @initialization begin
q(lCRA) = MvNormalMeanPrecision(zeros(2n_states + n_areas), diageye(2n_states + n_areas))
q(W) = Wishart(n_states, diageye(n_states))
q(V) = Wishart(n_measured, diageye(n_measured))
end
constraints = @constraints begin
q(Ta, T_prev, u, uB, lCRA, W, V, T) = q(Ta, T_prev, T, u, uB)q(lCRA)q(V)q(W)
end
dataset = (x = [collect(i) for i in zip(T_sample["C_i"], T_sample["C_h"])],);
n_iter = 2
result = infer(
model = LGDS(param = prior_params,
mΦhp = U_sample[:Φ_hp],
mΦcv = U_sample[:Φ_cv],
mΦs = U_sample[:Φ_s],
mTa = U_sample[:T_a],
Δt = t_int),
iterations = n_iter,
constraints = constraints,
initialization = init,
data = dataset,
free_energy = false,
options = (limit_stack_depth = 100,),
showprogress = true,
returnvars = KeepLast()
) There are a few things that must be mentioned here:
If you have questions regarding the model, initializations, or constraint specifications, please ask! All in all, it's a cool problem. Good luck! |
Beta Was this translation helpful? Give feedback.
-
Hi,
I am trying to solve a system identification problem for an RC network using RxInfer. I have followed Bert's course BMLIP, but it's been 2 years and in the meantime the syntax has changed quite a bit :)
I have the following code, where
mΦh
andmTa
are measured inputs andmx
are measured outputs. The model is given by this code:For which I then try to infer the parameters
C
andR
. At the moment I am using simulated data so I know exactly what these values are.Unfortunately this model is giving me the following error message:
Half-edge has been found: T_53. To terminate half-edges 'Uninformative' node can be used.
I must be missing something obvious, could anyone help?
After solving this problem I would also like to:
mΦh
andmTa
random variables since they are noisy observationsContinuousTransition
if I write it in state-space form (it will remain a system of linear ODE's)Beta Was this translation helpful? Give feedback.
All reactions