biaslab / ForneyLab.jl

Julia package for automatically generating Bayesian inference algorithms through message passing on Forney-style factor graphs.
MIT License
149 stars 33 forks source link

Question: Can ForneyLab do parameter learning and graph structure learning? #176

Closed 00krishna closed 3 years ago

00krishna commented 3 years ago

Hello. I was looking at ForneyLab and was wondering if the package can do parameter learning and graph structure learning?

By parameter learning, I mean is the package able to get maximum likelihood estimates at each node, or even bayesian parameter estimates at each node? Or perhaps there a related package for this?

Also, I was wondering about graph structure learning. Is the package able to say predict the probability of a graph given some data. I know that usually graphs are given scores based upon a sort of likelihood given the data. Are any of those types of structure learning algorithms in the package, or perhaps they are planned for the future?

Thanks for all of your hard work. I am new to PGMs, so just trying to understand the ecosystem so far.

albertpod commented 3 years ago

Hi @00krishna,

Thanks for checking out ForneyLab.jl

Generally speaking, the answer to both of your questions - yes.

ForneyLab builds an inference algorithm that provides the posterior distribution over the variables/parameters of your generative model. That's what I think you mean with Bayesian parameter estimates (correct me if you mean something else).

As for structure learning, ForneyLab computes free energy which is negative evidence lower bound (ELBO). By comparing the free energies of different models, you can make a choice for a model structure (the lower the better).

Please have a look at the ForneyLab documentation and demos.

If you are interested in running large models, we recommend having a look at another package ReactiveMP

00krishna commented 3 years ago

@albertpod Thanks so much for getting back to me. Yes, this is very helpful. I am starting to understand some of the structure of ForneyLab and ReactiveMP. It seems like a lot of the work from ReactiveMP will be moving into ForneyLab.

I understand what you mean about the inference algorithm. I think it helps if we have a practical case. So Mykel Kochenderfer in his book had this example of airplane collision detection. Now, say my system is limited, and so I can only look at the data from 1 week ago. So I might not have had any collisions in the previous week, but I know that there is still the possibility of a collision. In some purely maximum likelihood scenario I would assign 0 probability to a collision and my system will be very dangerous indeed. BUT, if I approached parameter inference from a bayesian perspective--even using conjugacy--then I would have a diffuse prior over the probability of a collision. So in the case of not seeing a collision, the prior would dominate and hence I would have a better chance to identifying and detecting collisions.

So I was just wondering whether in a case such as this, with limited information, how would ForneyLab or ReactiveMP handle that. I just want to make sure I am clearly understanding some of those details :).

And the idea of using free energy sounds terrific. Yes, I can use that to learn the graph structure, I get what you mean. I will look at that and try it out.

Thanks so much again.

albertpod commented 3 years ago

@00krishna I am not sure if I fully understood the problem, but in the case of limited data Bayesian perspective is the right way to go (I would say it's always the right way to go). ForneyLab normally works on obtaining full posteriors rather than a maximum likelihood estimate. In case your model exhibits some non-conjugacy, then you'd better use ForneyLab for now as it supports black-box inference.