BasisMulti#
- class BasisMulti(bases, full_variable_sizes=None)[source]#
Join bases 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, to be compressed (individually) to \(r_i\) degrees of freedom. The compressed state is therefore
\[\begin{split}\qhat = \left[\begin{array}{c} \qhat_0 \\ \qhat_1 \\ \vdots \\ \qhat_{n_q - 1} \end{array}\right] \in \RR^r,\end{split}\]where each \(\qhat_i \in \RR^{r_i}\) is the compressed version of the state variable \(\q_i \in \RR^{n_i}\). The full state dimension is \(n = \sum_{i=0}^{n_q - 1} n_i\), i.e.,
full_state_dimension = sum(full_variable_sizes)
; the reduced state dimension is \(r = \sum_{i=0}^{n_q - 1}r_i\), i.e.,reduced_state_dimension = sum(reduced_variable_sizes)
.- Parameters:
- baseslist
Initialized (but not necessarily trained) basis objects, one for each state variable.
- full_variable_sizeslist or None
Dimensions for each state variable, \(n_0,\ldots,n_{n_q-1}\). If
None
(default), set \(n_i\) tobases[i].full_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\).
Properties:- bases#
Bases for each state variable.
- full_state_dimension#
Total dimension \(n = \sum_{i=0}^{n_q-1} n_i \in \NN\) of the joint full state.
- full_variable_sizes#
Dimensions of each state variable, \(n_0, \ldots, n_{n_q - 1} \in \NN\).
- num_variables#
Number of state variables \(n_q \in \NN\).
- reduced_state_dimension#
Total dimension \(r = \sum_{i=0}^{n_q - 1}r_i \in \NN\) of the joint reduced state.
- reduced_variable_sizes#
Dimensions of each compressed state variable, \(r_0, \ldots, r_{n_q - 1} \in \NN\).
- shape#
Dimensions \((n, r)\) of the basis.
- variable_names#
Names for each state variable.
Methods:Map high-dimensional states to low-dimensional latent coordinates.
Map low-dimensional latent coordinates to high-dimensional states.
Construct the joint basis by calling
fit()
on the basis for each variable.Extract a single variable from the joint full or reduced state.
Load a previously saved transformer from an HDF5 file.
Project a high-dimensional state vector to the subset of the high-dimensional space that can be represented by the basis.
Compute the error of the basis representation of a state or states.
Save the transformer to an HDF5 file.
Split a full or reduced state vector into the individual variables.
Verify that
compress()
anddecompress()
are consistent in the sense that the range ofdecompress()
is in the domain ofcompress()
and thatproject()
defines a projection operator, i.e.,project(project(Q)) = project(Q)
.