-
Notifications
You must be signed in to change notification settings - Fork 160
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
usage inquiry: retrieving weights for hinton #256
Comments
That's a good point, I think I'll need to add this as a feature or at least mention it in the documentation. For now, you can do it like from neupy.utils import tensorflow_session
sess = tensorflow_session()
layer = optimizer.network.layers[1] # or network.layers[1]
weights = sess.run(layer.weight) |
I tried my hand at a rough mock-up of the feature as a function since I think it would only be a small for loop as seen below:
hope it helps, and thank you again for your feedback. |
you also need to remember that not every layer has weights (the |
I know the below is an ugly mockup, but I gave another stab at it from neupy.utils import tensorflow_session
import numpy as np
def weights():
sess = tensorflow_session()
layers = optimizer.network.layers
weights = []
for layer in layers:
try:
weights.append(sess.run(layer.bias))
except Exception as e:
pass
try:
weights.append(sess.run(layer.weight))
except Exception as e:
pass
return np.toarray(weights) |
I was reviewing the documentation and I haven't managed to figure out how to retrieve the matrix of weights from a trained neural network to pass to the hinton graph. I was reviewing the below documentation and only a demo numpy matrix is utilized as an example.
http://neupy.com/docs/secondary/visualizations.html
Any insight into this matter would be much appreciated. Thank you again for creating this wonderful neural network library!
The text was updated successfully, but these errors were encountered: