Week 3 nn Model

All my previous blocks


ran without error but for this final nn model I am getting errors.

It is perfectly possible for a correct subroutine to throw errors if you pass it bad (e.g. mismatching) arguments. So if your forward_propagation function passed the tests earlier, then the bug is probably in your nn_model logic somehow. But you may have to add some instrumentation in forward_propagation to figure out what went wrong. Anytime you get a “dimension mismatch” error, the first question is “well, what are the dimensions?” Put print statements in forward_propagation to show the shapes of A2 and X. Which one is correct? Now you have to track backwards to figure out where things went off the rails.

1 Like

@Aniruddha_Rokade, yes, track your previous codes. You might get it solved on your own. I was having the same sort of problem in nn_model case, got errors in cost computing. It was asking to check the number of arguments I was running in compute_cost from the previous passings.

Okay sir. I did backtracking but I am unable to find the bug. All shapes in previous models are right but in the nn_model it is showing wrong shape for W1.

Yes Rashmi you are right but somehow dimensions of parameters are changing in the Last nn_model . I track backward but nothing found.

I went again through code , n_h in layer sizes was missing after putting I got desired results. Thank You for your guidance.