I've looked it over several times, but still can't understand what seems to be wrong here. This is the cosine similarity function written below, and also where its called with 2 vectors.
def cosine_sim(v1, v2):
return (lambda x,y,z: x / sqrt(y * z))(reduce(lambda x,y: (x[0] + y[0] * y[1], x[1] + y[0]**2, x[2] + y[1]**2), izip(v1,v2),(0,0,0)))
cosine_sim(first_vector,second_vector)
Error:
TypeError Traceback (most recent call last) in () ----> 1 cosine_sim(firstvector,secondvector)
in cosine_sim(v1, v2) 1 def cosine_sim(v1, v2): ----> 2 return (lambda x,y,z: x / sqrt(y * z))(reduce(lambda x,y: (x[0] + y[0] * y[1], x[1] + y[0]**2, x[2] + y[1]**2), izip(v1,v2),(0,0,0)))
TypeError: () missing 2 required positional arguments: 'y' and 'z'