Want rxinfer equivalent of the following turing model #205
Replies: 2 comments 8 replies
-
Hi @prantik1998. I think the best place for this question will be in Discussions. |
Beta Was this translation helpful? Give feedback.
-
Besides, there's no So here's a bit of an ugly sketch for the problem: using RxInfer, StableRNGs, Optimisers
@model function laplacian_model(n)
mew = randomvar(n)
A = constvar([0.5 0.0; 0.0 0.5])
y = datavar(Vector{Float64})
for i in 1:n
mew[i] ~ Gamma(α=10.0, β=1.0)
end
dew ~ mul(A, mew[1], mew[2]) # auxilary variable for multiplying A w vector of Gammas
y ~ MvNormal(μ=dew, Λ=[0.5 0;0 0.5])
end
@meta function cvi_meta(rng, nr_samples, nr_iterations, optimizer)
mul() -> CVI(rng, nr_samples, nr_iterations, optimizer)
end;
n = 2
function mul(A, x, y)
A*[x,y]
end
result = infer(data = (y = randn(2), ), model = laplacian_model(n), meta=cvi_meta(StableRNG(42), 100, 200, Optimisers.Descent(0.01)), iterations=10, free_energy=true, returnvars=KeepLast()) |
Beta Was this translation helpful? Give feedback.
-
I am trying to port the following model from turing to rxinfer
@model function laplacian_model(A,y)
m,n = size(A)
mew ~ filldist(Laplace(10,1),n)
y ~ MvNormal(A*mew,[0.5 0;0 0.5])
end
I was not able to use laplce with rxinfer and also was not able to use cvi for non conjugate priors.
Any pointers on how to get this working in rxinfer.
Beta Was this translation helpful? Give feedback.
All reactions