palash1992 / GEM

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

Problem running `test.py` #38

Closed rougier closed 6 years ago

rougier commented 6 years ago

Continuing the thread from the JOSS review:

I think the path to karate.edgelistneeds to be specified in the test script. Now I get:

Using TensorFlow backend.
/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/importlib/_bootstrap.py:219: RuntimeWarning: compiletime version 3.6 of module 'tensorflow.python.framework.fast_tensor_util' does not match runtime version 3.7
  return f(*args, **kwds)
Num nodes: 34, num edges: 77
Could not import C++ module for Graph Factorization. Reverting to python implementation. Please recompile graphFac_ext from graphFac.cpp using bjam
        Iter id: 0, Objective: 77.0078, f1: 77.0002, f2: 0.00757339
        Iter id: 10000, Objective: 76.9979, f1: 76.9957, f2: 0.00211602
        Iter id: 20000, Objective: 76.9971, f1: 76.9949, f2: 0.00215114
        Iter id: 30000, Objective: 76.9968, f1: 76.9946, f2: 0.00225228
        Iter id: 40000, Objective: 76.9967, f1: 76.9944, f2: 0.00230059
graph_factor_sgd:
    Training time: 33.805227
Traceback (most recent call last):
  File "test.py", line 50, in <module>
    MAP, prec_curv = gr.evaluateStaticGraphReconstruction(G, embedding, Y, None)
ValueError: too many values to unpack (expected 2)
palash1992 commented 6 years ago

Yes, I had initially set the path to "gem/data/karate.edgelist" assuming that the code will be run from GEM but modified it to "karate.edgelist" so that the user can install the package and run the code from any directory with input file.

The above error was due to inconsistency between readme and test and has been fixed. The graphreconstruction was modified to return mean square error along with MAP and precision.

rougier commented 6 years ago

Some progress (I got some pictures) but still some issues:

Num nodes: 34, num edges: 77
[Errno 2] No such file or directory: 'node2vec': 'node2vec'
Traceback (most recent call last):
  File "/Users/rougier/tmp/GEM/gem/embedding/node2vec.py", line 80, in learn_embedding
    call(args)
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 304, in call
    with Popen(*popenargs, **kwargs) as p:
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 756, in __init__
    restore_signals, start_new_session)
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 1499, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'node2vec': 'node2vec'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "test.py", line 48, in <module>
    Y, t = embedding.learn_embedding(graph=G, edge_f=None, is_weighted=True, no_python=True)
  File "/Users/rougier/tmp/GEM/gem/embedding/node2vec.py", line 83, in learn_embedding
    raise Exception('./node2vec not found. Please compile snap, place node2vec in the system path and grant executable permission')
Exception: ./node2vec not found. Please compile snap, place node2vec in the system path and grant executable permission

In any case, I'm totally clueless about the output (I don't know what I'm supposed to see and what is actually computed).

palash1992 commented 6 years ago

In the installation instructions, there is a special installation for node2vec (To install node2vec as part of the package, recompile from https://github.com/snap-stanford/snap and add node2vec executable to system path. To grant executable permission, run: chmod +x node2vec).

You can also test the rest of the methods by commenting out line 38 in test.py which loads node2vec model. But otherwise, node2vec installation is required.

For the output, I will add a toy example by the end of the day. Just to make it clear for now, test.py outputs the evaluation of graph reconstruction and network visualization on Karate dataset for all the models in the package, hence comparing them.