VariableTransformer
#
- class pybads.variable_transformer.VariableTransformer(D, lower_bounds: ndarray = None, upper_bounds: ndarray = None, plausible_lower_bounds: ndarray = None, plausible_upper_bounds: ndarray = None, apply_log_t=None)[source]#
A class enabling linear or non-linear transformation of the bounds (plausible_lower_bounds and plausible_upper_bounds) and map them to an hypercube [-1, 1]^D
- Parameters:
- Dint
The dimension of the space.
- lower_boundsnp.ndarray, optional
The lower bounds of the space.
lower_bounds
andupper_bounds
define a set of strict lower and upper bounds for each variable, given in the original space. By default None.- upper_boundsnp.ndarray, optional
The upper bounds of the space.
lower_bounds
andupper_bounds
define a set of strict lower and upper bounds for each variable, given in the original space. By default None.- plausible_lower_boundsnp.ndarray, optional
The plausible lower bounds such that
lower_bounds < plausible_lower_bounds < plausible_upper_bounds < upper_bounds
.plausible_lower_bounds
andplausible_upper_bounds
represent a “plausible” range for each variable, given in the original space. By default None.- plausible_upper_boundsnp.ndarray, optional
The plausible upper bounds such that
lower_bounds < plausible_lower_bounds < plausible_upper_bounds < upper_bounds
.plausible_lower_bounds
andplausible_upper_bounds
represent a “plausible” range for each variable, given in the original space. By default None.- apply_log_tnp.ndarray, optional
A boolean array of size (1, D) that indicates which variables to apply the non-linear log transformation. By default None, in which case the log transformation is applied if the bounds are all positive and the variables span more than one order of magnitude.
- __call__(input: ndarray)[source]#
Performs direct transform of original variables
input
into the hypercube space.- Parameters:
- inputnp.ndarray
A N x D array, where N is the number of input data and D is the number of dimensions
- Returns:
- unp.ndarray
The variables transformed.
- inverse_transf(input: ndarray)[source]#
Performs inverse transform of the transformed variables
input
in the hypercube into the original space.- Parameters:
- inputnp.ndarray
The transformed variables that will be mapped in the original space.
- Returns:
- xnp.ndarray
The original variables retrieved by the inverse transform.