Week 3_Exercise 7 : gettting error in output from "update_parameter" functions


For this function, when I am testing with the “update

_parameters_test_case()”, I get the correct expected output as mentioned in the exercise (please see attached screenshot). But, when the grader checks it with the “update_parameters_test(update_parameters)” tester,specially with “multiple_test(test_cases, target)”, I get a “wrong output” error. Any idea what am I doing wrong?

In eddition, I am seeing something unexpected to be happening. When the “update_parameters_test” function is calling the “multiple_test(test_cases, target)” function and performing the 3 types of check by calling the “target(*test_case[‘input’])”, everytime the “*test_case[‘input’]” is changing. I think that why I am getting the error as the “target output” does not match the “expected output”. I can’t figure out at all why this is happening.

My guess is that the problem is that you are using the “in place” style operators for your update. That means:

W -= <... update formula ...>

As opposed to:

W = W - <... update formula ...>

The in place form only works if you first break the connection to the global variables that are the test inputs. Here’s a thread which goes into the details of why this is required.