CADETProcess.transform.TransformerBase

Contents

CADETProcess.transform.TransformerBase#

class CADETProcess.transform.TransformerBase(lb_input: float | ndarray = -inf, ub_input: float | ndarray = inf, allow_extended_input: bool | None = False, allow_extended_output: bool | None = False)[source]#

Base class for parameter transformation.

This class provides an interface for transforming an input parameter space to some output parameter space.

Attributes:
lb_inputfloat or np.ndarray

Return the lower bounds of the input parameter space.

ub_inputfloat or np.ndarray

Return the upper bounds of the input parameter space.

lbfloat or np.ndarray

Return the lower bounds of the output parameter space.

ubfloat or np.ndarray

Return 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([use_log_scale, ax, setup_figure_kwargs])

Plot the transformed space against the input space.

transform(x)

Transform the input parameter space to the output parameter space.

untransform(x[, significant_digits])

Transform the output parameter space back to the input 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 MyTransformer(TransformerBase):
...     def transform(self, x: float) -> float:
...         return x ** 2
...
>>> t = MyTransformer(lb_input=0, ub_input=10, lb=-100, ub=100)
>>> t.transform(3)
9