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

BoundedParameterSpace()

Abstract implementation

ConstParameterSpace(parameter_names, ...)

Homogeneous parameter space in which every parameter is a constant StringParameter.

EmptyParameterSpace()

Empty parameter space that is useful for initializations

GaussianParameterSpace(parameter_names, ...)

Homogeneous parameter space in which every parameter is a GaussianParameter

HeterogeneousParameterSpace(parameter_objs)

Heterogeneous parameter space consisting of a list of arbitrary Parameter objects

HomogeneousParameterSpace(parameter_names, ...)

Homogenous parameter space in which every parameter is of the same type

ParameterSpace()

Abstract implementation

UniformParameterSpace(parameter_names, ...)

Homogeneous parameter space in which every parameter is a UniformParameter

class romtools.workflows.parameter_spaces.BoundedParameterSpace[source]#

Bases: ParameterSpace

Abstract implementation

abstractmethod bound_samples(samples)[source]#
Inputs: a sample distribution that potentially exceeds

the bounds of the parameter space

Outputs:

a bounded sample distribution

(number_of_samples, self.get_dimensionality())

Parameters:

samples (ndarray)

Return type:

array

class romtools.workflows.parameter_spaces.ConstParameterSpace(parameter_names, parameter_values)[source]#

Bases: HomogeneousParameterSpace

Homogeneous 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: ParameterSpace

Empty 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

get_dimensionality()[source]#

Returns an integer for the size of the parameter domain

Return type:

int

get_names()[source]#

Returns a list of parameter names # e.g., [‘sigma’,’beta’,…]

Return type:

list

class romtools.workflows.parameter_spaces.GaussianParameterSpace(parameter_names, means, stds, sampler)[source]#

Bases: HomogeneousParameterSpace

Homogeneous 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: ParameterSpace

Heterogeneous parameter space consisting of a list of arbitrary Parameter objects

Parameters:
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

get_dimensionality()[source]#

Returns an integer for the size of the parameter domain

Return type:

int

get_names()[source]#

Returns a list of parameter names # e.g., [‘sigma’,’beta’,…]

Return type:

Iterable[str]

class romtools.workflows.parameter_spaces.HomogeneousParameterSpace(parameter_names, sampler, param_constructor, **kwargs)[source]#

Bases: HeterogeneousParameterSpace

Homogenous parameter space in which every parameter is of the same type

Parameters:
  • parameter_names (Iterable[str])

  • sampler (Sampler)

class romtools.workflows.parameter_spaces.ParameterSpace[source]#

Bases: ABC

Abstract 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

abstractmethod get_dimensionality()[source]#

Returns an integer for the size of the parameter domain

Return type:

int

abstractmethod get_names()[source]#

Returns a list of parameter names # e.g., [‘sigma’,’beta’,…]

Return type:

Iterable[str]

class romtools.workflows.parameter_spaces.UniformParameterSpace(parameter_names, lower_bounds, upper_bounds, sampler)[source]#

Bases: HomogeneousParameterSpace

Homogeneous parameter space in which every parameter is a UniformParameter

Parameters:
  • parameter_names (Iterable[str])

  • sampler (Sampler)