C1W2_Assignment (callback has no attribute set_model)

Hi, I don’t understand the problem with my code. Please help, Thank you!



# Remember to inherit from the correct class

What class does your myCallback inherit from?

I don’t understand. Can you elaborate??

I’ve got it now. I understood the issue

It’s actually a fundamental lesson of this exercise. The Python language supports class hierarchies. This exercise is asking you to write a custom Keras callback, which requires you to define a custom class that is a subclass of something else, through which it inherits important capabilities. Like the function set_model(). The comment in the code is reminding you to specify the correct metaclass. Because the callback class as defined by the OP does not inherit from any metaclass, the answer to my intentionally rhetorical question above is ‘none’. But which class should it have inherited from?

https://keras.io/guides/writing_your_own_callbacks/

Or maybe click on the link to see what the hint provides

3 Likes

@ai_curious thanks a lot !

1 Like