Created
August 4, 2018 13:28
-
-
Save patricoferris/56eee04ec72f5d74dd0812079d0567cd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Running our Neural Network! | |
#First we init the session | |
iterations = 100000 | |
with tf.Session(graph=graph) as sess: | |
#We run the initialize all global variables operation | |
sess.run(tf.global_variables_initializer()) | |
average_loss = 0.0 | |
#For all of the iterations | |
for index in range(iterations): | |
#Generate a batch | |
ti, tl = gen_batch(genres, scores, batch_size, 8) | |
#Put these in our feed dictionary | |
feed_dict = {training_inputs: ti, training_labels: tl} | |
#Run the NN! Notice the feed dict feeding our placeholders from before | |
_, loss_val = sess.run([optimizer, loss], feed_dict=feed_dict) | |
#Some metrics so we can see how we're doing | |
average_loss += loss_val | |
if (index + 1) % 2000 == 0: | |
print('Average loss at step', index + 1, average_loss / (index + 1)) | |
#Returns our Embeddings so we can access them | |
final_embeddings = embeddings.eval() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment