Compute cosine similarity between each row in A and each row in B
(A, B)
| 328 | return False |
| 329 | |
| 330 | def cosine_sim_matrix(A, B): |
| 331 | """Compute cosine similarity between each row in A and each row in B""" |
| 332 | A = A / np.linalg.norm(A, axis=1, keepdims=True) |
| 333 | B = B / np.linalg.norm(B, axis=1, keepdims=True) |
| 334 | A[np.isnan(A)] = 0 |
| 335 | B[np.isnan(B)] = 0 |
| 336 | return np.dot(A, B.T) |
| 337 | |
| 338 | def generate_brute_force_results(dataset_name, quick_test=False): |
| 339 | """Generate brute force results by processing dataset in chunks""" |
nothing calls this directly
no outgoing calls
no test coverage detected