MCPcopy Create free account
hub / github.com/cosdata/cosdata / cosine_sim_matrix

Function cosine_sim_matrix

tests/test-dataset.py:312–316  ·  view source on GitHub ↗

Compute cosine similarity between each row in A and each row in B

(A, B)

Source from the content-addressed store, hash-verified

310
311
312def cosine_sim_matrix(A, B):
313 """Compute cosine similarity between each row in A and each row in B"""
314 A = normalize(A, norm='l2', axis=1)
315 B = normalize(B, norm='l2', axis=1)
316 return np.dot(A, B.T)
317
318
319def generate_brute_force_results(dataset_name, quick_test=False):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected