# code removed - mentor edit
# 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)
Output:
UnboundLocalError Traceback (most recent call last) d:\Courses\Machine Learning\Files(practice)\Files\home\jovyan\work\C1_W2_Linear_Regression.ipynb Cell 23 in <cell line: 5>() 2 initial_w = 2 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}') d:\Courses\Machine Learning\Files(practice)\Files\home\jovyan\work\C1_W2_Linear_Regression.ipynb Cell 23 in compute_cost**(x, y, w, b)** 26 f_wb=wx[i]+b 27 cost =(f_wb-y[i])**2 —> 28 cost_sum=cost_sum+cost 29 J_wb =(1/2m)*cost_sum 31 ### END CODE HERE ### UnboundLocalError : local variable ‘cost_sum’ referenced before assignment