palash1992/GEM

Error when running link prediction

dream-hello opened this issue · 0 comments

Hi,Palash Goyal
When I try to run link prediction by adding the following code in my example

models.append(HOPE(d=4, beta=0.01))

for embedding in models:
    print ('Num nodes: %d, num edges: %d' % (G.number_of_nodes(), G.number_of_edges()))
    t1 = time()
    # Learn embedding - accepts a networkx graph or file with edge list
    Y, t = embedding.learn_embedding(graph=G, edge_f=None, is_weighted=True, no_python=True)
    print (embedding._method_name+':\n\tTraining time: %f' % (time() - t1))
    # MAP, prec_curv, err, err_baseline = gr.evaluateStaticGraphReconstruction(G, embedding, Y, None)
    MAP,prec_curv = lp.evaluateStaticLinkPrediction(G,embedding,0.8,is_undirected = False)

I got the error:

nx.weakly_connected_component_subgraphs(train_digraph),
AttributeError: module 'networkx' has no attribute 'weakly_connected_component_subgraphs'.

This may be the version of networkx. when I tried to use Networkx = 1.11, there will be other errors

How can I solve it?