1stcourse week2-lab practice lab linear regression

I have been trying to sort this lab exercise out but i am getting m not defined error
image

Hello @Priyanka_Saraf! I hope you are doing well.

We appreciate your post but you posted it in the wrong category. Currently, it is in the General category. Kindly change it to the relevant course (I guess MLS Course 1) and our mentors will be happy to assist you.

Please note that posting in the wrong category may decrease the chances of your post being noticed by our mentors and you may not receive a timely response. Therefore, it’s important to ensure that your post is in the correct

You can change the category by clicking the pencil icon on the right side of the title, as shown in the below image.

Regarding your error, in most cases, m is given and you just need to do the gradient calculation. But for that, we don’t need h. What is h here?

Best,
Saif.

Well, where is m defined? If it is in a previous code cell, note that you need to actually run that code cell first before you run this one. Try “Cell → Run All Above” and then try your cell again.

If that’s not it, then you need to check carefully: where is the code that defines m? Did you maybe delete some code accidentally? Or is it some code you were supposed to fill in that would have defined m?

This is how debugging works, right? You start from the error message: what does it mean? That’s about as clear an error message as you’ll ever see. Then the question is “ok, how could that happen?”