quantum-fog icon indicating copy to clipboard operation
quantum-fog copied to clipboard

How can edward "read" a bayes network?

Open rose1203 opened this issue 6 years ago • 4 comments

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!

rose1203 avatar May 11 '18 07:05 rose1203

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

rrtucci avatar May 11 '18 14:05 rrtucci

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

rose1203 avatar May 13 '18 12:05 rose1203

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

rrtucci avatar May 13 '18 23:05 rrtucci

@rrtucci THANKS!!!

rose1203 avatar May 14 '18 03:05 rose1203