hey
I faced a problem during running the a code in C1_W1_Lab03:
def compute_cost (x,y,w,b):
m = len(x_train)
cost_sum = [0]
for i in range (m):
f_wb = wx[i] +b
cost = (y[i] - f_wb)^2
cost_sum = cost_sum + cost
total_cost = (1/2m)*cost_total
return total_cost
x_train = np.array([1.0, 1.7, 2.0, 2.5, 3.0, 3.2])
y_train = np.array([250, 300, 480, 430, 630, 730,])
when I run this code, this error shows up about this part ( f_wb = wx[i] + b ):
f_wb = wx[i] +b
TypeError: ‘float’ object is not subscriptable.
I think the “float” object refers to x_train variables. what should I do?