ENH: Random processes #4714

Closed
toddrjen opened this Issue May 15, 2014 · 2 comments

3 participants

@toddrjen

numpy provides samples from random distributions. However, another common way to get numbers from a random distribution is using a random (or stochastic) process. To quote Wolfram, "A random process models the progression of a system over time, where the evolution is random rather than deterministic". A classic example is a random walk, where the individual steps are random values with a particular distribution.

https://reference.wolfram.com/mathematica/guide/RandomProcesses.html
http://en.wikipedia.org/wiki/Stochastic_process

A common example is the poisson process, which is used to approximate things as diverse as radioactive decay events, the arrival times of people to a store, photon detection events, web server request times, and the times of neural events.

http://en.wikipedia.org/wiki/Poisson_process

I think it would be nice if numpy also provided some commonly-used random process generators in addition to the random distribution generators. Probably a good set of starting processes would be the Poisson process, Wiener process, and Ornstein–Uhlenbeck process.

http://en.wikipedia.org/wiki/Wiener_process
http://en.wikipedia.org/wiki/Ornstein%E2%80%93Uhlenbeck_process

@rkern
NumPy member

I think these would be outside of numpy's scope. scipy or a separate project altogether would be the best place. One problem you will run into is the diversity of representations that are necessary for different applications. There isn't just one way to implement a Wiener process. Sometimes you are interested in simulating a Wiener process over uniformly discretized time from a known starting point; that's easy to do: np.random.normal(m, s, size=...).cumsum(). Other times, you need to simulate a Wiener process in between two known boundaries with arbitrary time points in between; that's a little harder to do, but mostly just different (Brownian bridge).

Typically, the most interesting thing to do with these models is to fit them to real data, not simulating them, so you are looking at a framework akin to the scipy.stats distribution objects. Many of these are implemented in more domain-specific packages that require them, especially quantitative finance packages. A domain-independent collection of these that allows easy comparison of models would be a useful thing, but numpy is not the right place for them.

@seberg
NumPy member

I agree, it sounds like too much for numpy in any case. If this was more specific one could maybe talk about it (probably first on the mailinglist though). So closing.

@seberg seberg closed this Jul 29, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment