Efficient comparison of 100.000 vectors

后端 未结 10 2031
礼貌的吻别
礼貌的吻别 2021-01-31 21:20

I save 100.000 Vectors of in a database. Each vector has a dimension 60. (int vector[60])

Then I take one and want present vectors to the user in order of decreasing sim

10条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-31 21:56

    So the following information can be cached:

    • Norm of the chosen vector
    • The dot product A.B, reusing it for both the numerator and the denominator in a given T(A,B) calculation.

    If you only need the N closest vectors or if you are doing this same sorting process multiple times, there may be further tricks available. (Observations like T(A,B)=T(B,A), caching the vector norms for all the vectors, and perhaps some sort of thresholding/spatial sort).

提交回复
热议问题