CADETProcess.transform.TransformBase

Contents

CADETProcess.transform.TransformBase#

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.

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.

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