What does scramble do in haltonset?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
dpb
il 24 Lug 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...
Risposte (1)
Sudarsanan A K
il 27 Ott 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
- 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.
0 Commenti
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!