Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when requesting a very large number of responses #3

Open
ravimody opened this issue Dec 13, 2016 · 0 comments
Open

Error when requesting a very large number of responses #3

ravimody opened this issue Dec 13, 2016 · 0 comments

Comments

@ravimody
Copy link
Contributor

get_similar('user', user, 'product', 100000000)
returns

all2vec/__init__.py in get_similar(self, entity_type, entity_id, match_type, num_similar, oversample, normalize)
    168         match_vector = self.get_vector(entity_type, entity_id)
    169         return self.get_similar_vector(
--> 170             match_vector, match_type, num_similar, oversample, normalize)
    171
    172     def get_scores_vector(self, vector, match_type, match_id_array, normalize):

all2vec/__init__.py in get_similar_vector(self, match_vector, match_type, num_similar, oversample, normalize)
    156
    157         similar_items = self._annoy_objects[match_type].get_nns_by_vector(
--> 158             match_vector, num_similar, search_k)
    159         # compute inner products, and sort
    160         scores = self.get_scores_vector(

all2vec/__init__.py in get_nns_by_vector(self, vec, n, search_k)
     67         """Get nearest neighbors from an input vector."""
     68         nns = self._ann_obj.get_nns_by_vector(vec, n, search_k)
---> 69         return [self._ann_map_inv[x] for x in nns]
     70
     71     def get_item_vector(self, entity_id):

TypeError: 'NoneType' object is not iterable

Digging deeper, it looks like all2vec is not properly capturing this ANNOY error

> u.get_nns_by_vector([1] * num_dimensions, 100000000, search_k = 100000000 * 100)
---------------------------------------------------------------------------
OverflowError                             Traceback (most recent call last)
OverflowError: signed integer is greater than maximum

This error will come up whenever n or search_k is larger than the maximum integer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant