Exercise 3 logistics regression get stuck

Hi, i got stuck in Exercise 3 for hours. I have followed all the hints and typed it instead of copying it ,however the first outcome dj_db is correct while the dj_dw is not. I cannot find the reason and would like to seek suppot. Thank you.

dj_db at initial w and b (zeros):-0.1
dj_dw at initial w and b (zeros):[32.822137028661594, 33.110999044058474]

Hello, @futureclover,

You may add some prints in between the lines of your code, and spot the difference:

i = 0 z_wb = 0
i = 0 j = 0 z_wb = 0.0
i = 0 j = 1 z_wb = 0.0
i = 0 z_wb = 0.0
i = 0 f_wb = 0.5
i = 0 dj_db_i = 0.5
i = 0 dj_db = 0.5
i = 0 j = 0 dj_dw = [17.31182981  0.        ]
i = 0 j = 1 dj_dw = [17.31182981 39.01234641]

i = 1 z_wb = 0
i = 1 j = 0 z_wb = 0.0
i = 1 j = 1 z_wb = 0.0
i = 1 z_wb = 0.0
i = 1 f_wb = 0.5
i = 1 dj_db_i = 0.5
i = 1 dj_db = 1.0
i = 1 j = 0 dj_dw = [32.4551852  39.01234641]
i = 1 j = 1 dj_dw = [32.4551852  60.95984517]

i = 2 z_wb = 0
i = 2 j = 0 z_wb = 0.0
i = 2 j = 1 z_wb = 0.0
i = 2 z_wb = 0.0
i = 2 f_wb = 0.5
i = 2 dj_db_i = 0.5
i = 2 dj_db = 1.5
i = 2 j = 0 dj_dw = [50.37888958 60.95984517]
i = 2 j = 1 dj_dw = [50.37888958 97.41094418]

I only included the first three iterations to not make my post too long. Hope it will be enough, but if not, please let me know. The variables I printed followed the variables used in the Hints section of the exercise.

Good luck!
Raymond