haserclan.blogg.se

Resampling from latin hypercube sampling
Resampling from latin hypercube sampling









> lhsmdu.sample(2, 20) # Latin Hypercube Sampling with multi-dimensional uniformityĪlternatively, you can also set the seed by using sample with a new seed:: > lhsmdu.sample(2, 20, randomSeed=randSeed) # Latin Hypercube Sampling with multi-dimensional uniformity > tRandomSeed(randSeed) # Latin Hypercube Sampling with multi-dimensional uniformity In order to change this behavior, you can set a new random seed using the following code:: > randSeed = 11 # random number of choice This is because the random seed is a global constant set to a default value by design, so that simulations can be replicated. You will notice that the strata generated are the same each time you run the program again. > plt.scatter(r, r, c="y", label="sample 4") > plt.scatter(q, q, c="b", label="sample 3") > plt.scatter(p, p, c="r", label="sample 2") > r = lhsmdu.sample(2, 20) # Latin Hypercube Sampling with multi-dimensional uniformity > q = lhsmdu.sample(2, 20) # Latin Hypercube Sampling with multi-dimensional uniformity > plt.scatter(o, o, c="y", label="resample 4")Īlternatively, you can choose to get new strata each time, and see the sampling hence:: > p = lhsmdu.sample(2, 20) # Latin Hypercube Sampling with multi-dimensional uniformity > plt.scatter(n, n, c="b", label="resample 3") > plt.scatter(m, m, c="r", label="resample 2") > plt.scatter(k, k, c="g", label="sample 1") You can plot these together and see the sampling from the strata:: This will again generate the same number of samples as before, a nested list with 2 variables, with 20 samples each. For this, you can do:: > m = lhsmdu.resample() You can use the strata generated by the algorithm to sample again, if you so desire. > plt.scatter(l, l, color="r", label="MC") > plt.scatter(k, k, color="g", label="LHS-MDU") To plot and see the difference between Monte Carlo and LHS-MDU sampling for a 2 dimensional system:: > l = lhsmdu.createRandomStandardUniformMatrix(2, 20) # Monte Carlo sampling This will generate a nested list with 2 variables, with 20 samples each. > k = lhsmdu.sample(2, 20) # Latin Hypercube Sampling with multi-dimensional uniformity This is a package for generating latin hypercube samples with multi-dimensional uniformity.

#Resampling from latin hypercube sampling install#

$ python setup.py install -user # for this user only. You can install lhsmdu using pip:: $ pip install lhsmduĪlternatively, you can clone on github and then install the package locally:: $ git clone









Resampling from latin hypercube sampling