ShiftTransformer#

class ShiftTransformer(reference_snapshot, /, name=None)[source]#

Shift snapshots by a given reference snapshot \(\bar{\q}\).

For a vector \(\q\in\RR^n\), this transformation is \(\q \mapsto \q' = \q - \bar{\q}\) with inverse transformation \(\q' \mapsto \q = \q' + \bar{\q}\).

For a matrix \(\Q\in\RR^{n \times k}\), the transformation is applied columnwise. Writing \(\Q = [~\q_0~~\q_1~~\cdots~~\q_{k-1}~]\),

\[\begin{split}\Q \mapsto \Q' = \Q - \bar{\q}\mathbf{1}_k\trp = \left[\begin{array}{c|c|c|c} &&& \\ \q_0 - \bar{\q} & \q_1 - \bar{\q} & \cdots & \q_{k-1} - \bar{\q} \\ &&& \end{array}\right],\end{split}\]

with the inverse transformation defined similarly.

Parameters:
reference_snapshot(n,) ndarray

Reference snapshot \(\bar{\q}\in\RR^n\).

namestr or None

Label for the state variable that this transformer acts on.

Notes

In this class, the reference snapshot \(\bar{\q}\) is provided explicitly. Use ShiftScaleTransformer to define \(\bar{\q}\) as the average training snapshot.

Properties:
name#

Label for the state variable that this transformer acts on.

reference#

Reference snapshot \(\bar{\q}\in\RR^n\).

state_dimension#

Dimension \(n\) of the state.

Methods:

fit

Do nothing; this transformation is not learned from data.

fit_transform

Apply the shift.

inverse_transform

Apply the inverse shift.

load

Load a previously saved transformer from an HDF5 file.

save

Save the transformer to an HDF5 file.

transform

Apply the shift.

transform_ddts

Do nothing; this transformation does not affect derivatives.

verify

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