Skip to content

Instantly share code, notes, and snippets.

@e-lin
e-lin / trainSingle.py
Created July 9, 2019 12:17
Training one Autoencoder at a time in a single graph
optimizer = tf.train.AdamOptimizer(learning_rate)
with tf.name_scope("phase1"):
phase1_outputs = tf.matmul(hidden1, weights4) + biases4 # bypass hidden2 and hidden3
phase1_reconstruction_loss = tf.reduce_mean(tf.square(phase1_outputs - X))
phase1_reg_loss = regularizer(weights1) + regularizer(weights4)
phase1_loss = phase1_reconstruction_loss + phase1_reg_loss
phase1_training_op = optimizer.minimize(phase1_loss)
with tf.name_scope("phase2"):
@e-lin
e-lin / training.py
Last active October 1, 2019 09:39
Training Phrases for Chatbot
training_phrases = {
'when_is_open' : ' '.join([
'when is the restaurant open?',
'when to start open?'
]),
'where_is_the_restaurant' : ' '.join([
'where is the restaurant',
'what is the location of the restaurant?',