I am trying to construct Hammersley and Halton quasi random sequences. I have for example three variables x1, x2 and x3. They all have integer values. x1 has a range from 2-4, x2 from 2-4 and x3 from 1-7. Is there any python package which can create those sequences? I saw that there are some procject like sobol or SALib, but they do not implemented Halton and Hammersley.
Best regards
Most library methods offering low discrepancy methods for arbitrary dimensions, won’t include arguments that allow you to define arbitrary intervals for each of the separate dimensions/components. However, in virtually all of these cases, you can adapt the exisiting method to suit your requirements with the addition of a single line of code. Understanding this will dramatically increase number of librbaries you can choose to use!
For nearly all low discrepancy (quasirandom) sequences, each term is equidistributed in the half open range [0,1). Similarly, for d-dimensional sequences, each component of each term falls in [0,1).
This includes the Halton sequence ( which is a generalization if the van der Corput), Hammersley, Weyl/Kronecker, Sobol, and Niederreiter sequences.
Converting a value from [0,1) to [a,b) can be achieved, via the linear transformation x = a + (b-a) z. Thus if the n-th term of the canonical low discrepancy sequence is (z_1,z_2,z,z_3), then you desired sequence is (2+2*z1, 2+2*z2, 1+6*z3).
Starting with SciPy 1.7 you have a Sobol' and Halton low discrepancy sequences in SciPy. There is also a convenient function scale that can be used to scale the values to given bounds.
https://scipy.github.io/devdocs/reference/stats.qmc.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With