I am getting errors with this code:
def gradient_descent(dEdm, dEdb, m, b, X, Y, learning_rate = 0.001, num_iterations = 1000, print_cost=False):
for iteration in range(num_iterations):
### START CODE HERE ### (~ 2 lines of code)
m_new = m-(learning_ratedEdm)
b_new = b-(learning_ratedEdb)
### END CODE HERE ###
m = m_new
b = b_new
if print_cost:
print (f"Cost after iteration {iteration}: {E(m, b, X, Y)}")
return m, b
The error is:
TypeError Traceback (most recent call last)
Cell In [28], line 1
----> 1 print(gradient_descent(dEdm, dEdb, 0, 0, X_norm, Y_norm))
2 print(gradient_descent(dEdm, dEdb, 1, 5, X_norm, Y_norm, learning_rate = 0.01, num_iterations = 10))
Cell In [27], line 4, in gradient_descent(dEdm, dEdb, m, b, X, Y, learning_rate, num_iterations, print_cost)
1 def gradient_descent(dEdm, dEdb, m, b, X, Y, learning_rate = 0.001, num_iterations = 1000, print_cost=False):
2 for iteration in range(num_iterations):
3 ### START CODE HERE ### (~ 2 lines of code)
----> 4 m_new = m-(learning_ratedEdm)
5 b_new = b-(learning_ratedEdb)
6 ### END CODE HERE ###
TypeError: unsupported operand type(s) for *: ‘float’ and ‘function’
Could you provide me some help or hint?