TransformerTemplate#

class TransformerTemplate(name: str = None)[source]#

Template class for transformers.

Classes that inherit from this template must implement the methods fit_transform(), transform(), and inverse_transform(). The optional transform_ddts() method is used by the ROM class when snapshot time derivative data are available in the native state variables.

See ShiftScaleTransformer for an example.

The default implementation of fit() simply calls fit_transform().

Parameters:
namestr

Label for the state variable that this transformer acts on.

Properties:
name#

Label for the state variable that this transformer acts on.

state_dimension#

Dimension \(n\) of the state.

Methods:

fit

Learn (but do not apply) the transformation.

fit_transform

Learn and apply the transformation.

inverse_transform

Apply the inverse of the learned transformation.

load

Load a previously saved transformer from an HDF5 file.

save

Save the transformer to an HDF5 file.

transform

Apply the learned transformation.

transform_ddts

Apply the learned transformation to snapshot time derivatives.

verify

Verify that transform() and inverse_transform() are consistent and that transform_ddts(), if implemented, is consistent with transform().