概率编程库主流有:Stan、Pymc、Edward,先前选择pymc,结果发现遇到大规模数据基本跑不动,无奈转Edward。
Edward:A library for probabilistic modeling, inference, and criticism.
https://github.com/blei-lab/edward
安装: pip install edward
问题:import edward as ed 提示
ImportError: cannot import name 'set_shapes_for_outputs'
解决:
找到安装文件:edward/util/random_variables.py
如上图,替换输入库
from tensorflow.python.framework.ops import set_shape_and_handle_data_for_outputs as set_shapes_for_outputs
这个问题在github上也讨论很多,笔者选择了这个方法。
https://github.com/blei-lab/edward/issues/882