In the following summation:
I need to replace s(dot product) with the following:
My code, which is extremely slow:
summing = 0
update = np.zeros((5172,))
for index, xi in enumerate(x_v1):
yval = y[index]
kernel_sum = 0
for index_val, x_val in enumerate(x_v1):
kernel_sum += update[index_val] *(np.dot(x_val, xi.transpose()) + 1)**2
dot_product = kernel_sum
dot_product = np.clip(dot_product, -20, 20)
summing += yval * np.log(sigmoid(dot_product)) + (1-yval)* np.log(1-sigmoid(dot_product))
How can I make this faster?