Python Optimized Most Cosine Similar Vector
问题 I have about 30,000 vectors and each vector has about 300 elements. For another vector (with same number elements), how can I efficiently find the most (cosine) similar vector? This following is one implementation using a python loop: from time import time import numpy as np vectors = np.load("np_array_of_about_30000_vectors.npy") target = np.load("single_vector.npy") print vectors.shape, vectors.dtype # (35196, 312) float3 print target.shape, target.dtype # (312,) float32 start_time = time()