Closed mars0i closed 10 years ago
Consider using clojure.data.generators or bigml/sampling rather than Incanter or default Clojure functions.
Note that the sampling functions are no longer in receive-utterances
, but in speak.clj. Sampling functions are now defined in random.clj, and take a rand-idx function. Clojure's rand-int does the job, but other functions definable via random.clj allow using a different rand-idx based on a different RNG object for each person. At the moment the code just uses rand-int. Next step is to add a :rand-idx field to persons, and initialize it with rand-idx functions based on randomly-seeded RNGs. (Then the seed used to initialize that 0th RNG can be stored.)
At present,
receive-utterances
ispmap
ed by default, but it calls the Incantersample
, which indirectly uses Clojure'srand
. This probably means that the separate threads have to coordinate access to a single RNG. i.e. you wouldn't want to just copy it to each thread; then each thread would repeat the same sequence of numbers. Try the following a few times:The
pmap
version is an order of magnitude slower.Maybe the right thing to do is to create a distinct RNG with a different seed for each person??