ReactiveBayes / ReactiveMP.jl

High-performance reactive message-passing based Bayesian inference engine
MIT License
106 stars 14 forks source link

Inference on DAG #43

Closed HiroIshida closed 3 years ago

HiroIshida commented 3 years ago

I am thinking using ReactiveMP.jl for inference of AR-HMM, which requires inference on DAG. So ,my question is, can ReactiveMP handles general DAG.

I'm new to this field, but I did some reading, and now know that there is a special type of message passing algorithm called junction tree algorithm is required to inference on a DAG, rather than normal message passing for a tree. I greeped around the files with the term "junction" and couldn't find the word, but I couldn't determine if inference on a DAG is possible from it due to my shortage of the knowledge, which is why I am asking this question.

Just for an information, I paste a graphical model of AR-HMM. (Stanculescu, Ioan et al, Autoregressive hidden Markov models for the early detection of neonatal sepsis." IEEE journal of biomedical and health informatics 18.5 (2013): 1560-1570. ) dag

bvdmitri commented 3 years ago

Hey! Thanks for trying out ReactiveMP.jl.

To answer your question, yes, ReactiveMP.jl supports DAGs, but it uses Variational Message Passing (VMP) algorithm and constrained Bethe Free Energy minimisation instead to perform inference. We do not support junction tree algorithm as it is out of the scope of ReactiveMP.jl package. Usually, as far as I know, junction tree algorithm is used in situation where we want to perform an exact Bayesian Inference with Belief Propagation algorithm on DAGs.

At first glance, it is hard to understand functional dependencies between variables on pasted graphical models, but I think it should be possible to run inference with VMP using ReactiveMP.jl package. However, ReactiveMP.jl is a novel package and at the current moment we did not have time to implement all possible factor nodes and all analytical solutions for every case.

For now ReactiveMP.jl supports Autoregressive models, Hidden Markov Models as well as hierarchical models that resemble closely to the model you pasted above. In these demos we use VMP to perform approximate Bayesian Inference.

HiroIshida commented 3 years ago

@bvdmitri Thanks for your kind response! Also, thank you for your introduction of some tutorial examples. And I now see that with some addition of analytical solution, it should be possible to apply the ReactiveMP.jl to DAGs. However, because of my scarse understanding for both metaprogramming and VMP, It was bit difficult for me to read and comprehend the implementation of this package at current stage, so I actually just had implemented EM-algorithm for this specific case on my own. I will probably come back later to this repo when I use more complex model, and hopefully I would understand well both metaprogramming and VMP. Thanks!