cod3licious/gensim — pull request #1 by sebastien-j (2014-03-28 18:22:44+00:00)
Title: Cython version

I added a cython version for negative sampling.

I am not sure about the best way to generate random numbers in order to sample from the vocabulary. I would have preferred using only numpy's random.randint, but I could not get it to work as nicely as I had hoped (especially for multiple threads). Right now, at the beginning of each sentence, a random number between 0 (inclusive) and 2**48 (exclusive) is generated with numpy. Then, similarly to what Mikolov's C code does, I use a linear congruential generator (see Java RNG, UNIX rand48) to select the words.