Deep learning Course4 A2 : metric problems

Use accuracy as evaluation metric

> metrics = [tf.keras.metrics.Accuracy()]

when I use the code above , there’ll be AssertionError: Wrong metric.
And the score feedback 1st shows 100, but 2nd&3rd shows: Unexpected error occurred during variable check. We expected variable metrics to be of type <class ‘str’>. Please check that this variable is initialized and is of the right type.

> metrics = tf.keras.metrics.Accuracy()

when I use the code above , it showsTypeError: ‘Accuracy’ object is not subscriptable

> metrics =[‘accuracy’]

when I use the code above , it shows all tests passed,
BUT the score feedback shows: Code Cell UNQ_C3: You have an incorrect value for ‘metrics’ variable. We expected a value of ‘accuracy’ and you have ‘<tensorflow.python.keras.metrics.Accuracy object at 0x7f40d56c48d0>’.

I’m confused.
Please help.
Thanks a lot!

metrics = [‘accuracy’] is correct. That’s what the unit test checks for.

For the error in the score feedback, I think you may have some other incorrect code in that cell.

1 Like

Also, be sure you save all the changes in your notebook file before you submit it for grading.
When you modify a cell, it isn’t automatically saved immediately.