pyLOM.GPOD#

Module contents#

class pyLOM.GPOD.GappyPOD(centered=False, apply_truncation=False, truncation_param=-0.99, reconstruction_method='standard', ridge_lambda=0.01)[source]#

Bases: object

__init__(centered=False, apply_truncation=False, truncation_param=-0.99, reconstruction_method='standard', ridge_lambda=0.01)[source]#

Gappy POD model for reconstructing incomplete data using POD modes.

Parameters:
  • centered (bool) – Whether to center the data by subtracting the mean.

  • apply_truncation (bool) – Whether to apply truncation.

  • truncation_method (float or int) – Threshold for truncation.

  • reconstruction_method (str) – Reconstruction method (‘standard’ or ‘ridge’).

  • ridge_lambda (float) – Regularization parameter for ridge reconstruction.

fit(snapshot_matrix: ndarray, **kwargs) None[source]#

Fit the Gappy POD model using the snapshot matrix.

Parameters:

snapshot_matrix (np.ndarray) – Training matrix [n_features, n_samples].

predict(gappy_vector: ndarray) ndarray[source]#

Reconstruct missing data using the fitted Gappy POD model.

Parameters:

gappy_vector (np.ndarray) – Sparse vector with missing values.

Returns:

Reconstructed data vector.

Return type:

np.ndarray

reconstruct_full_set(incomplete_snapshot: ndarray, iter_num: int) tuple[ndarray, ndarray, ndarray][source]#

Iteratively reconstruct an incomplete snapshot matrix using Gappy POD.

Parameters:
  • incomplete_snapshot (np.ndarray) – Snapshot matrix with missing values (n_features, n_samples).

  • iter_num (int) – Number of iterations for the iterative reconstruction process.

Returns:

Reconstructed snapshot matrix, eigenvalue spectrum across iterations,

and cumulative energy.

Return type:

tuple

pyLOM.GPOD.set_random_elements_to_zero(vector, percentage)[source]#

Randomly sets a specified percentage of elements in a vector to zero.

Parameters:
  • vector (np.ndarray) – Input vector.

  • percentage (float) – Percentage of elements to set to zero.

Returns:

Modified vector with zeros.

Return type:

np.ndarray

pyLOM.GPOD.delete_snapshot(X, snap, axis=1)[source]#

Remove snapshot from training data.