Skip to content

Latent space projections

dynax.PODLatentSpace

Proper orthogonal decomposition based latent space.

Linear projections to and from a latent space using the right singular vectors from the SVD of snapshots with as modes/basis.

When projecting into the latent space, the input is first shifted (optional), then scaled and finally projected onto the modes. By default, the scaling is computed such that the latent variables of the snapshots used to calculate the modes have standard deviation one.

For the projection into the full order space, the latent variables are first multiplied with the modes, then scaled and finally shifted.

__init__(snapshots, num_modes, shift=None, scaling='normalize')

Initialize the SVD latent space.

Note

After initialization you can still change the number of modes, i.e., the latent space dimension.

PARAMETER DESCRIPTION
snapshots

Snapshots of shape (n_batch, n_time, n_space).

TYPE: Shaped[ndarray, 'n_batch n_time n_space'] | Shaped[Array, 'n_batch n_time n_space']

num_modes

Number of modes to use in the latent space.

TYPE: int

shift

Array or float to shift a snapshot by, before transforming. By setting shift=<special state>, the special state is transformed to the origin of the latent space.

TYPE: float | Shaped[ndarray, '#n_space'] | Shaped[Array, '#n_space'] | None DEFAULT: None

scaling

Scalar value to scale all latent variables by. Can be "normalize", in which case the scale is automatically chosen, such that the latent variables of snapshots have standard deviation one.

TYPE: float | Shaped[ndarray, ''] | Shaped[Array, ''] | Literal['normalize'] | None DEFAULT: 'normalize'

to_latent(snapshot)

Project snapshot into the latent space.

PARAMETER DESCRIPTION
snapshot

Data with shape (..., n_space).

TYPE: Shaped[ndarray, '... n_space'] | Shaped[Array, '... n_space']

RETURNS DESCRIPTION
Shaped[Array, '... n_modes']

Array of latent variables with shape (..., n_modes).

from_latent(latent_variables)

Project latent variables into the full order space.

PARAMETER DESCRIPTION
latent_variables

Data with shape (..., n_modes).

TYPE: Shaped[ndarray, '... n_modes'] | Shaped[Array, '... n_modes']

RETURNS DESCRIPTION
Shaped[Array, '... n_space']

Array with shape (..., n_space).