Hello all,
I am incredibly excited to start my ML journey, however, I am brand new to ML, coding, Python, basically all of it.
I have passed all the tests but I am having trouble with the week 2 practice lab as it appears to require some coding skills.
In this section:
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)
I get this error:
NameError Traceback (most recent call last)
in
3 initial_b = 1
4
----> 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}')
in compute_cost(x, y, w, b)
29 for i in range(m):
30 # Your code here to get the prediction f_wb for the ith example
—> 31 f_wb = h = a * b + c
32 # Your code here to get the cost associated with the ith example
33 cost = (f_wb - y[i]) ** 2
NameError: name ‘a’ is not defined
I am not sure how to proceed or where to start. Any help would be much appreciated as I am banging my head against a wall here.
TY