I am looking for answers to the C1W2 assignment
I am not a developer type but wanted to know some basics about Tensor flow,
Having answers would be helpful to my understanding
What do I need to do for " #Load the Data" code box?
Then, what is required for “Defining your callback” codebox
thx
There must be a better way to learn Tensor Flow ???
I haven’t found any good postings on how to complete C1W2 assignment
thx
DG2/
I am sure that this assignments are very similar to the completed Labs part of the courses, so check those out before moving into the labs.
Please look at the first line inside class myCallback
. You are creating an instance of the callback class before defining it. How do you expect this to work? Don’t forget to remove code from your posts. It’s ok to leave stacktraces around.
Balaji
Are you able to be more prescriptive?
Was the callback not defined in the code block section “Defining your callback” with the line:
class StopCallback(tf.keras.callbacks.Callback):
Sure. Look at this line callbacks = myCallback()
. It’s inside train_mnist()
function but nested inside class myCallback
. In python, the class definition needs to be complete before creating an instance of it.
Balaji, thank you, but now have new errors.
I moved “callbacks = StopCallback()” to be nested in the if(logs.get(‘acc’)>=0.99 statement.
But now get two more errors
- that "name ‘path’ is not defined from (x_train, y_train), (x_test, y_test) = mnist.load_data(path=path)
- train_mnist() takes 0 positional arguments but 2 were given from hist = train_mnist(x_train, y_train)
thx
G2/
I removed the words path in the line to (x_train, y_train), (x_test, y_test) = mnist.load_data()
but now get the error that "name ‘callbacks’ is not defined in the line history = model.fit(x_train, y_train, epochs=10, callbacks=[callbacks])
I thought callback was already defined?
thx