July 2019
Intermediate to advanced
512 pages
19h 39m
English
Compute the loss using cross entropy. We know that the cross-entropy loss is given as follows:

Here,
is the actual label and
is the predicted label. Thus, the cross-entropy loss is implemented as follows:
cross_entropy = -tf.reduce_sum(y*tf.log(YHat))
Minimize the loss using the Adam optimizer:
optimizer = tf.train.AdamOptimizer(1e-4).minimize(cross_entropy)
Calculate the accuracy:
predicted_digit = tf.argmax(y_hat, 1)actual_digit ...
Read now
Unlock full access