'Recommendations for Low Discrepancy (e.g. Sobol) quasi-random sequences in Python/SciPy?
I would like to use a quasi-random sequence, specifically Sobol, within a SciPy based simulation. Any recommendations on existing, efficient packages?
Solution 1:[1]
Is this project any use? If not, the relevant Wikipedia article mentions C and Fortran routines in NAG and Numerical Recipes, which probably shouldn't be difficult to wrap or reimplement in Python. There are also C routines in GSL.
Solution 2:[2]
PyTorch provides some options now. One of them is scrambled sobol number generator that can generate quasi random number of higher dimensions of upto ~1k
https://pytorch.org/docs/stable/generated/torch.quasirandom.SobolEngine.html
Another option is to use Scipy that has this option now https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.qmc.Sobol.html
Solution 3:[3]
For Sobol Sequences try sobol_seq.
Generally speaking the best package I've found for dealing with quasirandom sequences is diversipy.
There are also packages that focus on specific implementations, for example sudoku_lhs deals with Latin Hypercubes and the Sudoku-type Constraint variant.
pyDOE implements at least Latin Hypercube (maybe more).
The most interesting package I found is py-design, which creates a wrapper for Fortran 90 codes on 15 or so methods. Unfortunately it does not seem to work (some assets seem to be missing).
Solution 4:[4]
Chaospy is also a valid option. It allows to select several approaches towards low-discrepancy sampling (including 'Sobol, latin hypercube, etc) - for more details see the documentation.
Solution 5:[5]
In the context of sensivity analysis SALib library seems interesting It has a Sobol sample generator and uses SciPy. Link here : https://salib.readthedocs.io/en/latest/
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | James |
| Solution 2 | |
| Solution 3 | mikkokotila |
| Solution 4 | |
| Solution 5 | Sam |
