qd.numerics

This module contains additional numerical functions.

sampling

This module contains functions related to sampling and DOEs.

qd.numerics.sampling.uniform_lhs(nSamples, variables, **kwargs)

Do a uniform Latin Hypercube Sampling

Parameters
nSamplesint

number of samples to draw

variablesdict(str, tuple(lower, upper) )

variable dictionary, the key must be the name whereas the value must be a tuple. The first value of the tuple is the lower bound for the variable and the second one is the upper bound

**kwargs

arguments passed on to diversipy.hycusampling.maximin_reconstruction

Returns
column_nameslist(str)

list with the column names for the LHS

samplesnp.ndarray

numpy array with latin hypercube samples. Shape is nSamples x len(variables).

Examples

>>> from qd.numerics.sampling import uniform_lhs
>>> 
>>> variables = {'length':[0,10], 'angle':[-3,3]}
>>> labels, data = uniform_lhs(nSamples=100, variables=variables)
>>> labels
['angle', 'length']
>>> data.shape
(100, 2)
>>> data.min(axis=0)
array([-2.98394928,  0.00782609])
>>> data.max(axis=0)
array([ 2.8683843 ,  9.80865352])