Hello @Pinnamaneni_Ganesh ,
Saw your code snippet. There are several issues :
- I see you have imported tf, keras and numpy in the callback cell. Don’t import anything.
- You don’t need to define x_train and y_train here.
- Your logic of checking accuracy is wrong
- Print statement is wrong too.
Check this hint :
Write an MNIST classifier that trains to 99% accuracy and stops once this threshold is achieved. In the lecture you saw how this was done for the loss but here you will be using accuracy instead.
Some notes:
When it reaches 99% or greater it should print out the string “Reached 99% accuracy so cancelling training!” and stop training.
- Don’t write the model creating and training part here. I see you have taken
1000
epochs?! that too in the cell of callback .
Those are in next cell. And Number of epoch should be 10, not 1k.
It’s written in hint:
Create and train your model
Now that you have defined your callback it is time to complete the train_mnist function below.
You must set your model to train for 10 epochs and the callback should fire before the 9th epoch for you to pass this assignment.
Hope this helps.
note: read the hints.
You can discuss this freely here. I asked DM just to send notebook/snippet.
With regards,
Nilosree Sengupta