pixelogik / NearPy

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

Consistant (pseudo-)randomization in RandomBinaryProjections and RandomDiscretizedProjections #11

Closed owo closed 9 years ago

owo commented 9 years ago

Motive: Sometimes it is desired to have stable behaviour when using random projections. The current API does not allow to set a seed for the RandomBinaryProjections and* RandomDiscretizedProjections*.

Solution: I added an extra parameter to the constructor of these objects called 'rand_seed' that defaults to a value that replicates the current behaviour of these classes. This parameter can be set to a seed value (see here for more info) that allows for consistent behaviour. This addition is backwards compatible with the current API.

I will be more than happy to make any extra modifications if needed.

pixelogik commented 9 years ago

Good idea, I also use deterministic "random" sequences in other projects sometimes, never had the idea to use it here as well. Will merge now.

pixelogik commented 9 years ago

If you have any more ideas to improve the codebase please feel free to discuss it in tickets, would be more then happy to do so.

owo commented 9 years ago

Thanks :) Will do. I'll even implement some things myself if time permits. Cheers.