In course 1, week 2 assignment" Logistic Regression with a Neural Network mindset"
#Exercise 8 - model
how I know the dim of the parameters of the w and b for initialization?
I am using w, b = initialize_with_zeros(dim)
Hi malsharawy,
Welcome to the community and thanks for your question! Let me give you a hint: look at the arguments of the model function shown in red in your exercise. There you will see the different inputs for the function defined along with their shape. Think about which argument the w and b variables are using. If you know that, then you can determine the shape as well. Good luck and let us know whether you can find the answer!
Regards, Stephanus
Dear Stephanus,
Thanks for your answer , i am not sure i got the right answer but it gives me now wrong values and wrong type for dw and db , here is the error
AssertionError Traceback (most recent call last)
in
----> 1 model_test(model)
~/work/release/W2A2/public_tests.py in model_test(target)
117 assert type(d[βwβ]) == np.ndarray, f"Wrong type for d[βwβ]. {type(d[βwβ])} != np.ndarray"
118 assert d[βwβ].shape == (X.shape[0], 1), f"Wrong shape for d[βwβ]. {d[βwβ].shape} != {(X.shape[0], 1)}"
β 119 assert np.allclose(d[βwβ], expected_output[βwβ]), f"Wrong values for d[βwβ]. {d[βwβ]} != {expected_output[βwβ]}"
120
121 assert np.allclose(d[βbβ], expected_output[βbβ]), f"Wrong values for d[βbβ]. {d[βbβ]} != {expected_output[βbβ]}"
AssertionError: Wrong values for d[βwβ]. [[ 0.28154433]
[-0.11519574]
[ 0.13142694]
[ 0.20526551]] != [[ 0.00194946]
[-0.0005046 ]
[ 0.00083111]
[ 0.00143207]]
can you give me a hint?
Hey got the same issue, check the func model parameters against the func optimize parameters.
You might want to review how you are calling the optimize function on model.
Thank you , IS THE X_train.shape = 4 in model ? as i understand it should be 12288
Hi, when model_test(model)
is called X_train.shape
is not 4, it is (4, 3), you can easily check it just by printing its shape inside the model
function.
I donβt know if you have already solved the other errors but you could debug them just by comparing the expected output with the one you have, for example, starting with d['w']
, that should be of type np.ndarray
, so check whatβs the type of w
anywhere you are using it, because thatβs basically what is assigned to d['w']
in the dictionary d
.
it is solved thank you , i was having a typo error
Cool, keep the good work
Good to hear itβs solved!