artiste-qb-net / quantum-fog

Python tools for analyzing both classical and quantum Bayesian Networks
Other
79 stars 25 forks source link

How can edward "read" a bayes network? #18

Open rose1203 opened 6 years ago

rose1203 commented 6 years ago

Hi, I read your program about inference with edward, but I don't understand how to load a bayes network which is in a bif format. Can you help me ? THANK YOU!

rrtucci commented 6 years ago

QEdward cannot load B. Nets. It only works for quantum circuits broken up into layers. I've written two models for it. To see a typical use, look at the main() at the end of Fitter.py.

So, what you are trying to do would be a nice enhancement for Q Edward but not possible yet. However, I have written a baby step in your preferred direction, for classical (not quantum yet) b nets.

In the folder

https://github.com/artiste-qb-net/quantum-fog/tree/master/jupyter-notebooks/inference_via_ext_software

I show how to read a bif, translate it into an Edward (classical) model, and then analyze that using the KLqp algorithm. The KLqp algorithm is the same the BBVI algorithm used by QEdward

rose1203 commented 6 years ago

@rrtucci I have read it and found it very useful! But where can I find the "graphs.BayesNet"and "WetGrass.bif" ? THANKS

rrtucci commented 6 years ago

The bif file is in https://github.com/artiste-qb-net/quantum-fog/tree/master/examples_cbnets

The class BayesNet is in the file BayesNet.py in the folder called graphs https://github.com/artiste-qb-net/quantum-fog/tree/master/graphs

I follow a JAVA convention of putting one class per file and naming the class and file the same

rose1203 commented 6 years ago

@rrtucci THANKS!!!