pixelogik / NearPy

Python framework for fast (approximated) nearest neighbour search in large, high-dimensional data sets using different locality-sensitive hashes.
MIT License
763 stars 151 forks source link

what's the effect of permutations hash object? #65

Open vega110 opened 7 years ago

vega110 commented 7 years ago

At first, I only put RandomBinaryProjections hash in my codes, and it did not yield good results ,but I can repeat run my query function, not include index vector function, eg engine.store_vector(vector, data);

when I add HashPermutations object in my code. such as permutations = HashPermutations('p') rbp_conf = {'num_permutation':50, 'beam_size':10, 'num_neighbour':10} permutations.add_child_hash(rbp_perm, rbp_conf) ...... redis_storage.store_hash_configuration(rbp_perm) permutations.build_permuted_index() Finally the result is better than first. but if I want to run query function ,I cann't remove 'engine.store_vector(vector, data); '. so how can I only execute query function code, not include store vector codes. just like,

redis_object = redis.Redis(host='localhost', port=0, db=0, unix_socket_path='/tmp/redis.sock') redis_storage = RedisStorage(redis_object) config = redis_storage.load_hash_configuration('v') if config is None: rbp_perm = RandomBinaryProjections('v', 30) else: rbp_perm = RandomBinaryProjections(None, None) rbp_perm.apply_config(config)

 engine.candidate_count(query)
 engine.neighbours(query)

I hope you will soon answer my question. ths very much