January 2019
Intermediate to advanced
342 pages
9h 17m
English
The _train function illustrated here can be used to train the RBM. In this function, we first invoke the _network function to build the RBM network structure and then we train the model for a specified number of epochs within an activated TensorFlow session. The model is saved at specified intervals using TensorFlow's saver function:
def _train(self): self.__network() # TensorFlow graph execution with tf.Session() as sess: self.saver = tf.train.Saver() #saver = tf.train.Saver(write_version=tf.train.SaverDef.V2) # Initialize the variables of the Model init = tf.global_variables_initializer() sess.run(init) total_batches = self.train_data.shape[0]//self.batch_size batch_gen = self.next_batch() # Start the training for epoch ...
Read now
Unlock full access