What does scramble do in haltonset?
1 回表示 (過去 30 日間)
古いコメントを表示
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 件のコメント
dpb
2022 年 7 月 24 日
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...
回答 (1 件)
Sudarsanan A K
2023 年 10 月 27 日
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 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!