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.

variable_sizeslist or None

Dimensions for each state variable, \(n_0,\ldots,n_{n_q-1}\). If None (default), set \(n_i\) to transformers[i].state_dimension; if any of these are None, 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 in fit(). In this case, \(n = n_q n_x\).

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

fit

Learn (but do not apply) the transformation.

fit_transform

Learn and apply the transformation.

get_var

Extract a single variable from the joint state.

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.

split

Split the joint state into the individual state variables.

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 in each transformer, is consistent with transform().