Я хочу вызвать эту функцию для вычисления скорости обучения, но я столкнулся с TypeError: объект numpy .ndarray не вызывается. почему?
def train_classifier(theta, iteration, etha , k):
grad = np.zeros(iteration)
for it in range(0, iteration):
cost = 0
for i in range(0,m):
rand_int = np.random.randint(0,m)
x_i = x[rand_int,:].reshape(1,x.shape[1])
y_i = y[rand_int].reshape(1,1)
prediction = np.dot(x_i,theta)
etha = etha / np.sqrt(iteration)
theta_1 = theta.transpose()
theta = theta_1 - etha * (1 / k) * grad(theta, x_i, y_i)
return theta
<ipython-input-11-e896ad98b1b4> in train_classifier(theta, iteration, etha, k)
48 etha = etha / np.sqrt(iteration)
49 theta_1 = theta.transpose()
---> 50 theta = theta_1 - etha * (1 / k) * grad(theta, x_i, y_i)
51 return theta
52 def grad(theta, x, y):
TypeError: 'numpy.ndarray' object is not callable