pyLOM.PCA#

Module contents#

pyLOM.PCA.run(X: ndarray, divide_variance: bool = True, randomized: bool = False, r: int = 1, q: int = 3, seed: int = -1)[source]#

Run PCA analysis of a matrix.

Parameters:
  • X (np.ndarray) – data matrix of size [ndims*nmesh,n_temp_snapshots].

  • divide_variance (bool, optional) – whether or not to normalize the data with the variance. It is only effective when removing the mean (default: False).

  • randomized (bool, optional) – whether to perform randomized PCA or not (default: False).

  • r (int, optional) – in case of performing randomized PCA, how many modes do we want to recover. This option has no effect when randomized=False (default: 1).

  • q (int, optional) – in case of performing randomized PCA, how many power iterations are performed. This option has no effect when randomized=False (default: 3).

  • seed (int, optional) – seed for reproducibility of randomized operations. This option has no effect when randomized=False (default: -1).

Returns:

components and scores.

Return type:

[(np.ndarray), (np.ndarray)]

pyLOM.PCA.T2score(P: ndarray, ncomp: int = 1, confidence: float = 0.8)[source]#

Summarize the scores over the ncomp and return the limit for the confidence itnerval according to its probabilistic distribution.

Parameters:
  • P (np.ndarray) – scores from PCA.

  • ncomp (int, optional) – number of components to summarize the scores from (default: 1).

  • confidence (float, optional) – threshold confidence interval for clustering according to the T2 statistic. It is computed as in a F probability distribution (default: 0.8).

Returns:

T2 scores and clustering threshold.

Return type:

[(np.ndarray), float]