Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error running SDNE algorithm #97

Open
dbbice opened this issue Jul 17, 2020 · 1 comment
Open

Error running SDNE algorithm #97

dbbice opened this issue Jul 17, 2020 · 1 comment

Comments

@dbbice
Copy link

dbbice commented Jul 17, 2020

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.
output_shape=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 argument steps_per_epoch is not the same as the Keras 1 argument samples_per_epoch. steps_per_epoch is 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 your fit_generator call 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
Copy link

nikyim commented Nov 30, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants