3

Is there a decent Python library for various sampling techniques?

I know of the standard random module which does contain useful core functions like shuffle and choice. I'm also aware of various libraries that provide sampling from known distributions (like scipy.stats and sympy.stats).

I'm curious if there exists a library for some of the more sophisticated techniques like reservoir sampling. Note that reservoir sampling is just an example; I'm looking for a library of many such functions. An example in the Clojure ecosystem is https://github.com/bigmlcom/sampling.

MRocklin
  • 55,641
  • 23
  • 163
  • 235
  • Reservoir sampling algo here: http://stackoverflow.com/questions/2612648/reservoir-sampling – Gerrat Nov 21 '13 at 20:30

1 Answers1

1

A lot of the sampling algorithms have been implemented in separate packages.

For instance, there's a reservoir-sampling program (which only provides a client interface). The code is simple enough that you could verify it and grab what you need. Alternatively, you could check out the answer that @Gerrat mentioned from StackOverflow.

Numpy's random can sample from various distributions as well.

Sounds like a good time to unify and make a sampling package or add on to scipy.

Community
  • 1
  • 1
Kyle Kelley
  • 13,804
  • 8
  • 49
  • 78