hybparsimony.lhs.base package

Submodules

hybparsimony.lhs.base.geneticLHS module

hybparsimony.lhs.base.geneticLHS.geneticLHS(n, k, pop=100, gen=4, pMut=0.1, criterium='S', seed=None)[source]

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

nint

The number of rows or samples.

kint

The number of columns or parameters/variables.

popint, optional

The number of designs in the initial population. Default 100.

genint, optional

The number of generations over which the algorithm is applied. Default 4.

pMutfloat, optional

The probability with which a mutation occurs in a column of the progeny. Default 0.1.

criteriumstr, {‘S’, ‘Maximin’}, optional

The optimality criterium of the algorithm. Default is ‘S’. Maximin is also supported.

seedint, optional

Random seed. Default None.

Returns

numpy.array

A numpy.array of float with shape (n, k).

hybparsimony.lhs.base.improvedLHS module

hybparsimony.lhs.base.improvedLHS.improvedLHS(n, k, dup=1, seed=None)[source]

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

nint

The number of rows or samples.

kint

The number of columns or parameters/variables.

dupint, 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.

seedint, optional

Random seed. Default None.

Returns

numpy.array

A numpy.array of float with shape (n, k).

hybparsimony.lhs.base.maximinLHS module

hybparsimony.lhs.base.maximinLHS.maximinLHS(n, k, dup=1, seed=None)[source]

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

nint

The number of rows or samples.

kint

The number of columns or parameters/variables.

dupint, 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.

seedint, optional

Random seed. Default None.

Returns

numpy.array

An n by n Latin Hypercube Sample matrix with values uniformly distributed on [0,1].

hybparsimony.lhs.base.optimumLHS module

hybparsimony.lhs.base.optimumLHS.optimumLHS(n, k, maxsweeps=2, eps=0.1, seed=None)[source]

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

nint

The number of partitions (simulations or design points or rows).

kint

The number of replications (variables or columns).

maxsweepsint, optional

The maximum number of times the CP algorithm is applied to all the columns. Default 2

epsfloat, 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

seedint, optional

Random seed. Default None.

Returns

numpy.array

An n by n Latin Hypercube Sample matrix with values uniformly distributed on [0,1].

hybparsimony.lhs.base.randomLHS module

hybparsimony.lhs.base.randomLHS.randomLHS(n, k, bPreserveDraw=False, seed=None)[source]

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

nint

The number of rows or samples.

kint

The number of columns or parameters/variables.

bPreserveDrawbool, optional

Should the draw be constructed so that it is the same for variable numbers of columns?. Default False

seedint, optional

Random seed. Default None.

Returns

numpy.array

A numpy.array of float with shape (n, k).

hybparsimony.lhs.base.randomLHS.randomLHS_int(n, k, seed=None)[source]

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

nint

The number of rows or samples.

kint

The number of columns or parameters/variables.

seedint, optional

Random seed. Default None.

Returns

numpy.array

A numpy.array of int with shape (n, k).

Module contents