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:Do nothing; this transformation is not learned from data.
Apply the shift.
Apply the inverse shift.
Load a previously saved transformer from an HDF5 file.
Save the transformer to an HDF5 file.
Apply the shift.
Do nothing; this transformation does not affect derivatives.
Verify that
transform()
andinverse_transform()
are consistent and thattransform_ddts()
, if implemented, is consistent withtransform()
.