palash1992/GEM

gf not found

IshanDindorkar opened this issue · 2 comments

Hello @palash1992,

I am exploring the GEM library and trying to run the examples which you included. While running models to learn embedding, I am seeing this error -

Num nodes: 34, num edges: 77
[Errno 2] No such file or directory: 'gem/c_exe/gf': 'gem/c_exe/gf'
./gf not found. Reverting to Python implementation. Please compile gf, place node2vec in the path and grant executable permission
Iter id: 0, Objective: 77.003, f1: 76.9982, f2: 0.0047981
Iter id: 10000, Objective: 76.9961, f1: 76.9935, f2: 0.0026342
Iter id: 20000, Objective: 76.9938, f1: 76.9906, f2: 0.00327197
Iter id: 30000, Objective: 76.9928, f1: 76.9891, f2: 0.00364307
Iter id: 40000, Objective: 76.9923, f1: 76.9885, f2: 0.00380453
graph_factor_sgd:
Training time: 23.104942
Num nodes: 34, num edges: 77
SVD error (low rank): 0.053622
hope_gsvd:
Training time: 0.005034
Num nodes: 34, num edges: 77
Laplacian matrix recon. error (low rank): 6.293280
lap_eigmap_svd:
Training time: 0.008371
Num nodes: 34, num edges: 77
lle_svd:
Training time: 0.008675
Num nodes: 34, num edges: 77

AttributeError Traceback (most recent call last)
in
10 edge_f=None,
11 is_weighted=True,
---> 12 no_python=True)
13 print(embedding._method_name+':\n\tTraining time: %f'
14 % (time() - t1))

~/graph_embeddings/GEM/examples/gem/embedding/sdne.py in learn_embedding(self, graph, edge_f, is_weighted, no_python)
89 self._K, self._n_units,
90 self._nu1, self._nu2,
---> 91 self._actfn)
92 self._decoder = get_decoder(self._node_num, self._d,
93 self._K, self._n_units,

~/graph_embeddings/GEM/examples/gem/embedding/sdne_utils.py in get_encoder(node_num, d, K, n_units, nu1, nu2, activation_fn)
63 def get_encoder(node_num, d, K, n_units, nu1, nu2, activation_fn):
64 # Input
---> 65 x = Input(shape=(node_num,))
66 # Encoder layers
67 y = [None] * (K + 1)

~/anaconda3/envs/graph_embeddings/lib/python3.7/site-packages/keras/engine/topology.py in Input(shape, batch_shape, name, dtype, sparse, tensor)
1386 name=name, dtype=dtype,
1387 sparse=sparse,
-> 1388 input_tensor=tensor)
1389 # Return tensor including _keras_shape and _keras_history.
1390 # Note that in this case train_output and test_output are the same pointer.

~/anaconda3/envs/graph_embeddings/lib/python3.7/site-packages/keras/engine/topology.py in init(self, input_shape, batch_size, batch_input_shape, dtype, input_tensor, sparse, name)
1251 if not name:
1252 prefix = 'input'
-> 1253 name = prefix + '_' + str(K.get_uid(prefix))
1254 super(InputLayer, self).init(dtype=dtype, name=name)
1255

~/anaconda3/envs/graph_embeddings/lib/python3.7/site-packages/keras/backend/tensorflow_backend.py in get_uid(prefix)
45 def get_uid(prefix=''):
46 global _GRAPH_UID_DICTS
---> 47 graph = tf.get_default_graph()
48 if graph not in _GRAPH_UID_DICTS:
49 _GRAPH_UID_DICTS[graph] = defaultdict(int)

AttributeError: module 'tensorflow' has no attribute 'get_default_graph'

I followed your instructions in README to recompile node2vec, added to my system path and gave rights to executable. But not sure how to recompile "gf".
Could you please help.

Thanks!

Best-
Ishan

c_src folder contains gf.cpp. You can compile that using g++ -std==c++11 gf.cpp -o gf

where should I put the complied gf file?
I put it in the c_exe file, but I still get this message: ./gf not found.