palash1992 / GEM

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

Example does not seem to work (python 3.6) #16

Closed SkBlaz closed 6 years ago

SkBlaz commented 6 years ago

Hello.

When I try to run the default examples on the index page, I get the following error:

code:

GraphFactorization(2, 100000, 1*10**-4, 1.0)

This throws

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/user/GEM/gem/embedding/gf.py", line 44, in __init__
    for key in dictionary:
TypeError: 'int' object is not iterable

Looking at the code, it seem the input is supposed to be a dictionary, what am I doing wrong?

Thank you!

BenjaminLarrousse commented 6 years ago

Hello,

Same here with python 2.7. Is there any workaround ?

SkBlaz commented 6 years ago

I fixed it by manually setting the dictionary of parameters, yet the problem given in example seems to remain.

palash1992 commented 6 years ago

Hi, Sorry for the delay in reply. I have modified the readme code to address the changes in the code. Now you need to specify the name of each input argument i.e. GraphFactorization(2, 100000, 1*10*-4, 1.0) has changed to GraphFactorization(d=2, max_iter=100000, eta=110**-4, regu=1.0)

BenjaminLarrousse commented 6 years ago

Ok, thanks @palash1992 . I have this error now:


ValueError Traceback (most recent call last)

in () 41 print (embedding._method_name+':\n\tTraining time: %f' % (time() - t1)) 42 # Evaluate on graph reconstruction ---> 43 MAP, prec_curv = gr.evaluateStaticGraphReconstruction(G, embedding, Y, None) 44 # Visualize 45 viz.plot_embedding2D(embedding.get_embedding(), di_graph=G, node_colors=None) ValueError: too many values to unpack
palash1992 commented 6 years ago

It has been fixed. The evaluation function now also returns error of reconstruction and baseline error. Thus, MAP, prec_curv = gr.evaluateStaticGraphReconstruction(G, embedding, Y, None) should now be MAP, prec_curv, err, err_baseline = gr.evaluateStaticGraphReconstruction(G, embedding, Y, None)