mne_denoise.dss.IterativeDSS#
- class mne_denoise.dss.IterativeDSS(denoiser: Callable[[ndarray], ndarray], n_components: int, *, method: str = 'deflation', rank: int | None = None, reg: float = 1e-09, normalize_input: bool = True, max_iter: int = 100, tol: float = 1e-06, verbose: bool | str | int | None = None, alpha: float | Callable | None = None, beta: float | Callable | None = None, gamma: float | Callable | None = None, random_state: int | Generator | None = None)[source]#
Iterative DSS transformer.
The estimator fits fixed-point nonlinear DSS filters on NumPy arrays or MNE
Raw/Epochsinputs.- Parameters:
- denoisercallable
Nonlinear source transformation.
- n_componentsint
Number of components to extract.
- method{“deflation”, “symmetric”}, default=”deflation”
Component extraction strategy.
- rankint or None, default=None
Whitening rank.
- regfloat, default=1e-9
Relative whitening threshold.
- normalize_inputbool, default=True
Normalize channels during fitting and undo the scaling on reconstruction.
- max_iterint, default=100
Maximum fixed-point iterations.
- tolfloat, default=1e-6
Convergence tolerance.
- verbosebool, str, int, or None, default=None
Logging level.
- alpha, beta, gammafloat, callable, or None
Optional fixed-point parameters.
- random_stateint, numpy.random.Generator, or None, default=None
Random state for initialization.
- Attributes:
- filters_ndarray
Fitted sensor-space filters.
- patterns_ndarray
Fitted sensor-space patterns.
- sources_ndarray
Sources from the fit data.
- convergence_info_ndarray, shape (n_components, 2)
Iteration count and convergence flag per component.
See also
DSSLinear covariance-bias DSS.
iterative_dssFunctional iterative DSS interface.
Notes
transformreturns source arrays.inverse_transformreconstructs arrays using the fitted patterns; MNE metadata is used for channel extraction during fitting and transformation. This follows the iterative DSS formulation [1].References
Examples
>>> import numpy as np >>> from mne_denoise.dss import IterativeDSS >>> rng = np.random.default_rng(0) >>> data = rng.standard_normal((8, 2000)) >>> model = IterativeDSS( ... lambda source: source**3, n_components=2, rank=4, random_state=0 ... ) >>> sources = model.fit_transform(data)
- fit(X, *, callback=None, verbose: bool | str | int | None = None) IterativeDSS[source]#
Fit the iterative DSS filters.
- Parameters:
- Xmne.io.BaseRaw, mne.BaseEpochs, or ndarray
Training data in channel-first NumPy layout or an MNE container.
- callbackcallable or None, default=None
Synchronous fixed-point progress callback.
- verbosebool, str, int, or None, default=None
Logging level for this call.
- Returns:
- IterativeDSS
The fitted estimator.
- fit_transform(X, *, callback=None, verbose: bool | str | int | None = None) ndarray[source]#
Fit the estimator and return the extracted sources.
- Parameters:
- Xndarray
Channel-first data.
- callbackcallable or None, default=None
Synchronous progress callback for fitting.
- verbosebool, str, int, or None, default=None
Logging level for this call.
- Returns:
- ndarray
Extracted sources.
- get_normalized_patterns() ndarray[source]#
Return L2-normalized fitted spatial patterns.
- Returns:
- ndarray, shape (n_channels, n_components)
Normalized patterns.
- inverse_transform(sources: ndarray, *, verbose: bool | str | int | None = None) ndarray[source]#
Reconstruct sensor data from fitted sources.
- Parameters:
- sourcesndarray, shape (n_components, n_times) or (n_epochs, n_components, n_times)
Source data.
- verbosebool, str, int, or None, default=None
Logging level for this call.
- Returns:
- ndarray
Reconstructed sensor-space data.
- transform(X, *, verbose: bool | str | int | None = None) ndarray[source]#
Apply fitted filters and return source data.
- Parameters:
- Xmne.io.BaseRaw, mne.BaseEpochs, or ndarray
Data compatible with the fitted channel layout.
- verbosebool, str, int, or None, default=None
Logging level for this call.
- Returns:
- ndarray
Sources with continuous or epoch-preserving layout.