Week 2 Practice lab linear regression

I am having this type error, unsure how to remedy the situation. Please advise, cheers.

Untitled presentation.pdf (358.0 KB)

Please post your information as a screen capture image.
Mentors are very unlikely to download a PDF file from an unknown source.

1 Like

I am having trouble figuring out how to post the pictures without making them a downloaded PDF, please advise.

If you use a screen capture tool, you can simply copy and paste into your reply.

You don’t need to convert it to a pdf. You can upload a jpg or png file as shown in below image. Just click on that arrow and select.

Every time you open a notebook, you have to run all of the cells starting from the first one.
Example:

  • The first cell imports all of the necessary packages.
  • The second cell defines the x_train and y_train variables.

Ok after fixing this last error i have met YET another error. After googling and trying to resolve it appears as though I can not remedy this error. Please advise.

The last line in the compute_cost() function should be return total_cost.
I don’t see that line in your image.
Did you perhaps delete it by accident?

I am facing this issue I have checked the function of cost compute its correct still there is a problem when I am calling this function

image

{moderator edit: code removed|

Please do not post your code on the forum. That isn’t allowed by the Code of Conduct. I have edited your message to remove the code.

The last two lines of your code (where you divide by m) should not be inside the for-loop.

Python uses indentation to define blocks of code. Those two lines are indented such that they are inside the for-loop.

Thanks
will keep it in mind