beetroots.space_transform package
Submodules
beetroots.space_transform.abstract_transform module
- class beetroots.space_transform.abstract_transform.Scaler[source]
Bases:
ABCclass that defines a transition between the sampling space and a more user friendly / interpretable space
- abstract from_lin_to_scaled(Theta_linscale: ndarray) ndarray[source]
applies the transformation from user friendly scale to sampling scale
- Parameters:
Theta_linscale (np.ndarray of shape (-1, D)) – array in user friendly scale
- Returns:
array in sampling scale
- Return type:
np.ndarray of shape (-1, D)
beetroots.space_transform.id_transform module
Contains a mock class for the scaler object, that does not transform the arrays it receives
- class beetroots.space_transform.id_transform.IdScaler[source]
Bases:
Scaler
beetroots.space_transform.transform module
Contains a class that defines the transition between the sampling scale and user friendly / interpretable scale
- class beetroots.space_transform.transform.MyScaler(mean_: ndarray, std_: ndarray, list_is_log: List[bool])[source]
Bases:
ScalerDefines the scale used during sampling and the transforms to navigate from one scale to the other. The transformation is a normalization (defined with a mean mean_ and standard deviation std_) for each physical parameter, defined on the log10 scale or on the linear scale depending on list_is_log.
Note
If one of the physical parameters is the scaling factor \(\kappa\), its mean is set to 0 and its std to 1 / np.log(10), so that it is not normalized regardless to its sampling scale (log10 or linear).
The std = 1 / np.log(10) for kappa yields a scaled validity interval that is about [-2.7, 2.7] (for a [0.1, 10] true validity interval), ie comparable to that of other normalized parameters.
- D
total number of physical parameters that require a standard scaler, including the scaling factor \(\kappa\)
- Type:
int
- LOG_10 = 2.3025850929940455
- from_lin_to_scaled(Theta_linscale: ndarray) ndarray[source]
applies the transformation from user friendly scale to sampling scale
- Parameters:
Theta_linscale (np.ndarray of shape (-1, D)) – array in user friendly scale
- Returns:
array in sampling scale
- Return type:
np.ndarray of shape (-1, D)
- from_scaled_to_lin(Theta_scaled: ndarray) ndarray[source]
applies the transformation from sampling scale to user friendly scale
- Parameters:
Theta_scaled (np.ndarray of shape (-1, D)) – array in sampling scale
- Returns:
array in user friendly scale
- Return type:
np.ndarray of shape (-1, D)
- list_is_log
whether the normalization should be applied on the log10 scale or in the linear scale
- Type:
list of bool of length D
- mean_
mean of the D components \(\theta_d\), used in the data normalization
- Type:
np.ndarray of shape (D,)
- std_
standard deviation of the D components \(\theta_d\), used in the data normalization
- Type:
np.ndarray of shape (D,)
Module contents
Contains tranforms between sampling scales and user friendly scales