lhs_sample_generator
Latin Hypercube Sample (LHS) generator component.
LHSampleGenerator
Bases: BaseSampleGenerator
Latin Hypercube Sample generator component.
Attributes:
| Name | Type | Description |
|---|---|---|
settings_class |
The settings class for this output handler. |
|
supported_kwargs |
The full set of supported keyword arguments for the |
|
required_kwargs |
The set of required keyword arguments for the |
Methods:
| Name | Description |
|---|---|
find_missing_required_kwargs |
Validates that all required keyword arguments are present. |
build_settings_from_kwargs |
Validates the keyword arguments and builds the settings object. |
generate |
Generate a list of samples from the provided data. |
Source code in src/mada_tools/simulation/simutils/samples/generation/lhs_sample_generator.py
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | |
generate(**kwargs)
Generate a list of samples from the provided data.
This method will convert the keyword arguments into a LHSampleSettings object
for validation and logging purposes. It will then use these settings to generate
samples using the Latin Hypercube Sampling method.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
**kwargs
|
Dict[str, Any]
|
Keyword arguments for sample generation. For LHS sampling, this must include: - dims: int, number of dimensions - n_samples: int, number of samples to generate - lower_bounds: List[float], lower bounds for each dimension - upper_bounds: List[float], upper bounds for each dimension - rng: Optional[np.random.Generator], random number generator |
{}
|
Returns:
| Type | Description |
|---|---|
ndarray
|
A numpy array of generated samples. |
Source code in src/mada_tools/simulation/simutils/samples/generation/lhs_sample_generator.py
LHSampleSettings
dataclass
Bases: BaseSettings
A class to encapsulate the settings for generating Latin Hypercube samples.
Attributes:
| Name | Type | Description |
|---|---|---|
dims |
int
|
The number of dimensions (variables). |
n_samples |
int
|
The number of samples to generate. |
lower_bounds |
List[float]
|
The lower bounds for each dimension. |
upper_bounds |
List[float]
|
The upper bounds for each dimension. |
rng |
Generator
|
The random number generator that will seed LHS sampling (if provided) |
Source code in src/mada_tools/simulation/simutils/samples/generation/lhs_sample_generator.py
validate()
Validates the input parameters.