the course’s previous code examples use ‘accuracy’ in the callback function, so it’s natural students continue using the full name in assignment, but this would result failure when submitting the assignment. I spent 40 min debugging my code, and only realize the cause is different versions of code.
shouldn’t the assignment notify this in the beginning notes? (and we appreciate the other notes including the epoch and accuracy)
In this context, logs is a Python dictionary using key-value pairs. In dictionary lookup, close doesn’t count…the key is either in the dictionary or it’s not. Which means that the key used in the callback lookup must match the one used in the model compile() statement when the metric was defined. You can use the string ‘acc’ or ‘accuracy’ as the key, but pick one and use it consistently because in this context they are most definitely not exactly the same.
My callback is not working
All 10 epochs run and all with ‘acc’ = 0.0987 - see image
I have used ‘acc’ throughout and NOT ‘accuracy’
What is the problem?
thx
I have the same problem, I reach 99% accuracy but my call to the callback function does not exit the train execution but continues executing the 10 epochs
Posting code in a public topic is discouraged and can get your account suspended. It’s okay to share stacktrace on a public post and send code to a mentor via direct message. Please clean up your recent reply.
Since = code isn’t clear, you should look at the ungraded labs (C1_W2_Lab_2_callbacks.ipynb) to see what boolean value is used to ensure that model does stop training. Here’s another link you’ll find useful.