Normalization problem

I am getting assertion error while solving normalization problem in week 2. I have not been able to figure it out

1 Like

We’ll need a bit more context to understand what the issue is here. The best way to proceed would be to “copy/paste” the whole exception trace that you are getting when you run whatever cell it is that is failing. Please don’t post the source code: just the output of running the cell. From that we can usually give some direction about where the problem is.

3 print("normalizeRows(x) = " + str(normalize_rows(x)))
----> 5 normalizeRows_test(normalize_rows)

~/work/release/W2A1/ in normalizeRows_test(target)
162 ]
→ 164 test(test_cases, target)
166 def softmax_test(target):

~/work/release/W2A1/ in test(test_cases, target)
24 print(’\033[92m’, success," Tests passed")
25 print(’\033[91m’, len(test_cases) - success, " Tests failed")
—> 26 raise AssertionError(“Not all tests were passed for {}. Check your equations and avoid using global variables inside the function.”.format(

Ok, that says that the output values are incorrect. Please have another look at the instructions and also show us your output values. Here’s what I get from that section:

normalizeRows(x) = [[0.         0.6        0.8       ]
 [0.13736056 0.82416338 0.54944226]]
 All tests passed.

Also note that they literally write out the python code in the instructions for you to do the norm calculation. Then all you need to do is divide x by the norm.