Some wierd number for loss after 12'th epoch

in C2_W1_Lab02_CoffeeRoasting_TF, here is the original compile and fit segment
loss = tf.keras.losses.BinaryCrossentropy(),
optimizer = tf.keras.optimizers.Adam(learning_rate=0.01),
to see how much cost improves, I re-set epochs to 15 and after 12’th iteration the loss value started to appear an obscure number such as 8.6667e-04

then the predictions with new feature values also appear similar to this number such as : [[9.63e-01]
what is the reason for that? why does the model crash? after 12’th iterations.
note that in this lab we work on a training set of 200K values.


Hello Mehmet @mehmet_baki_deniz,

It should print the cost for each epoch, can you share a screenshot of all epochs’ costs?


hi rmwkwok,

here is the printscreen

I see. @mehmet_baki_deniz, 8.6667e-04 means 8.6667 \times 10^{-4} which means 0.00086667. So from epoch 11 to epoch 12, the loss is reduced by (0.0015 - 0.0011 = 0.0004), and from epoch 12 to epoch 13, the loss is reduced by (0.0011 - 0.00086667 \approx 0.0002)

Therefore, I think the improvement is still reasonable because the improvement should be steadily decreasing as we are closer and closer to fitting well with the training data.


PS: 8.6667 \times 10^{-4} is called the “scientific notation”. It is a convenient way to write less zeros, and to clearly show the order of magnitude.

1 Like

thank you very much again for your response