GAparsimony.lhs.base package
GAparsimony.lhs.base.geneticLHS module
- GAparsimony.lhs.base.geneticLHS.geneticLHS(n, k, pop=100, gen=4, pMut=0.1, criterium='S', seed=None)
Latin Hypercube Sampling with a Genetic Algorithm
Draws a Latin Hypercube Sample from a set of uniform distributions for use in creating a LatinHypercube Design. This function attempts to optimize the sample with respect to the S optimalitycriterion through a genetic type algorithm.
- Parameters
n (int) – The number of rows or samples.
k (int) – The number of columns or parameters/variables.
pop (int, optional) – The number of designs in the initial population. Default 100.
gen (int, optional) – The number of generations over which the algorithm is applied. Default 4.
pMut (float, optional) – The probability with which a mutation occurs in a column of the progeny. Default 0.1.
criterium (str, {'S', 'Maximin'}, optional) – The optimality criterium of the algorithm. Default is ‘S’. Maximin is also supported.
seed (int, optional) – Random seed. Default None.
- Returns
A numpy.array of float with shape (n, k).
- Return type
numpy.array
GAparsimony.lhs.base.improvedLHS module
- GAparsimony.lhs.base.improvedLHS.improvedLHS(n, k, dup=1, seed=None)
Improved Latin Hypercube Sample
Draws a Latin Hypercube Sample from a set of uniform distributions for use in creating a Latin Hypercube Design. This function attempts to optimize the sample with respect to an optimum euclidean distance between design points.
- Parameters
n (int) – The number of rows or samples.
k (int) – The number of columns or parameters/variables.
dup (int, optional) – A factor that determines the number of candidate points used in the search. A multiple of the number of remaining points than can be added. Default 1.
seed (int, optional) – Random seed. Default None.
- Returns
A numpy.array of float with shape (n, k).
- Return type
numpy.array
GAparsimony.lhs.base.maximinLHS module
- GAparsimony.lhs.base.maximinLHS.maximinLHS(n, k, dup=1, seed=None)
Maximin Latin Hypercube Sample
Draws a Latin Hypercube Sample from a set of uniform distributions for use in creating a Latin Hypercube Design. This function attempts to optimize the sample by maximizing the minium distance between design points (maximin criteria).
- Parameters
n (int) – The number of rows or samples.
k (int) – The number of columns or parameters/variables.
dup (int, optional) – A factor that determines the number of candidate points used in the search. A multiple of the number of remaining points than can be added. Default 1.
seed (int, optional) – Random seed. Default None.
- Returns
An n by n Latin Hypercube Sample matrix with values uniformly distributed on [0,1].
- Return type
numpy.array
GAparsimony.lhs.base.optimumLHS module
- GAparsimony.lhs.base.optimumLHS.optimumLHS(n, k, maxsweeps=2, eps=0.1, seed=None)
Optimum Latin Hypercube Sample
Draws a Latin Hypercube Sample from a set of uniform distributions for use in creating a LatinHypercube Design. This function uses the Columnwise Pairwise (CP) algorithm to generate an optimal design with respect to the S optimality criterion.
- Parameters
n (int) – The number of partitions (simulations or design points or rows).
k (int) – The number of replications (variables or columns).
maxsweeps (int, optional) – The maximum number of times the CP algorithm is applied to all the columns. Default 2
eps (float, optional) – The optimal stopping criterion. Algorithm stops when the change in optimality measure is less than eps*100% of the previous value. Default 0.01
seed (int, optional) – Random seed. Default None.
- Returns
An n by n Latin Hypercube Sample matrix with values uniformly distributed on [0,1].
- Return type
numpy.array
GAparsimony.lhs.base.randomLHS module
- GAparsimony.lhs.base.randomLHS.randomLHS(n, k, bPreserveDraw=False, seed=None)
Construct a random Latin hypercube design
randomLHS(4,3) returns a 4x3 matrix with each column constructed as follows: A random per-mutation of (1,2,3,4) is generated, say (3,1,2,4) for each of K columns. Then a uniform randomnumber is picked from each indicated quartile. In this example a random number between 0.5 and 0.75 is chosen, then one between 0 `and `0.25, then one between 0.25 and 0.5, finally one between 0.75 and 1.
- Parameters
n (int) – The number of rows or samples.
k (int) – The number of columns or parameters/variables.
bPreserveDraw (bool, optional) – Should the draw be constructed so that it is the same for variable numbers of columns?. Default False
seed (int, optional) – Random seed. Default None.
- Returns
A numpy.array of float with shape (n, k).
- Return type
numpy.array
- GAparsimony.lhs.base.randomLHS.randomLHS_int(n, k, seed=None)
Construct a random Latin hypercube design
randomLHS(4,3) returns a 4x3 matrix with each column constructed as follows: A random per-mutation of (1,2,3,4) is generated, say (3,1,2,4) for each of K columns. Then a uniform randomnumber is picked from each indicated quartile. In this example a random number between 0.5 and 0.75 is chosen, then one between 0 `and `0.25, then one between 0.25 and 0.5, finally one between 0.75 and 1.
- Parameters
n (int) – The number of rows or samples.
k (int) – The number of columns or parameters/variables.
seed (int, optional) – Random seed. Default None.
- Returns
A numpy.array of int with shape (n, k).
- Return type
numpy.array