Linear Regression Week2 Practice Lab

I think I am kind of doing similar mistake that you might have done.

I am getting error from the code cell,

Compute cost with some initial values for paramaters w, b

initial_w = 2
initial_b = 1

cost = compute_cost(x_train, y_train, initial_w, initial_b)
print(type(cost))
print(f’Cost at initial w: {cost:.3f}')

Public tests

from public_tests import *
compute_cost_test(compute_cost)

Which I did not edit at all!
Thanks for your help in advance :slight_smile:

This means in your compute_cost() function, you’re using the ‘cost’ variable before it has been defined.

Check the Hint code in the notebook.