Week2 Prog. exercise 8


Hello,

in Week 2, Exercise 8 - L1, section [8], the given code is:"

yhat = np.array([.9, 0.2, 0.1, .4, .9])
y = np.array([1, 0, 0, 1, 1])
print("L1 = " + str(L1(yhat, y)))

L1_test(L1)
"
The last row seems redundant.

When I run it, it gives the error:"

NameError: name ‘L1_test’ is not defined
"
Thanks for help!

Be sure to have run the cell (basic_sigmoid) containing the line below
from public_tests import * before running the L1_test function.

Right or just do “Cell → Run All Above”. That call is not redundant: there may be more than one test for each function. You’ll see that pattern in all the notebooks. They frequently give you one test that you can actually see and one that’s in a different file. You can see that one too, but it takes a little more work: click “File → Open” and then open the file public_tests.py. There is a topic about this on the FAQ Thread which is worth a look on general principles. There are lots of other interesting things mentioned there.

Thanks for help, it is working now.

Thanks for help. And the FAQ thread is also very helpful.