mmgp.dimensionality_reduction

Attributes

available_dimensionality_reduction_algos

List of available dimensionality reduction algorithms

Classes

DimensionalityReductor

The DimensionalityReductor class is designed to perform dimensionality reduction

Functions

truncated_SVD_sym_lower(→ Tuple[numpy.ndarray, ...)

Computes a truncated singular value decomposition of a symetric definite

Module Contents

mmgp.dimensionality_reduction.available_dimensionality_reduction_algos = ['SnapshotPOD'][source]

List of available dimensionality reduction algorithms

class mmgp.dimensionality_reduction.DimensionalityReductor(algo: str, options: dict, common_morphed_mesh: Muscat.Containers.Mesh, input_or_output: str)[source]

Bases: object

The DimensionalityReductor class is designed to perform dimensionality reduction on a set of data using different algorithms.

Initializes an instance of the DimensionalityReductor class.

Parameters:
  • algo (str) – The name of the dimensionality reduction algorithm to use.

  • (dict[str (options) – Union[int, str]]): A dictionary of options and settings for the algorithm with fields ‘number_of_modes’ and ‘correlation_type’.

  • common_morphed_mesh (Mesh) – The mesh containing the data for dimensionality reduction.

  • input_or_output (str) – Specifies whether the data should be reduced based on input or output.

Raises:

AssertionError – If the specified algorithm is not supported.

Example

from mmgp.dimensionality_reduction import DimensionalityReductor
options = { 'number_of_modes': 8, 'correlation_type': 'mass_matrix' }
dim_reductor = Regressor('SnapshotPOD', options)
algo: str[source]
options: dict[source]
common_morphed_mesh: Muscat.Containers.Mesh[source]
input_or_output: str[source]
training_data: dict = None[source]
fit_transform(snapshots: numpy.ndarray) numpy.ndarray[source]

Fits and transforms the dimensionality reduction model to the data.

Parameters:

snapshots (np.ndarray) – The input data snapshots to be reduced.

Returns:

The reduced data in the form of generalized coordinates.

Return type:

np.ndarray

transform(snapshots: numpy.ndarray) numpy.ndarray[source]

Apply dimensionality reduction to a set of data ‘snapshots’

Parameters:

snapshots (np.ndarray) – The input data snapshots that needs to be transformed

Returns:

The transformed data or dataset resulting from the dimensionality reduction operation.

Return type:

np.ndarray

inverse_transform(reduced_dimension_representation: numpy.ndarray) numpy.ndarray[source]

Reverse the dimensionality reduction transformation applied to a reduced-dimensional representation of data.

Parameters:

reduced_dimension_representation (np.ndarray) – The reduced-dimensional representation of the data

Returns:

The reconstructed data resulting from the inverse transformation.

Return type:

np.ndarray

mmgp.dimensionality_reduction.truncated_SVD_sym_lower(matrix: scipy.sparse.csr, epsilon: float = None, nb_modes: int = None) Tuple[numpy.ndarray, numpy.ndarray][source]

Computes a truncated singular value decomposition of a symetric definite matrix in scipy.sparse.csr format. Only the lower triangular part needs to be defined

Parameters:
  • matrix (scipy.sparse.csr) – the input matrix

  • epsilon (float) – the truncation tolerence, determining the number of keps eigenvalues

  • nb_modes (int) – the number of keps eigenvalues

Returns:

  • np.ndarray – kept eigenvalues, of size (numberOfEigenvalues)

  • np.ndarray – kept eigenvectors, of size (numberOfEigenvalues, numberOfSnapshots)