Skip to content

Commit

Permalink
Added cached hash into for loop.
Browse files Browse the repository at this point in the history
  • Loading branch information
maheshakya committed Jul 20, 2014
1 parent cde73a4 commit 8470bad
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions sklearn/neighbors/lsh_forest.py
Expand Up @@ -258,8 +258,11 @@ def fit(self, X=None):
self.cache_N = int(self.max_label_length/2)
hashes = [x for x in itertools.product((0, 1),
repeat=self.cache_N)]
self.cache = {tuple(x): int("".join([digits[y] for y in x]),
2) for x in hashes}

self.cache = {}
for item in hashes:
self.cache[tuple(item)] = int("".join([digits[y] for y in item]),
2)

self.k = 2 ** self.cache_N

Expand Down

0 comments on commit 8470bad

Please sign in to comment.