Finding the single nearest neighbor using a Prefix tree in O(1)?

旧时模样 提交于 2019-12-06 08:15:16

I think the argument in the paper is that if it was O(f(x)) then x would have to be the number of items stored in the tree, not the number of dimensions. As you point out, for a prefix tree the time goes up as O(M) where M is the length of the bit vector, but if you reckon M is fixed and what you are interested in is the behaviour as the number of items in the tree increases you have O(1).

By the way, the paper "Fast approximate nearest neighbors with automatic algorithm configuration" by Muja and Lowe also considers tree-based competitors to LSH. The idea here appears to be to randomise the tree construction, create multiple trees, and do a quick but sketchy search of each tree, picking the best answer found in any tree.

This is O(1) only in a very loosely defined sense. In fact I would go so far as to challenge their usage in this case.

From their paper, To determine the nearest neighbor to a user, u.

  1. "We first calculate it's signature, u" : can be O(1) depending on the "signature"
  2. "Then for every prefix tree in P" : Uh oh, not sounding very O(1), O(P) would be more correct.
  3. iterative part from 2. "... we find the nearest signature in the prefix tree, by iterating through the tree one level at a time..." : best case O(d) where d is the depth of the tree or length of the word. (this is generous as finding the nearest point in a prefix tree can be more than this)
  4. "After doing this... we end up with |P| signatures... of which the smallest hamming distance is picked" : so another P calculations times the length of the word. O(Pd).

More correctly the total runtime is O(1) + O(P)+ O(Pd) + O(Pd) = O(Pd)

I believe that @mcdowella is correct in his analysis of how they try to make this O(1), but from what I've read they haven't convinced me.

I assume they have a reference to P's node in a tree, and can navigate to the next or previous entry in O(1) amortized time. i.e. the trick is to have access to the underlying nodes.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!