-
Hey, I'm new to RxInfer and somewhat new to Practical Bayesian Modeling. I want to implement a model for a positive semi-definite matrix that has been proposed in this paper: https://ieeexplore.ieee.org/document/5495105. As this paper is behind a paywall I will attach a screenshot of the model definition. The hyper parameters b, c, d are set to very small values 10e-6, a depends on the matrix size N with a = 0.05 * N. x_ij are the entries of the PSD matrix / kernel matrix. I've implemented this model in Turing (hard to sample from and very slow) and wanted to try RxInfer, the code is at the end of this post. Unfortunately, I have encountered some issues that I can't resolve myself due to my lacking understanding of RxInfer and the implemented inference methods. Some of the issues I have encountered:
In the paper the authors say that they infer this model using Variational Bayes by maximizing the log joint posterior w.r.t. to the individual parameters while taking the expectations for the remaining ones. This sound like expectation propagation to me. Is that right? Any idea how I could get that working in RxInfer? Maybe you can refer me to an example which is similar enough such that I could start from there. I really appreciate your help and hope that I can learn something from it.
|
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 11 replies
-
Hi, @h-spiess ! This is an easy fix. You should try using @HoangMHNguyen will take it from here to help you out ;) |
Beta Was this translation helpful? Give feedback.
-
Hi @h-spiess !
if i==j
mu_kernel[n] ~ norm_squared(ϕ[i]) where {meta =UT() }
else
mu_kernel[n] ~ softdot(ϕ[i], ϕ[j], tiny) where {q = MeanField() }
end
Hope this's helpful! :) |
Beta Was this translation helpful? Give feedback.
-
Hey @h-spiess , thanks for trying out I think there's also some confusion you should be aware of in this model definition. In your code, you try to use the broadcasting operator in Julia: ϕ .~ MvNormalMeanPrecision(zeros(N), α) The semantics you imply are: I have a vector of size broadcastable(x, y) = x + y
in_1 = [1.0, 2.0, 3.0]
in_2 = [2.0, 3.0, 4.0]
broadcastable.(in_1, in_2) returns you the following:
So, when you write To create the factor graph that you want to create: for i in 1:N
ϕ[i] ~ MvNormalMeanPrecision(zeros(N), α)
end However, there's one more caveat: You now specify a model where we have a |
Beta Was this translation helpful? Give feedback.
-
Hey @h-spiess , I've uploaded the node you need in https://github.com/biaslab/DiagonalMvNormalNode. In In the model specification you can see that you have to convert your |
Beta Was this translation helpful? Give feedback.
Hey @h-spiess , I've uploaded the node you need in https://github.com/biaslab/DiagonalMvNormalNode. In
experiments
you can see a short demo of the node in action. Innode.jl
I have adapted the Gaussian Mixture node to your setting such that it accepts a variable number of inputs. Inrules.jl
I have written the inference rules for message computations and for that I needed a scaled-chisquared distribution. I haven't thoroughly tested this node though, I've only ran inference as you can see inexperiments.jl
and validated that the inferred results are close to the diagonal of theprec
matrix I use to generate the data.In the model specification you can see that you have to convert your
ran…