What does scramble do in haltonset?

5 views (last 30 days)
Maaz Ahmad
Maaz Ahmad on 24 Jul 2022
Answered: Sudarsanan A K on 27 Oct 2023
I am trying to sample different set of points of the same size by haltonset using scramble, hoping that scrambling the sequence of points would randomly change the generated points. Hence, I provide different seed values to rng before using scramble function with RR2 on the haltonset. I do not see any difference in the set of generated points due to scrambling the halton sequence. What is the utility of scramble in haltonset in that case? The only possible way to generate different sets of points would be to use skip and leap functionalities I guess.
K = 100;
HS = haltonset(2);
rng(1);
HS1 = scramble(HS,'RR2');
points1 = net(HS1,K);
rng(2);
HS2 = scramble(HS,'RR2');
points2 = net(HS2,K);
rng(100);
HS3 = scramble(HS,'RR2');
points3 = net(HS3,K);
% All sets of points (points1, points2, points3) are same
  2 Comments
dpb
dpb on 24 Jul 2022
That's a functionality of which I was unaware -- but, agreed, don't see that scramble is doing anything useful with the Halton set; the example with the Sobol set using the alternate scheme does return a different result.
Looks like not what would be intended to me, but I don't know enough to be fully confident to say it definitely is a bug, but looks suspiciously like one...
Maaz Ahmad
Maaz Ahmad on 25 Jul 2022
Looks like a bug to me as well. RR2 seems to be unexecuted to scramble the haltonset sequence unlike MatousekAffineOwen with sobolset.

Sign in to comment.

Answers (1)

Sudarsanan A K
Sudarsanan A K on 27 Oct 2023
Hello Maaz,
I understand that you are using the "scramble" function in conjunction with the "haltonset" to generate different sets of points with the same size. I also note that you are using 'RR2' option in the "scramble" function to introduce randomness to the generated points.
However based on the documentation of “scramble” function (link: https://mathworks.com/help/stats/haltonset.scramble.html) for Halton Sets, the RR2 algorithm is described in this research paper: https://dl.acm.org/doi/pdf/10.1145/264029.264064.
From this, my understanding is that the RR2 permutation algorithm is deterministic and not stochastic, meaning it does not depend on the current “rng” state. This explains the behaviour that you observed, and it suggests that the current implementation is not a bug.
To address your requirement for randomized quasi-random point sets I suggest considering the following options:
  • If you only need to permute the points within the "haltonset," you could utilize a permutation function such as "randperm" to generate an index permutation. This permutation can then be used to rearrange the rows of the matrix and form a permuted version of the points. Here is an example code"
A = magic(5); % example matrix
permuted_indices = randperm(size(A, 1)); % generate random permutation of row indices
A_permuted = A(permuted_indices, :); % index matrix with permuted indices
A, A_permuted
A = 5×5
17 24 1 8 15 23 5 7 14 16 4 6 13 20 22 10 12 19 21 3 11 18 25 2 9
A_permuted = 5×5
23 5 7 14 16 4 6 13 20 22 10 12 19 21 3 17 24 1 8 15 11 18 25 2 9
  • As you mentioned in the comment, consider using the "sobolset" and the "MatousekAffineOwen" scrambling algorithm instead of the "haltonset" if you desire rng-randomized quasi-random point sets.
I hope this clarifies your query.

Products


Release

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!