Transform (CADETProcess.transform
)#
This module provides functionality for transforming data.
|
Base class for parameter transformation. |
|
A class that implements no transformation. |
|
A class that implements a normalized linear transformation. |
|
A class that implements a normalized logarithmic transformation. |
|
A class that implements an automatic parameter transformation. |
- class CADETProcess.transform.AutoTransform(*args, threshold=1000, **kwargs)[source]#
A class that implements an automatic parameter transformation.
Transforms the input value to the range [0, 1] using either the
NormLinearTransform
or theNormLogTransform
based on the input parameter space.- Attributes:
- linear
NormLinearTransform
Instance of the linear normalization transform.
- log
NormLogTransform
Instance of the logarithmic normalization transform.
- linear
Methods
plot
(ax[, use_log_scale])Plot the transformed space against the input space.
transform
(x)Transform the input parameter space to the output parameter space.
untransform
(x)Transform the output parameter space to the input parameter space.
- property is_linear#
bool: True if transformation is linear.
- property lb#
{float, array-like}: The lower bounds of the output parameter space.
- property lb_input#
{float, array-like}: The lower bounds of the input parameter space.
- property ub#
{float, array-like}: The upper bounds of the output parameter space.
- property ub_input#
{float, array-like}: The upper bounds of the input parameter space.
- property use_linear#
bool: Indicates whether linear transformation is used.
- property use_log#
bool: Indicates whether logarithmic transformation is used.
- class CADETProcess.transform.NoTransform(lb_input=-inf, ub_input=inf, allow_extended_input=False, allow_extended_output=False)[source]#
A class that implements no transformation.
Returns the input values without any transformation.
See also
TransformBase
The base class for parameter transformation.
- Attributes:
is_linear
bool: True if transformation is linear.
lb
{float, array-like}: The lower bounds of the output parameter space.
lb_input
{float, array-like}: The lower bounds of the input parameter space.
ub
{float, array-like}: The upper bounds of the output parameter space.
ub_input
{float, array-like}: The upper bounds of the input parameter space.
Methods
plot
(ax[, use_log_scale])Plot the transformed space against the input space.
transform
(x)Transform the input parameter space to the output parameter space.
untransform
(x)Transform the output parameter space to the input parameter space.
- property is_linear#
bool: True if transformation is linear.
- property lb#
{float, array-like}: The lower bounds of the output parameter space.
- property ub#
{float, array-like}: The upper bounds of the output parameter space.
- class CADETProcess.transform.NormLinearTransform(lb_input=-inf, ub_input=inf, allow_extended_input=False, allow_extended_output=False)[source]#
A class that implements a normalized linear transformation.
Transforms the input value to the range [0, 1] by normalizing it using the lower and upper bounds of the input parameter space.
See also
TransformBase
The base class for parameter transformation.
- Attributes:
is_linear
bool: True if transformation is linear.
lb
{float, array-like}: The lower bounds of the output parameter space.
lb_input
{float, array-like}: The lower bounds of the input parameter space.
ub
{float, array-like}: The upper bounds of the output parameter space.
ub_input
{float, array-like}: The upper bounds of the input parameter space.
Methods
plot
(ax[, use_log_scale])Plot the transformed space against the input space.
transform
(x)Transform the input parameter space to the output parameter space.
untransform
(x)Transform the output parameter space to the input parameter space.
- property is_linear#
bool: True if transformation is linear.
- property lb#
{float, array-like}: The lower bounds of the output parameter space.
- property ub#
{float, array-like}: The upper bounds of the output parameter space.
- class CADETProcess.transform.NormLogTransform(lb_input=-inf, ub_input=inf, allow_extended_input=False, allow_extended_output=False)[source]#
A class that implements a normalized logarithmic transformation.
Transforms the input value to the range [0, 1] using a logarithmic transformation with the lower and upper bounds of the input parameter space.
See also
TransformBase
The base class for parameter transformation.
- Attributes:
is_linear
bool: True if transformation is linear.
lb
{float, array-like}: The lower bounds of the output parameter space.
lb_input
{float, array-like}: The lower bounds of the input parameter space.
ub
{float, array-like}: The upper bounds of the output parameter space.
ub_input
{float, array-like}: The upper bounds of the input parameter space.
Methods
plot
(ax[, use_log_scale])Plot the transformed space against the input space.
transform
(x)Transform the input parameter space to the output parameter space.
untransform
(x)Transform the output parameter space to the input parameter space.
- property is_linear#
bool: True if transformation is linear.
- property lb#
{float, array-like}: The lower bounds of the output parameter space.
- property ub#
{float, array-like}: The upper bounds of the output parameter space.
- class CADETProcess.transform.TransformBase(lb_input=-inf, ub_input=inf, allow_extended_input=False, allow_extended_output=False)[source]#
Base class for parameter transformation.
This class provides an interface for transforming an input parameter space to some output parameter space.
- Raises:
- ValueError
If lb_input and ub_input have different shapes.
Notes
This is an abstract base class and cannot be instantiated directly.
The transform method must be implemented by a subclass.
Examples
>>> class MyTransform(TransformBase): ... def transform(self, x): ... return x ** 2 ... >>> t = MyTransform(lb_input=0, ub_input=10, lb=-100, ub=100) >>> t.transform(3) 9
- Attributes:
lb_input
{float, array-like}{float, array-like}: The lower bounds of the input parameter space.
ub_input
{float, array-like}{float, array-like}: The upper bounds of the input parameter space.
lb
{float, array-like}{float, array-like}: The lower bounds of the output parameter space.
ub
{float, array-like}{float, array-like}: The upper bounds of the output parameter space.
- allow_extended_inputbool
If True, the input value may exceed the lower/upper bounds. Else, an exception is thrown.
- allow_extended_outputbool
If True, the output value may exceed the lower/upper bounds. Else, an exception is thrown.
Methods
plot
(ax[, use_log_scale])Plot the transformed space against the input space.
transform
(x)Transform the input parameter space to the output parameter space.
untransform
(x)Transform the output parameter space to the input parameter space.
- abstract property is_linear#
bool: True if transformation is linear.
- abstract property lb#
{float, array-like}: The lower bounds of the output parameter space.
Must be implemented in the child class.
- property lb_input#
{float, array-like}: The lower bounds of the input parameter space.
- plot(ax, use_log_scale=False)[source]#
Plot the transformed space against the input space.
- Parameters:
- axmatplotlib.axes.Axes
The axes object to plot on.
- use_log_scalebool, optional
If True, use a logarithmic scale for the x-axis.
- transform(x)[source]#
Transform the input parameter space to the output parameter space.
Applies the transformation function _transform to x after performing input bounds checking. If the transformed value exceeds the output bounds, an error is raised.
- Parameters:
- x{float, array}
Input parameter values.
- Returns:
- {float, array}
Transformed parameter values.
- abstract property ub#
{float, array-like}: The upper bounds of the output parameter space.
Must be implemented in the child class.
- property ub_input#
{float, array-like}: The upper bounds of the input parameter space.
- untransform(x)[source]#
Transform the output parameter space to the input parameter space.
Applies the transformation function _untransform to x after performing output bounds checking. If the transformed value exceeds the input bounds, an error is raised.
- Parameters:
- x{float, array}
Output parameter values.
- Returns:
- {float, array}
Transformed parameter values.