Programming Assignment Week 2 Exercise 8

I am having trouble with Exercise 8 for the Week 2 programming assignment. I put this code:
w, b = np.zeros((X_train.shape[0],1)),0
params, grads, costs = optimize(w, b, X_train, Y_train)
w = params[“w”]
b = params[“b”]
Y_prediction_test = predict(w,b,X_test)
Y_prediction_train = predict(w,b,X_train)

But it doesn’t work. I have been stuck on this for a while. Could someone point me in the right direction?

Hey @ssr0910 , this post seems similar to what you are encountering. Maybe this will help you as well: Week 2 - Programming Assignment (Exercise 8)

I read it. Thank you for sending it my way! I am still confused about initializing w and b. Is there a difference between using dims or using the zeros function?

I am still having an issue with this. Does anyone have any ideas?

Hey @ssr0910 , can you direct message me your notebook ? I’ll take a look. Thanks.

Hi @ssr0910, you should share the error code in order for us to help you. You say it doesn’t work, what exactly isn’t working?

Looking at your code I see an obvious issue. Why aren’t you using the initialize_with_zeros function defined in Exercise 4? :slight_smile:

That function should be working because it has been already tested in Exercise 4. I would suggest you to use it and if you’re still having issues to post the error log you’re getting.

1 Like

I downloaded it how do I dm you?

1 Like

I didn’t see that thank you for pointing it out!

1 Like

Hi @ssr0910 , did you manage to correct the issue? If you didn’t then you can just paste the error log here as answer to this post.

1 Like

I figured it out! Thank you for your help!