aspcol.distance.cos_similary
- aspcol.distance.cos_similary(vec1, vec2)
- Computes <vec1, vec2> / (||vec1|| ||vec2||) which is cosine of the angle between the two vectors.
1 is paralell vectors, 0 is orthogonal, and -1 is opposite directions
- Parameters:
vec1 (np.ndarray of any shape) – First vector. If the arrays have more than 1 axis, it will be flattened.
vec2 (np.ndarray of same shape as vec1) – Second vector. If the arrays have more than 1 axis, it will be flattened.
- Returns:
cos_sim – The cosine similarity between the two vectors
- Return type:
float