I am seeing this equation for computing the cosine similarity of a vector and a matrix in a post.
The numerator of cos similarity can be expressed as a matrix multiply and then the denominator should just work :).
a_norm = np.linalg.norm(a, axis=1)
b_norm = np.linalg.norm(b)
(a @ b) / (a_norm * b_norm)
where a is a 2D array and b is 1D array (i.e. vector)
What does the (a @ b) mean? How to compute this in numpy?