Pymc3 for graphical models (PGM)

Is pymc3 suitable for implementation of PGMs?
Everywhere in tutorials they show toy examples of a water-sprinkler or student network with only categorical values and known conditional probabilities (CPD), so, basically, the PGM network is established by prior knowledge.

What if I “draw” a PGM with several nodes connected with edges based on my prior knowledge, but without exact CPDs known. And I want to use a dataset to derive CPDs from it. Is this possible at all?
I read about Bayesian network + Machine Learning binding, but couldn’t find any actual examples.
I will be grateful for any advises or references.

1 Like

I’ve used it for a simple Bayes net, and am planning on doing some more complicated ones - there’s an example here. There’s a couple more links to other examples in my original question, but I it sounds like my example is the closest to what you’re after (I had a lot of trouble finding examples too).

Note that the diagram that the pymc3 won’t necessarily look quite as you’d draw the Bayes net - there’s a bit of discussion at the end of that question around that.


Yep - currently we have not implemented any specific algorithm for inferencing PGM (like loopy belief propagation, so you might need to rely on random forward sample for these use case.


Thanks for replying. I am not very familiar with this domain, just thought there should already be some API for this use-case. May be there are other toolboxes which have this functionality?

Hi Andrey,
I think you’ll find interesting resources about this in this thread.
Hope this helps :vulcan_salute:


Thanks, there were some interesting posts.
I also found that Netica software from Norsys can learn relations from data directly:

1 Like