pyssaBSS.ssa

Functions

SSA_COMB(data, partition[, lag, s, r])

SSA_COR(data, partition[, lag, s, r])

SSA_SAVE(data, partition[, s, r])

SSA_SIR(data, partition[, s, r])

normalized_scree(eigenvalues)

Compute normalized scree values from eigenvalues.

Classes

AugmentationRankEstimator(noise_dim[, ...])

Rank estimator based on data augmentation.

SSA(data, partition, scatter[, dim_estimator])

Stationary Subspace Analysis (SSA)

class pyssaBSS.ssa.AugmentationRankEstimator(noise_dim, num_rep=10, random_state=None)[source]

Bases: object

Rank estimator based on data augmentation.

Parameters:
  • noise_dim (int) – Number of Gaussian noise components to append.

  • num_rep (int) – Number of augmentation trials.

  • random_state (int or None) – Random seed for reproducibility.

estimate(model)[source]

Estimate rank by combining measurements of norms of augmented eigenvectors and normalised scree plot of eigenvalues.

Parameters:

model (SSA) – An SSA model to compute the eigendecompositions.

Return type:

RankResult

class pyssaBSS.ssa.SSA(data, partition, scatter, dim_estimator=None)[source]

Bases: object

Stationary Subspace Analysis (SSA)

Examples

Initialize the model:

model = SSA(data, coords, scatter=scatter, partition=partition)

Optionally estimate the rank of the nonstationary subspace:

q = model.estimate_rank()

Extract stationary and nonstationary subspaces:

ss, ns = model.subspaces(q)
Parameters:
  • data (ndarray of shape (n_signals, n_samples)) – Observed data matrix. Decomposition is performed immediately on construction.

  • partition (ndarray, optional) – Partition labels for observations.

  • scatter (dict, list, or scatter object) – Scatter matrices or operators for subspace analysis.

  • dim_estimator (AugmentationRankEstimator, optional) – An object to compute an estimate of the nonstationary dimension. Currently only support one kind of estimator but could be easily extended to include different estimators.

whitener_

Whitening matrix from data standardization.

Type:

ndarray

diagonalizer_

Matrix that diagonalizes the scatter matrices.

Type:

ndarray

eigenvalues_

Eigenvalues from the diagonalization.

Type:

ndarray

individual_models_

Decomposed models for individual scatters.

Type:

dict[str, SSA]

estimated_rank_

Rank estimated by estimate_rank(), if called.

Type:

int or None

rank_summary_

Full rank estimation diagnostics, if estimate_rank() has been called.

Type:

SSARankSummary or RankResult

property eigenvalues: ndarray[tuple[Any, ...], dtype[float64]]

Eigenvalues from the scatter decomposition (copy).

estimate_rank(individual=False)[source]

Estimate the rank (dimension) of the nonstationary subspace.

Parameters:

individual (bool, default False) – If True, also estimate rank for each individual scatter and store full results in rank_summary_. Slower but more informative.

Returns:

Estimated rank of the nonstationary subspace.

Return type:

int

subspaces(q=None)[source]

Return the stationary and nonstationary subspace projection matrices.

Parameters:

q (int, optional) – Dimension of the nonstationary subspace. If omitted, uses the rank stored by a prior call to estimate_rank().

Return type:

Tuple[ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]]]

Returns:

  • stationary (ndarray of shape (n_signals - q, n_signals)) – Projection onto the stationary subspace.

  • non_stationary (ndarray of shape (q, n_signals)) – Projection onto the nonstationary subspace.

property whitener: ndarray[tuple[Any, ...], dtype[float64]]

Whitening matrix (copy).

pyssaBSS.ssa.SSA_COMB(data, partition, lag=1, s=10, r=10, **kwargs)[source]
Return type:

SSA

pyssaBSS.ssa.SSA_COR(data, partition, lag=1, s=10, r=10, **kwargs)[source]
Return type:

SSA

pyssaBSS.ssa.SSA_SAVE(data, partition, s=10, r=10, **kwargs)[source]
Return type:

SSA

pyssaBSS.ssa.SSA_SIR(data, partition, s=10, r=10, **kwargs)[source]
Return type:

SSA

pyssaBSS.ssa.normalized_scree(eigenvalues)[source]

Compute normalized scree values from eigenvalues.

Parameters:

eigenvalues (ndarray)

Returns:

Normalized scree values in [0, 1].

Return type:

ndarray