you have overwritten the variables you defined with your old code.
You didn’t even read, what I wrote. you don’t need to use the index [j].
from first line:
loss_sum
for i in range (m)
…
until here is fine:
Delete this block
for j in range (n)= …
f_wb… → this too you subscribed my variable!
from here is fine.
loss = -y … and the rest of the code is right.
I am out of, can’t help anymore. Wish you all the best.
sir i pass the this test i have done as you told thank you i will do next thank you very much
sir now i am stuck in the next again value i get does not match expected
{Moderator’s Edit: Solution Code Removed}
Hey @Sudipta_Mukherjee1,
You do realize that it’s not even an hour since you posted your doubt in the public forums. Please don’t go about starting to DM mentors. Please do realize that the mentors at DeepLearning.AI are volunteers, we are not paid to help. The mentors try to reply as soon as possible, but they have their full-time jobs or some of them are full-time students like me.
Now, coming to your query, your code has indentation issues. Simply adding print
statements to your code can help you to realize that your code is not computing the gradients as per the formulation. If you are uncomfortable with indentation in python, please check out 07 of this thread, and if you are new to Python, then check out 03 of the same thread.
If print
statements are something you don’t like, you may also use a pen and a paper, and try to see what your code is actually computing. I hope this helps.
Lastly, if I am not wrong, I conveyed to you previously before as well. Let me convey it again. Posting code in the public forums is strictly against the community guidelines. If a mentor needs to take a look at your code, (s)he will ask you to DM it. You are always welcome to post the traceback of your error.
Cheers,
Elemento
1 Like
sir i have deadlines coming i have to pay again if i do not do it by 4th
ok i will try it tomorrow
can not find distance please anybody
Hey @Sudipta_Mukherjee1,
What exactly are you trying to achieve with the following line of code:
for i in range :
Like what exactly are you iterating over here? Additionally, it seems to me that you are getting confused between the vectorized approach and the for
loop approach here.
Cheers,
Elemento
hi i have been stuck in this part of third week’s practice lab. my code showing no error still the values of dj_dw is not matching the expected values and thus all the subsequent exercises are not being calculated right. please explain what can i do about it?