Efficient comparison of 100.000 vectors

后端 未结 10 2189
礼貌的吻别
礼貌的吻别 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条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-31 21:43

    Newer answer

    How much preprocessing can you do? Can you build "neighborhoods" ahead of time and note which neighborhood each vector is in inside the database? That might let you eliminate many vectors from consideration.


    Old answer below, which assumed 60 was magnitude of all the vectors, not the dimension.

    Since the vectors are all the same length (60), I think you're doing too much math. Can't you just do the dot product of the chosen one against each candidate?

    In 3D: alt text

    Three multiplies. In 2D it's just two multiplies.

    Or does that violate your idea of similarity? To me, the most similar vectors are the ones with the least angular distance between them.

提交回复
热议问题