romtools.workflows.parameter_spaces#
Model reduction is often focused on parameterized PDEs, where \(\boldsymbol \mu\) is the parameter set. The ParameterSpace class encapsulates the notion of the parameter space.
Classes
Abstract implementation |
|
|
Homogeneous parameter space in which every parameter is a constant StringParameter. |
Empty parameter space that is useful for initializations |
|
|
Homogeneous parameter space in which every parameter is a GaussianParameter |
|
Heterogeneous parameter space consisting of a list of arbitrary Parameter objects |
|
Homogenous parameter space in which every parameter is of the same type |
|
Multivariate Gaussian parameter space with dense covariance coupling across all parameter dimensions. |
Abstract implementation |
|
|
Homogeneous parameter space in which every parameter is a UniformParameter |
|
Independent uniform Monte Carlo samples over a geometric union of boxes. |
- class romtools.workflows.parameter_spaces.BoundedParameterSpace[source]#
Bases:
ParameterSpaceAbstract implementation
- class romtools.workflows.parameter_spaces.ConstParameterSpace(parameter_names, parameter_values)[source]#
Bases:
HomogeneousParameterSpaceHomogeneous parameter space in which every parameter is a constant StringParameter. All numeric values are converted to str-type.
Useful if you need to execute workflows in a non-stochastic setting
- Parameters:
parameter_names (Iterable[str])
- class romtools.workflows.parameter_spaces.EmptyParameterSpace[source]#
Bases:
ParameterSpaceEmpty parameter space that is useful for initializations
- generate_samples(number_of_samples, seed=None)[source]#
Generates samples from the parameter space
Returns np.array of shape (number_of_samples, self.get_dimensionality())
- Parameters:
number_of_samples (int)
- Return type:
ndarray
- class romtools.workflows.parameter_spaces.GaussianParameterSpace(parameter_names, means, stds, sampler)[source]#
Bases:
HomogeneousParameterSpaceHomogeneous parameter space in which every parameter is a GaussianParameter
- Parameters:
parameter_names (Iterable[str])
sampler (Sampler)
- class romtools.workflows.parameter_spaces.HeterogeneousParameterSpace(parameter_objs, sampler=<function MonteCarloSampler>)[source]#
Bases:
ParameterSpaceHeterogeneous parameter space consisting of a list of arbitrary Parameter objects
- generate_samples(number_of_samples, seed=None)[source]#
Generates samples from the parameter space
Returns np.array of shape (number_of_samples, self.get_dimensionality())
- Parameters:
number_of_samples (int)
- Return type:
array
- class romtools.workflows.parameter_spaces.HomogeneousParameterSpace(parameter_names, sampler, param_constructor, **kwargs)[source]#
Bases:
HeterogeneousParameterSpaceHomogenous parameter space in which every parameter is of the same type
- Parameters:
parameter_names (Iterable[str])
sampler (Sampler)
- class romtools.workflows.parameter_spaces.MultivariateGaussianParameterSpace(parameter_names, means, covariance, sampler=<function MonteCarloSampler>)[source]#
Bases:
ParameterSpaceMultivariate Gaussian parameter space with dense covariance coupling across all parameter dimensions.
- Parameters:
parameter_names (Iterable[str])
sampler (Sampler)
- generate_samples(number_of_samples, seed=None)[source]#
Generates samples from the parameter space
Returns np.array of shape (number_of_samples, self.get_dimensionality())
- Parameters:
number_of_samples (int)
- Return type:
array
- class romtools.workflows.parameter_spaces.ParameterSpace[source]#
Bases:
ABCAbstract implementation
- abstractmethod generate_samples(number_of_samples, seed=None)[source]#
Generates samples from the parameter space
Returns np.array of shape (number_of_samples, self.get_dimensionality())
- Parameters:
number_of_samples (int)
- Return type:
array
- class romtools.workflows.parameter_spaces.UniformParameterSpace(parameter_names, lower_bounds, upper_bounds, sampler)[source]#
Bases:
HomogeneousParameterSpaceHomogeneous parameter space in which every parameter is a UniformParameter
- Parameters:
parameter_names (Iterable[str])
sampler (Sampler)
- class romtools.workflows.parameter_spaces.UnionParameterSpace(regions)[source]#
Bases:
ParameterSpaceIndependent uniform Monte Carlo samples over a geometric union of boxes.
Regions must be
UniformParameterSpaceinstances with identical ordered names and dimensionality, finite real bounds, and strictly positive widths. Names and bounds are copied at construction. Region samplers are ignored: even LHS-configured regions produce independent Monte Carlo union samples.A proposal chooses a box by volume, samples uniformly within it, and is accepted with probability 1 / (number of containing boxes). This corrects overlap bias without rejecting from a potentially sparse bounding box. The acceptance rate is union volume / sum of region volumes, so heavy overlap increases sampling cost. Products of widths are normalized in log space; unrepresentable widths or region probabilities raise ValueError.
- Parameters:
regions (Iterable[UniformParameterSpace])
- contains(samples)[source]#
Return membership for a point
(d,)or a batch(n, d).Boundaries are included. NaN/infinite coordinates are outside the union. Other shapes or nonnumeric/complex inputs are rejected.
- Return type:
bool | ndarray
- generate_samples(number_of_samples, seed=None)[source]#
Draw
(number_of_samples, d)independent uniform union samples.Uses a local NumPy generator without changing global RNG state. Fixed seeds reproduce draws; these samples are not an LHS design.
- Parameters:
number_of_samples (int)
- Return type:
ndarray