pyssaBSS.ssa
Functions
|
|
|
|
|
|
|
|
|
Compute normalized scree values from eigenvalues. |
Classes
|
Rank estimator based on data augmentation. |
|
Stationary Subspace Analysis (SSA) |
- class pyssaBSS.ssa.AugmentationRankEstimator(noise_dim, num_rep=10, random_state=None)[source]
Bases:
objectRank 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.
- class pyssaBSS.ssa.SSA(data, partition, scatter, dim_estimator=None)[source]
Bases:
objectStationary 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
- 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:
- 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).