C1_W2_Linear Regression_compute the cost $J(w,b)$

I am unable to solve the implementation problem and keep getting the following error code:

NameError Traceback (most recent call last)
3 initial_b = 1
----> 5 cost = compute_cost(x_train, y_train, initial_w, initial_b)
6 print(type(cost))
7 print(f’Cost at initial w: {cost:.3f}')

NameError: name ‘x_train’ is not defined

Have you run all the previous cells ?

1 Like

Yes. The code seems to be fine too. Can’t seem to find the root cause of the error.

Could you share a screenshot of the error once

I found the solution and got through the gradient descent lab. Thank you!