Week 2 practice lab: Linear regression / tuple

Hello. Now I’m working Week practice lab But I can’t solve this error…
{moderator edit: code removed}


What’s wrong in my code ? and I’m Korean student so Sorry about my English skill… :sweat_smile:
Would appreciate insight on why this is breaking. Thank you! :grinning:

Hi @qkqk1009

It looks like your notebook has been modified and some of the information about the input arguments removed:

Computes the gradient for linear regression
Args:
x (ndarray): Shape (m,) Input to the model (Population of cities)
y (ndarray): Shape (m,) Label (Actual profits for the cities)
w, b (scalar): Parameters of the model
Returns
dj_dw (scalar): The gradient of the cost w.r.t. the parameters w
dj_db (scalar): The gradient of the cost w.r.t. the parameter b
“”"
As you can see, the above explained what the shape of the arrays x is. The line of code for extracting the m has been done for you. But because of the changes you made, that line of code is now incorrect, resulting the return of a tuple rather than the single integer value of m . If you change it back to this:

m = x.shape[0]

specifying the first element of that tuple m is what you are looking for, then it should work.

Thank you for your reply.
I did like you so I solved that…!!
now I’m happy !
Enjoy your weekend ! Thanks a lot :smile:

In the future, please do not post your code on the forum. Sharing your code is not allowed.

I have edited your message and removed the code.

Sorry about it.
It’s my mistake…
When I post again I will not post the code.
Thanks you

sorry am not able to finf an error

ma aslo unable to proess the code need help

Hi @Muqaddas_Fatima!

Kindly share your error.

Best,
Saif.

Hello guys.

Happy Easter.

I have a problem I am trying to run my code but I got this problem from x_train that I cannot change the code related to this part. I would appreciate it if anyone could help me.

Hello @Sina_Roustaeikakaei!

Kindly run all preceding cells before executing the current cell. Every time you open the Notebook, you need to do that. This is because the current cell relies on the objects, functions, arrays, etc. generated by the preceding cells.

Best,
Saif.