nengolib.stats.Sobol

class nengolib.stats.Sobol[source]

Sobol sequence for quasi Monte Carlo sampling the [0, 1]–cube.

This is similar to np.random.uniform(0, 1, size=(num, d)), but with the additional property that each d–dimensional point is uniformly scattered.

This is a wrapper around a library by the authors Corrado Chisari and John Burkardt (see License). [1]

Notes

This is deterministic for dimensions up to 40, although it should in theory work up to 1111. For higher dimensions, this approach will fall back to rng.uniform(size=(n, d)).

References

[1]http://people.sc.fsu.edu/~jburkardt/py_src/sobol/sobol.html

Examples

>>> from nengolib.stats import Sobol
>>> sobol = Sobol().sample(10000, 2)
>>> import matplotlib.pyplot as plt
>>> plt.figure(figsize=(6, 6))
>>> plt.scatter(*sobol.T, c=np.arange(len(sobol)), cmap='Blues', s=7)
>>> plt.show()

(Source code)

_images/nengolib-stats-Sobol-1.png

Methods

sample(n[, d, rng]) Samples n points in d dimensions.