C4W2 Transfer Learning Ex3 Grader Function Bug

The grader function of Exercise 3 has the following assert:
assert metrics[0] == ‘accuracy’, “Wrong metric”

This can’t work as it is checking the first Char of the String ‘accuracy’, e.g ‘a

Correct would be:
assert metrics == ‘accuracy’, “Wrong metric”

Hello Peter,

is your a is bold in like this a in accuracy, please make it simple accuracy

or if there is any description of the error you are getting, take a screenshot and post here, so we can guide further.

Regards
DP

I think you found the solution, as discussed here.

So in the end the fault was to give a String instead of a List with that String. Wich does work and get interpreted correctly. My takeaway of this, and the other problems I was suffering with, are due to thw way Python is working. After using mostly Java over the last 20 years, mamy “features” of Python break with the knowledge of best practices like Information Hiding and type security of variables and avoid overloading functions with differnt types of parameters.

This problem was not an issue with weird python syntax. You just didn’t correctly understand the definition of the API you were calling. I grant you that the TF APIs are pretty complicated, but all the more reason one needs to invest the effort to understand their definitions.

Also just as a point of information, this course was first published in the Fall of 2017. They did a major update in April of 2021 to upgrade from TF 1.0 to TF 2.0. So there haven’t been any real changes to the assignments here in more than two years. So when you hit a test failure, the best approach is not to assume that it’s a bug in the test. The thing you reported as a bug on that other thread would have been fixed more than 2 years ago if it had actually been a bug.