def cosine_distance(u, v):
 return (1 - (numpy.dot(u, v) / (sqrt(numpy.dot(u, u)) * sqrt(numpy.dot(v, v)))))

def cosine_distance ( u , v ) : return ( 1 - ( numpy . dot ( u , v ) / ( sqrt ( numpy . dot ( u , u ) ) * sqrt ( numpy . dot ( v , v ) ) ) ) )
returns 1 minus the cosine of the angle between vectors v and u .