Course1/WEEK 1 optional lab 4 GRADIENT DESCENT

Error: ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
in <cell line: 0>()
46
47 return dj_dw, dj_db
—> 48 plt_gradients(x_train,y_train, compute_cost, compute_gradient)
49 plt.show()

/content/lab_utils_uni.py in plt_gradients(x_train, y_train, compute_cost, compute_gradient_w_only)
16 for w in w_list:
17 y_pred = w * x_train
—> 18 cost = compute_cost(x_train, y_train)
19 cost_list.append(cost)
20

TypeError: compute_cost() missing 2 required positional arguments: ‘w’ and ‘b’

Hello, @TrinhNguyen2025,

It seems that you didn’t have the right version of plt_gradients and it looks like you were not running this code on Cousera. Please run the lab on Cousera using the code provided to you by Cousera.

Cheers,
Raymond

1 Like