palash1992 / GEM

BSD 3-Clause "New" or "Revised" License
1.27k stars 360 forks source link

Error when running link prediction #53

Closed agoodweathercc closed 5 years ago

agoodweathercc commented 5 years ago

When I try to run link prediction by adding the following code in test_karate.py

MAP, prec_curv = lp.evaluateStaticLinkPrediction(G, embedding, 0.8, is_undirected=False)

I got the error: Traceback (most recent call last): File "tests/test_karate.py", line 55, in MAP, prec_curv = lp.evaluateStaticLinkPrediction(G, embedding, 0.8, is_undirected=False) File "/home/cai.507/Documents/DeepLearning/deep-persistence/pythoncode/GEM/gem/evaluation/evaluate_link_prediction.py", line 24, in evaluateStaticLinkPrediction is_undirected=is_undirected File "/home/cai.507/Documents/DeepLearning/deep-persistence/pythoncode/GEM/gem/utils/evaluation_util.py", line 40, in splitDiGraphToTrainTest for (st, ed, w) in di_graph.edges_iter(data='weight', default=1): AttributeError: 'DiGraph' object has no attribute 'edges_iter'

agoodweathercc commented 5 years ago

Would it be possible for you to provide a small example of link prediction and node classification? May thanks!

palash1992 commented 5 years ago

You addition of code is correct but I believe you are using a version of Networkx incompatible with GEM. Please downgrade your Network to 1.x and let me know if that solves the issue.