descmap.sampling

Functionality related to sampling

class descmap.sampling.DescPoint(name, i, val, field_len, sampling)
field_len

Alias for field number 3

i

Alias for field number 1

name

Alias for field number 0

sampling

Alias for field number 4

val

Alias for field number 2

descmap.sampling.get_lhs_map(descriptors_data)[source]

Returns Latin hypercube sampling mapping

Parameters:

descriptors_data (list of dict) – Each element of the list has information related to a descriptor. The dictionary is expected to have the fields: name, low_value, high_value, n. Note that all n are expected to be the same. If there is a discrepancy, assumes the max value.

Returns:

lhs_map – Latin hypercube sampling mapping of all the descriptors. Each element of the top list has info about each descriptor. The next list contains the runs. The DescPoint namedtuple has the attributes name, i, val, and field_len.

e.g. [

[(‘A’, 0, 0.37, 1), (‘A’, 1, 0.98, 1), (‘A’, 2, 0.24, 1)], [(‘B’, 0, 0.60, 1), (‘B’, 1, 0.03, 1), (‘B’, 1, 0.95, 1)]

]

Return type:

list of list of DescPoint namedtuples

descmap.sampling.get_linspace_map(descriptors_data)[source]

Returns linear spacing mapping

Parameters:

descriptors_data (list of dict) – Each element of the list has information related to a descriptor. The dictionary is expected to have the fields: name, low_value, high_value, n.

Returns:

linspace_map – Linear space mapping of all the descriptors. Each element of the top list has info about each descriptor. The next list contains the runs. The DescPoint namedtuples has the attribute name, i, val, and field_len.

e.g. [

[(‘A’, 0, 0.1, 1), (‘A’, 1, 0.2, 1), (‘A’, 2, 0.3, 1)], [(‘B’, 0, 0.5, 1), (‘B’, 1, 1., 1)]

]

Return type:

list of list of DescPoint namedtuples

descmap.sampling.sampling_map = {'lhs': <function get_lhs_map>, 'linear': <function get_linspace_map>}

Keys represent sampling type. Values represent function handles.

Type:

dict