Issue with Week 3 Assignment (Unit Test Exercise 3 and 4)

Hello, my output is correct, but the Unit Test for Exercise 3 is failing:

image

The same thing is happening in the loop portion of the assignment:

Any suggestions?

Please take a more careful look at the math formulas you are implementing. You wrote this:

Z = W * X + b

But * means “elementwise” multiplication. What the formula says there is “dot product” style multiplication, so you really needed to use np.dot for that operation. Now the question is why the first test didn’t fail. It must have accidentally used dimensions that work with that mistaken multiplication operation.

The other high level point here is to note that there must be two different test cases: you passed one, but failed the other. You can always take a look at the code for the other test by clicking “File → Open” and then opening the file w3_unittest.py and examine the test code to see how it works.

For the assert about initialize_parameters, it’s a similar issue: you’ve got two test cases and you pass the first one, but fail the second one. In that case, it probably means you hard-coded the dimension to be used for n_y to match the value used in the first test case. There again, you can look in the test file to see what is different about the second test case, which should give you a clue about the nature of your mistake.