Borrar filtros
Borrar filtros

What does scramble do in haltonset?

4 visualizaciones (últimos 30 días)
Maaz Ahmad
Maaz Ahmad el 24 de Jul. de 2022
Respondida: Sudarsanan A K el 27 de Oct. de 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);
HS1 = scramble(HS,'RR2');
points1 = net(HS1,K);
HS2 = scramble(HS,'RR2');
points2 = net(HS2,K);
HS3 = scramble(HS,'RR2');
points3 = net(HS3,K);
% All sets of points (points1, points2, points3) are same
  2 comentarios
dpb el 24 de Jul. de 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 el 25 de Jul. de 2022
Looks like a bug to me as well. RR2 seems to be unexecuted to scramble the haltonset sequence unlike MatousekAffineOwen with sobolset.

Iniciar sesión para comentar.

Respuestas (1)

Sudarsanan A K
Sudarsanan A K el 27 de Oct. de 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: for Halton Sets, the RR2 algorithm is described in this research paper:
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.





Community Treasure Hunt

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

Start Hunting!

Translated by