palash1992 / GEM

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

Error running SDNE algorithm #97

Open dbbice opened 4 years ago

dbbice commented 4 years ago

Dear authors, I have issues using your implementation of sdne algorithm.Here is the console output statement: ........................................................................................................................... H:\python3.6\python.exe C:/Users/丙冰/Desktop/GEM/gem/embedding/sdne.py Using TensorFlow backend.

of nodes: 34, # of edges: 154

C:\Users\丙冰\Desktop\GEM\gem\embedding\sdne_utils.py:71: UserWarning: Update your Dense call to the Keras 2 API: Dense(50, activation="relu", kernel_regularizer=<keras.reg...) W_regularizer=Reg.l1_l2(l1=nu1, l2=nu2))(y[i]) WARNING:tensorflow:From H:\python3.6\lib\site-packages\keras\backend\tensorflow_backend.py:1044: calling reduce_sum (from tensorflow.python.ops.math_ops) with keep_dims is deprecated and will be removed in a future version. Instructions for updating: keep_dims is deprecated, use keepdims instead C:\Users\丙冰\Desktop\GEM\gem\embedding\sdne_utils.py:71: UserWarning: Update your Dense call to the Keras 2 API: Dense(15, activation="relu", kernel_regularizer=<keras.reg...) W_regularizer=Reg.l1_l2(l1=nu1, l2=nu2))(y[i]) C:\Users\丙冰\Desktop\GEM\gem\embedding\sdne_utils.py:73: UserWarning: Update your Dense call to the Keras 2 API: Dense(2, activation="relu", kernel_regularizer=<keras.reg...) W_regularizer=Reg.l1_l2(l1=nu1, l2=nu2))(y[K - 1]) C:\Users\丙冰\Desktop\GEM\gem\embedding\sdne_utils.py:75: UserWarning: Update your Model call to the Keras 2 API: Model(inputs=Tensor("in..., outputs=Tensor("de...) encoder = Model(input=x, output=y[K]) C:\Users\丙冰\Desktop\GEM\gem\embedding\sdne_utils.py:90: UserWarning: Update your Dense call to the Keras 2 API: Dense(15, activation="relu", kernel_regularizer=<keras.reg...) W_regularizer=Reg.l1_l2(l1=nu1, l2=nu2))(y_hat[i + 1]) C:\Users\丙冰\Desktop\GEM\gem\embedding\sdne_utils.py:90: UserWarning: Update your Dense call to the Keras 2 API: Dense(50, activation="relu", kernel_regularizer=<keras.reg...) W_regularizer=Reg.l1_l2(l1=nu1, l2=nu2))(y_hat[i + 1]) C:\Users\丙冰\Desktop\GEM\gem\embedding\sdne_utils.py:92: UserWarning: Update your Dense call to the Keras 2 API: Dense(34, activation="relu", kernel_regularizer=<keras.reg...) W_regularizer=Reg.l1_l2(l1=nu1, l2=nu2))(y_hat[1]) C:\Users\丙冰\Desktop\GEM\gem\embedding\sdne_utils.py:96: UserWarning: Update your Model call to the Keras 2 API: Model(inputs=Tensor("in..., outputs=Tensor("de...) decoder = Model(input=y, output=x_hat) C:\Users\丙冰\Desktop\GEM\gem\embedding\sdne_utils.py:108: UserWarning: Update your Model call to the Keras 2 API: Model(inputs=Tensor("in..., outputs=[<tf.Tenso...) autoencoder = Model(input=x, output=[x_hat, y]) C:/Users/丙冰/Desktop/GEM/gem/embedding/sdne.py:115: UserWarning: The merge function is deprecated and will be removed after 08/2017. Use instead layers from keras.layers.merge, e.g. add, concatenate, etc. output_shape=lambda L: L[1]) H:\python3.6\lib\site-packages\keras\legacy\layers.py:456: UserWarning: The Merge layer is deprecated and will be removed after 08/2017. Use instead layers from keras.layers.merge, e.g. add, concatenate, etc. name=name) C:/Users/丙冰/Desktop/GEM/gem/embedding/sdne.py:118: UserWarning: The merge function is deprecated and will be removed after 08/2017. Use instead layers from keras.layers.merge, e.g. add, concatenate, etc. output_shape=lambda L: L[1]) C:/Users/丙冰/Desktop/GEM/gem/embedding/sdne.py:121: UserWarning: The merge function is deprecated and will be removed after 08/2017. Use instead layers from keras.layers.merge, e.g. add, concatenate, etc. outputshape=lambda L: L[1]) C:/Users/丙冰/Desktop/GEM/gem/embedding/sdne.py:147: UserWarning: Update your Model call to the Keras 2 API: `Model(inputs=Tensor("x..., outputs=[<tf.Tenso...) self._model = Model(input=x_in, output=[x_diff1, x_diff2, y_diff]) WARNING:tensorflow:From H:\python3.6\lib\site-packages\keras\backend\tensorflow_backend.py:1123: calling reduce_mean (from tensorflow.python.ops.math_ops) with keep_dims is deprecated and will be removed in a future version. Instructions for updating: keep_dims is deprecated, use keepdims instead C:/Users/丙冰/Desktop/GEM/gem/embedding/sdne.py:160: UserWarning: The semantics of the Keras 2 argumentsteps_per_epochis not the same as the Keras 1 argumentsamples_per_epoch.steps_per_epochis the number of batches to draw from the generator at each epoch. Update your method calls accordingly. verbose=1 C:/Users/丙冰/Desktop/GEM/gem/embedding/sdne.py:160: UserWarning: Update yourfit_generatorcall to the Keras 2 API:fit_generator(generator=<generator..., verbose=1, steps_per_epoch=0, epochs=50)` verbose=1 WARNING:tensorflow:Variable = will be deprecated. Use variable.assign_mul if you want assignment to the variable value or 'x = x y' if you want a new python Tensor object. Epoch 1/50 Exception in thread Thread-1: Traceback (most recent call last): File "H:\python3.6\lib\threading.py", line 916, in _bootstrap_inner self.run() File "H:\python3.6\lib\threading.py", line 864, in run self._target(*self._args, **self._kwargs) File "H:\python3.6\lib\site-packages\keras\engine\training.py", line 606, in data_generator_task generator_output = next(self._generator) File "C:\Users\丙冰\Desktop\GEM\gem\embedding\sdne_utils.py", line 50, in batch_generator_sdne deg_i = np.sum(X_batch_v_i != 0, 1).reshape((batch_size, 1)) ValueError: cannot reshape array of size 154 into shape (500,1)

Traceback (most recent call last): File "C:/Users/丙冰/Desktop/GEM/gem/embedding/sdne.py", line 262, in is_weighted=True, no_python=True) File "C:/Users/丙冰/Desktop/GEM/gem/embedding/sdne.py", line 160, in learn_embedding verbose=1 File "H:\python3.6\lib\site-packages\keras\legacy\interfaces.py", line 88, in wrapper return func(*args, **kwargs) File "H:\python3.6\lib\site-packages\keras\engine\training.py", line 1913, in fit_generator callbacks.on_epoch_end(epoch, epoch_logs) UnboundLocalError: local variable 'epoch_logs' referenced before assignment

Process finished with exit code 1 ............................................................................... May I ask the author what caused this mistake? How to solve it? thank you

nikyim commented 3 years ago

@dbbice you need to update the SDNE object param for n_batch to be less than 154