(self)
Define the cost function.
Define the cost function.
Define the cost function .
def _create_loss_optimizer(self):
        """Define the cost function."""
        if self.walkbacks > 0:
            cross_entropies = \
                [binary_crossentropy(y, self.x) for y in self.p_X_chain]
            self.cost = tf.reduce_mean(tf.add_n(cross_entropies))
        else:
            self.cost = tf.reduce_mean(binary_crossentropy(self.y, self.x))

        # Use ADAM optimizer.
        opt = tf.train.AdamOptimizer(learning_rate=self.learning_rate)
        self.opt = opt.minimize(self.cost)
def _create_loss_optimizer ( self ) : if self . walkbacks > 0 : cross_entropies = [ binary_crossentropy ( y , self . x ) for y in self . p_X_chain ] self . cost = tf . reduce_mean ( tf . add_n ( cross_entropies ) ) else : self . cost = tf . reduce_mean ( binary_crossentropy ( self . y , self . x ) ) # Use ADAM optimizer. opt = tf . train . AdamOptimizer ( learning_rate = self . learning_rate ) self . opt = opt . minimize ( self . cost )