Dimensionality Reducers

class derrom.dim_reducers.DFT(sorted=False)[source]

Bases: base_dim_reducer

Dimensionality reduction with Fourier modes.

The dimensionality reduction is achieved by projecting the data onto a reduced number of fourier modes. The latent space description thus consists of the considered Fourier coefficients. The complex coeffiecients are thereby split into their real and imaginary parts. Implemented via the Fast Fourier Transform (FFT).

Parameters:

sorted (bool) – If set to False, the low frequency modes are used and and the high frequency modes are discarded (cutoff controlled by the reduced dimension \(r\).) If set to True, the Fourier coefficients are evaluated for the training data and sorted in descending order of their mean. The dimensionality reduction then utilizes the corresponding first \(r\) modes with the largest mean coefficients.

reconstruct(reduced_data_matrix)[source]

Reconstructs the data matrix by expanding it in the truncated Fourier basis via the FFT.

Parameters:

reduced_data_matrix (2D numpy.ndarray) – The reduced dimensianal trajectory to be reconstructed.

Returns:

reconstructed_data_matrix – The reconstructed/expanded trajectory

Return type:

2D numpy.ndarray

reduce(data_matrix, rdim)[source]

Projects the data into the truncated Fourier space via the FFT.

Parameters:
  • data_matrix (2D numpy.ndarray) – The high dimensional trajectory, which is to be reduced.

  • rdim (int) – Number of latent space dimensions, to which the trajectory is to be reduced.

Returns:

reduced_data_matrix – The reduced dimensionality trajectory

Return type:

2D numpy.ndarray

train(data_matrix, rdim)[source]

Computes the mean Fourier coefficients to generated arrays with the sorting and unsorting indices if sorted is set to True.

Parameters:
  • data_matrix (2D numpy.ndarray) – The data vectors are expected to be stored in the rows (first index). The training data matrix is typically composed of multiple concatenated trajectories.

  • rdim (int) – Number of latent space dimensions, to which the trajectory is to be reduced. Not used by the DFT reducer.

class derrom.dim_reducers.Hermite(sample_max=1.0, sorted=False, optimize=False, orthogonalize=False, train_rdim=None)[source]

Bases: base_dim_reducer

Dimensionality reduction bases on sampled Gauss-Hermite functions.

This reduction scheme is physically motivated and custom tailored to describe perturbations of Fermi-distributions.

Refer to the publication [] and the code for more details.

reconstruct(reduced_data_matrix)[source]
reduce(data_matrix, rdim)[source]
train(data_matrix, rdim)[source]
class derrom.dim_reducers.SVD[source]

Bases: base_dim_reducer

Singular value decomposition (SVD) based linear dimensionality reduction.

The SVD \(X^T = U \Sigma V^T\) provides an orthonormal basis for the transposed data matrix \(X^T\) via the unitary matrix \(U\). Note that the data vectors \(x_n\) are stored in the rows of \(X\) and the data matrix is then transposed to conform to the typical SVD literature. The dimensionality reduction is achieved by projecting new data onto the first \(r\) left singular vectors \(u_{l}\) of the training data matrix, i.e., onto the truncated basis \(U_r\).

Class attributes

U

\(U\) matrix of the SVD, where the columns are the left singular vectors \(u_{l}\).

Type:

2D numpy.ndarray

S

Diagonal matrix containing the singular values \(\sigma_l\) in descending order.

Type:

2D numpy.ndarray

reconstruct(reduced_data_matrix)[source]

Reconstructs the data matrix by expanding it in the truncated basis.

Computes \(\tilde{X} = R U_r^T\), where \(\tilde{X}\) is the reconstructed data matrix and \(R\) the reduced data matrix

Parameters:

reduced_data_matrix (2D numpy.ndarray) – The reduced dimensianal trajectory to be reconstructed.

Returns:

reconstructed_data_matrix – The reconstructed/expanded trajectory

Return type:

2D numpy.ndarray

reduce(data_matrix, rdim)[source]

Projects the input into a latent space with reduced dimensionality.

Computes \(R = X U_r\), where \(X\) is the data matrix and \(R\) the reduced data matrix. Note, that the data vectors are stored in the rows here.

Parameters:
  • data_matrix (2D numpy.ndarray) – The high dimensional trajectory, which is to be reduced.

  • rdim (int) – Number of latent space dimensions, to which the trajectory is to be reduced.

Returns:

reduced_data_matrix – The reduced dimensionality trajectory

Return type:

2D numpy.ndarray

train(data_matrix, rdim)[source]

Training method that computes the SVD and stores the \(U\) matrix and the singular values \(\Sigma\) in U and S for the reduction and reconstruction and analysis.

Parameters:
  • data_matrix (2D numpy.ndarray) – The data vectors are expected to be stored in the rows (first index). The training data matrix is typically composed of multiple concatenated trajectories.

  • rdim (int) – Number of latent space dimensions, to which the trajectory is to be reduced. Not used by the SVD reducer.

class derrom.dim_reducers.base_dim_reducer[source]

Bases: object

Base class to define the methods to be implemented

reconstruct(reduced_data_matrix)[source]
reduce(data_matrix, rdim)[source]
train(data_matrix, rdim)[source]