Stopping and restarting latin hypercube sampling
1 view (last 30 days)
Show older comments
Hi!
I'm trying to run an analysis, in which my variables are sampled with the latin hypercube function lhdesign.
I'd like to stop my simulation when a stopping criteria is satisfied, therefore I'd like also to sample only the necessary points instead of preparing all the combinations before.
From what I know, random number generation ins't actually random, but it follows a kind of pattern (I'm not an expert).
My question is: if I stop the sampling and then I restart it, does the sampling restart from the last point, or also the generation algorithm restarts?
To be clearer, suppose I need to sample N points (N is not determined, since it depends on when the stopping criteria is satisfied), but I want these points to be sampled in groups of 100. So I sample the first 100 points, the I the computation I need to do, check the criterion, sample the next 100 points and so on.
After the first 100 sample, is the first sample of the second group a kind of 101th sample, or the sampling pattern restarts such that the first sample of the second group is the same of the first sample of the first group?
I know it's not explained ina very clear way, but thank you anyway.
0 Comments
Answers (1)
Anshika Chaurasia
on 11 Feb 2021
Hi Alessandro,
On running the following code:
rng default % For reproducibility
X = lhsdesign(10,4)
You will get the same samples eveytime you run above code because of the rng. Moreover, each column of X contains one random number in each interval [0,0.1], [0.1,0.2], [0.2,0.3], [0.3,0.4], [0.4,0.5], [0.5,0.6], [0.6,0.7], [0.7,0.8], [0.8,0.9], and [0.9,1].
On running the following code:
X = lhsdesign(10,4)
You will get different samples eveytime you run above code.
Hope it helps!
1 Comment
carlos lopez
on 5 Aug 2021
I guess that Alessandro is describing a slightly different situation. Let me illustrate my point:
rng(0);A=lhsdesign(4,3);rng(0);B=lhsdesign(5,3);[[A;zeros(1,3)] B]
First four columns has the answer when we request just three points. The last row has been filled with zeros. From 5th to 8th column we have the output when requesting four points. Alessandro (and me) are interested in arrange thing such that the first three rows (i.e. points) are repeated, irrespective if we request three points, four points or 100.
Is it possible?
Regards
Carlos
See Also
Categories
Find more on Industrial Statistics in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!