-
Notifications
You must be signed in to change notification settings - Fork 33
Description
Hello. I'm trying to extend one of the examples but hitting a wall.
I'm building upon the Gaussian Linear Dynamical System example.
In particular I'm trying to generalise it so that we don't assume to know the transition matrix constantvar to be used in the model. I would like it to be given a prior in the model, and then inferred together with the rest of the parameters.
I tried a couple of things, but I can't make it work. A minimum reproducible example is consist in redefining model and inference as follows:
@model function rotate_ssm(n, x0, B, Q, P)
# We create constvar references for better efficiency
cB = constvar(B)
cQ = constvar(Q)
cP = constvar(P)
# `x` is a sequence of hidden states
x = randomvar(n)
# THIS IS WHERE I DIVERGE FROM EXAMPLE:
A = randomvar(2,2)
# `y` is a sequence of "clamped" observations
y = datavar(Vector{Float64}, n)
x_prior ~ MvNormalMeanCovariance(mean(x0), cov(x0))
x_prev = x_prior
α ~ Uniform(0.0,3.0)
β ~ Uniform(0.0,3.0)
A .~ Gamma(α,β)
for i in 1:n
x[i] ~ MvNormalMeanCovariance(A*x_prev, cQ)
y[i] ~ MvNormalMeanCovariance(cB * x[i], cP)
x_prev = x[i]
end
endAnd I change the inference function accordingly
result = inference(
model = rotate_ssm(length(y), x0, B, Q, P),
data = (y = y,),
free_energy = true
)I tried to specify
When I try to run it, I get the following error:
ERROR: MethodError: no method matching make_node(::typeof(*), ::FactorNodeCreationOptions{FullFactorisation, Nothing, Nothing}, ::RandomVariable, ::Matrix{RandomVariable}, ::RandomVariable)