ipython notebook of factor graph model