pythonmachine-learningpython-3.5bayesian-networkspomegranate

Sample from a Bayesian network in pomegranate


I constructed a Bayesian network using from_samples() in pomegranate. I'm able to get maximally likely predictions from the model using model.predict(). I wanted to know if there is a way to sample from this Bayesian network conditionally(or unconditionally)? i.e. is there a get random samples from the network and not the maximally likely predictions?

I looked at model.sample(), but it was raising NotImplementedError.

Also if this is not possible to do using pomegranate, what other libraries are great for Bayesian networks in Python?


Solution

  • The model.sample() should have been implemented by now if I see the commit history correctly.

    You can have a look at PyMC which supports distribution mixtures as well. However, I dont know any other toolbox with a similar factory method like from_samples() in pomogranate.