ReactiveBayes / RxInfer.jl

Julia package for automated Bayesian inference on a factor graph with reactive message passing
MIT License
242 stars 24 forks source link

Regarding non conjugate priors #192

Closed prantik1998 closed 6 months ago

prantik1998 commented 7 months ago

I want to know how to perform inference with non conjugate priors using rxinfer

albertpod commented 7 months ago

Hi @prantik1998. Generally, two ways are available:

  1. If you are in the realm of exponential family distributions, you can use CVI

f(x) = x ... x ~ Beta(a, b) x_ ~ f(x) where {meta = CVI(rng, nr_samples, nriterations, optimizer)} y ~ Normal(0.0, x) ...


More on it [here](https://biaslab.github.io/RxInfer.jl/stable/examples/advanced_examples/Conjugate-Computational%20Variational%20Message%20Passing/): 

2. Alternatively, you can define your own (efficient) [product](https://biaslab.github.io/BayesBase.jl/stable/#Base.prod-Tuple{BayesBase.UnspecifiedProd,%20Any,%20Any}) rule between the distributions you are going to multiply.
prantik1998 commented 6 months ago

Thanks @albertpod

I wanted to know whether the CVI method will also work when x is a vector ??

Nimrais commented 6 months ago

Hi @prantik1998, yes it will work. You can check this example https://biaslab.github.io/RxInfer.jl/stable/examples/advanced_examples/Nonlinear%20Sensor%20Fusion/#examples-nonlinear-sensor-fusion.