I keep on getting error while working on the propagate function. Not sure what is going wrong here
Your implementation of the logic for dw
must be incorrect. The first step is to read the instructions again carefully and then compare the formula shown for dw
to the code you wrote. Note that your values are off by about 3 orders of magnitude, so there must be some pretty fundamental misinterpretation of the formula.
I added some print statements to show the m and A values, since those are inputs to the dw
and db
calculations and here’s what I see with that test case:
m = 3
A = [[0.99979657 0.62245933 0.00273196]]
dw = [[ 0.25071532]
[-0.06604096]]
db = -0.1250040450043965
cost = 0.15900537707692405
m = 4
A = [[0.99849882 0.99979657 0.15446527 0.99966465]]
All tests passed!
Also notice that there are two separate test cases there and for the one where the results are printed your values for db
and cost
are also wrong. Notice that your cost value is negative, but the cost is positive by definition. So please take a careful look again at all the formulas you need to implement.