C1W2 - train_mnist works fine but something is wrong with MyCallback

Here’s the feedback from the submission.

0/50 points earned

There was a problem grading your submission. Details:
issubclass() arg 1 must be a class

train_mnist
50/50 points earned
5 epochs
Code ran fine. Interrupted correctly after 5 epochs when the accuracy exceeded 99%

I think I used the same syntax for MyCallback as in the ungraded exercises. Not sure how I can debug further to exactly match the requirements of the exercise.

Remember to inherit from the correct class

While recalling
class myCallback make sure you used (tf.keras.callbacks.Callback):

Thanks for the prompt feedback.

I did use that exact line, though. Any other suggestions?

The callback is working too since it printed the correct message before terminating.

I have this sinking feeling I’m trying to match some very specific line of code though I followed the model in the ungraded exercises.

You can share the codes for the cell you scored 0 via personal DM

Click on my name and then message.

Hello @SriRaman

Sorry for delayed response,

your if log statement needs correction
if logs is not None and logs.get(‘accuracy’) > 0.99:THIS IS INCORRECT

correct code line :point_down:
if {codes removed by moderator}

REGARDS
DP

[quote=“Deepti_Prasad, post:5, topic:617266”]Codes removed by moderator
[/quote]

Thanks for getting back to me. No need to apologize. I tried it again with high hopes after your correction of what seemed like an oversight but had the same result. Hope I’m not missing something obvious again.

The part which really puzzles me is that the code prints the message about cancelling training and ends early correctly. It’s not as if it just breaks with an obvious error message that I can try to debug.

{Images removed by moderator}

Can you do the following.

First save a copy of your assignment.

Then delete the file in the coursera environment, and get a fresh copy of assignment by clicking reboot, get the latest version and update Lab.

Re-do the assignment.

Make sure this time when you write codes only replace the none with your codes and do delete or edit anythiny else.

Submit it.

Let me know if you still has the same issue.

Regards
DP

Thanks. Tried something similar yesterday but I’ll give it another go with a clean slate tmw morning and let you know how everything went. Thanks for your patience and continued assistance.

Best,

Raman

1 Like

Thanks for all your help. Finally got everything to work after adding an extra line and argument to the template.

from tensorflow.keras.callbacks import Callback
class myCallback(Callback):

Some day I will get better with Python. I know that items which become second nature to someone deeply immersed in coding are still not immediately available to me yet.

Thanks again. On to the next lab!

Raman

1 Like