Week 2 Linear Regression Lab

Hello! l’m wondering if anyone can help me understand why l’m getting these errors in the lab. l’ve tried changing a couple different things, still getting the same ones even though l feel my answers are correct. More specifically on compute cost l’m struggling to understand what that error really means. l couldn’t post more than one photo but l’m also getting a “compute_gradient not defined” error on that section that follows. Thanks for any and all help!!! :grinning:

I’d guess there’s a problem with how your "compute_cost() function is using the variable named “cost”.

Note that you have to be really careful to avoid using global variables.

Also, anything that you modify inside a loop, you have to give it a default value before the loop starts.

If this assignment has “Hint” code, give those a read-through.

Thanks! l’ve reviewed the hints and referenced the prior lab on cost functions and l still can’t make sense of it. Based on the hints l have implemented it correctly now, but now l get an incorrect float returned and “AssertionError: Case 2: Cost must be 2 but got 5.0”

l’ve also referenced the previous lab on cost function and l feel like l’m very close there’s just something not clicking

That sort of error is often due to incorrect indentation in a for-loop.

1 Like

I’m getting the same error, were you able to resolve it??

I’m getting the same error, were you able to resolve it??