TransformerMulti#
- class TransformerMulti(transformers, variable_sizes=None)[source]#
Join transformers together for states with multiple variables.
This class is for states that can be written (after discretization) as
\[\begin{split}\q = \left[\begin{array}{c} \q_{0} \\ \q_{1} \\ \vdots \\ \q_{n_q - 1} \end{array}\right] \in \RR^{n},\end{split}\]where each \(\q_{i} \in \RR^{n_i}\) represents a single discretized state variable of dimension \(n_i \in \NN\). The dimension of the joint state \(\q\) is \(n = \sum_{i=0}^{n_q - 1} n_i\), i.e.,
state_dimension = sum(variable_sizes)
. Individual transformers are calibrated for each state variable.- Parameters:
- transformerslist
Initialized (but not necessarily trained) transformer objects, one for each state variable. Entries of this list can be
None
, in which case aNullTransformer
is used.- variable_sizeslist or None
Dimensions for each state variable, \(n_0,\ldots,n_{n_q-1}\). If
None
(default), set \(n_i\) totransformers[i].state_dimension
; if any of these areNone
, assume all state variables have the same dimension, i.e., \(n_0 = n_1 = \cdots = n_x \in \NN\) with \(n_x\) to be determined infit()
. In this case, \(n = n_q n_x\).
Notes
This class connects multiple transformers “vertically” by assigning different transformations for different parts of the state; see
TransformerPipeline
to connect multiple transformers “horizontally”, i.e., to perform one transformation after another on the entire state.Properties:- num_variables#
Number of state variables \(n_q \in \NN\).
- state_dimension#
Total dimension \(n = \sum_{i=0}^{n_q-1} n_i \in \NN\) of the joint state.
- transformers#
Transformers for each state variable.
- variable_names#
Names for each state variable.
- variable_sizes#
Dimensions of each state variable, \(n_0,\ldots,n_{n_q-1}\in\NN\).
Methods:Learn (but do not apply) the transformation.
Learn and apply the transformation.
Extract a single variable from the joint state.
Apply the inverse of the learned transformation.
Load a previously saved transformer from an HDF5 file.
Split the joint state into the individual state variables.
Apply the learned transformation.
Apply the learned transformation to snapshot time derivatives.
Verify that
transform()
andinverse_transform()
are consistent and thattransform_ddts()
, if implemented in each transformer, is consistent withtransform()
.