https://github.com/pgmpy/pgmpy_notebook/blob/master/notebooks/5.%20Approximate%20Inference%20in%20Graphical%20Models.ipynb