I read about positional arguments and keyword arguments, but I still don't understand why I get SyntexError: non-keyword arg after keyworkd arg from running the following code. I didn't specify any keyword arguments in my objective function, right?
def obj_func(center, P, ACCUM, sentiment):
d = 0
for row in range(ACCUM[sentiment-1],ACCUM[sentiment]):
v = P[row,:]
d += v.dot(center) / (norm(v) * norm(center))
return(-d)
iter_init = np.array([random() for ele in range(k)])
CENTERS = dict()
for sentiment in range(3):
CENTERS[sentiment] = minimize(obj_func, x0=iter_init, args(P,ACCUM,sentiment),)
Also, I'm not so sure the last comma in minimize()
. The guy in the tutorial wrote like this. Is it correct?