mne_denoise.ssa.LocalSingularSpectrumAnalysis#

class mne_denoise.ssa.LocalSingularSpectrumAnalysis(window_length: int | None = None, *, window_seconds: float | None = None, sfreq: float | None = None, n_clusters: int | str = 'auto', max_clusters: int = 10, max_window: int = 100, random_state: int | None = 0, verbose: bool | str | int | None = None)[source]#

Channel-wise local-SSA transformer for high-amplitude artifact reconstruction.

Parameters:
window_lengthint | None, default=None

Delay-vector dimension in samples; None selects it automatically.

window_secondsfloat | None, default=None

Delay-vector duration in seconds, requiring sfreq and mutually exclusive with window_length.

sfreqfloat | None, default=None

Sampling frequency in Hz.

n_clustersint or “auto”, default=”auto”

Number of delay-vector clusters, or automatic reliable selection.

max_clustersint, default=10

Upper bound for automatic cluster selection.

max_windowint, default=100

Maximum automatic delay-vector dimension.

random_stateint | None, default=0

Seed passed to k-means.

verbosebool, str, int, or None, default=None

Logging level.

Attributes:
sfreq_float | None

Validated sampling frequency.

n_channels_in_int

Number of fitted data channels.

ch_names_in_tuple of str or None

Fitted MNE channel names and order, or None for arrays.

diagnostics_dict | list of dict

Diagnostics from the most recent transform.

n_clusters_ndarray

Effective cluster counts.

subspace_dimensions_list

Selected local subspace dimensions.

See also

SingularSpectrumAnalysis

Frequency-guided Basic SSA.

compute_local_ssa

One-shot Local SSA interface.

Notes

The estimator is transductive: each transform clusters and reconstructs the records supplied to it. Local SSA can remove genuine structure that matches the learned local subspaces. [1].

References

Examples

>>> import numpy as np
>>> from mne_denoise.ssa import LocalSingularSpectrumAnalysis
>>> rng = np.random.default_rng(0)
>>> data = rng.standard_normal((8, 200))
>>> model = LocalSingularSpectrumAnalysis(window_length=40, n_clusters="auto")
>>> clean = model.fit_transform(data)