I get the following prior to the assertion error:
Epoch: 0 — cost = 2.664198098365268
Accuracy: 0.9166666666666666
Epoch: 100 — cost = 96.19998254000362
Accuracy: 0.5

Referring to previous posts:

I do have the calculation for z correct.

I believe I have the cost calculation correct.

I’ve printed W and b and see them updating updating. Prediction is all zeros. Have restarted my kernel and rerun.

Thoughts and suggestions welcome. I’m not sure where to go next. Thank you.

You don’t say which week or assignment of Course 5 this is. I don’t recognize it, but then I only know Week 1 of Course 5. Generally speaking you’ll have better luck if people know which specific assignment is being asked about.

But notice that both your cost and accuracy are moving in the opposite direction that you would normally hope … Are you sure there’s not a sign flipped somewhere? E.g. adding instead of subtracting in “update parameters”?

Apologies, W2 of C5. Since the cost isn’t used directly the sign appears not to matter. I’ve tried both – they have the same absolute value, the signs is flipped.

The predictions went from almost correct to all zeros. I went back to first principles and checked the formulas for the gradients. My dW formula had a minus sign – totally possible it was a cursor landed in the wrong place situation but worth a check if anyone has a similar issue. Removed that and all is well.