CGNN复现遇到的问题及解决办法(持续更新中)

论文:Causal Generative Neural Networks

1、运行报错

Q1

  • Q: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library ‘cudart64_110.dll’; dlerror: cudart64_110.dll not found
    I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
  • A: 下载cudart64_110.dll,放到项目路径下

Q2

  • Q: Traceback (most recent call last):File “D:/PycharmWorkSpace/CGNN-master/run_CGNN_graph.py”, line 1, in
    import cgnn
    File “d:\pycharmworkspace\cgnn-master\code\cgnn_init_.py”, line 6, in
    from .generators import______init______
    File “d:\pycharmworkspace\cgnn-master\code\cgnn\generators_init_.py”, line 1, in
    from .random_graph_generator import RandomGraphGenerator
    File “d:\pycharmworkspace\cgnn-master\code\cgnn\generators\random_graph_generator.py”, line 1, in
    from .functions_default import (noise, cause, effect, rand_bin)
    File “d:\pycharmworkspace\cgnn-master\code\cgnn\generators\functions_default.py”, line 14, in
    from sklearn.mixture import GMM
    ImportError: cannot import name ‘GMM’

  • A: 查阅对应 scikit-learn 版本的官方文档后发现,GMM 被替换为 GaussianMixture,故正确写法为:

    from sklearn.mixture import GaussianMixture
    

    启示:

    遇到冷门报错信息,束手无策时,可以考虑查查官方文档

    转载于:https://www.cnblogs.com/xiangsui/p/10981529.html

Q3

  • Q: Processing Example_graph_numdata.csv…Traceback (most recent call last):File “D:/PycharmWorkSpace/CGNN-master/run_CGNN_graph.py”, line 22, in
    p_directed_graph = GNN.orient_graph(data, umg, printout=datafile + ‘_printout.csv’)
    File “d:\pycharmworkspace\cgnn-master\code\cgnn\PairwiseModel.py”, line 75, in orient_graph
    weight = self.predict_proba(scale(df_data[a].as_matrix()), scale(df_data[b].as_matrix()),idx)
    File “D:\Software\Anaconda\envs\cgnn\lib\site-packages\pandas\core\generic.py”, line 5141, in getattr
    return object.getattribute(self, name)
    AttributeError: ‘Series’ object has no attribute ‘as_matrix’

  • A: 出错原因:as_matrix不能用

    解决方式:将.as_matrix()改为.values

    测试运行:

Q4

  • Q: AttributeError: module ‘tensorflow’ has no attribute ‘placeholder’
  • A: tensorflow版本不对,在2.+的版本下使用了1.+的接口,修改tensorflow的版本为1.15.0

你可能感兴趣的:(Causality,python,CGNN,causality,因果推断,bug)