mne_denoise.bss_cca.BSSCCA#
- class mne_denoise.bss_cca.BSSCCA(*, lag_samples: int | None = None, lag_seconds: float | None = None, sfreq: float | None = None, n_remove: int | None = None, rho_threshold: float | None = None, segment_len: float | None = None, overlap: float = 0.0, preserve_mean: bool = True, verbose: bool | str | int | None = None)[source]#
Reference-free BSS-CCA artifact-attenuation estimator.
Implements the blind source separation by canonical correlation analysis of De Clercq et al. [1], solving CCA between the recording and a lagged copy of itself and dropping the lowest-correlation components in which muscle activity concentrates.
fitlearns the channel mean and one or more fixed channel-space operators;transformapplies them without refitting, so a sample gets the same result whether it is transformed alone, in a temporal chunk, or among other epochs.With
segment_lenset, the fitted operator is piecewise in time: blockkis applied to the samples blockkwas learned on.transformtherefore requires input with the same number of samples asfitsaw.- Parameters:
lag_samples (int | None, default=None) – Positive lag in samples.
Noneuses the paper’s value of1unlesslag_secondsis given.lag_seconds (float | None, default=None) – Positive lag in physical time. MNE inputs supply their own sampling frequency; NumPy inputs require
sfreq.sfreq (float | None, default=None) – Sampling frequency for NumPy data. A value supplied alongside an MNE input must agree with
info['sfreq'].n_remove (int | None, default=None) – Number of lowest-correlation components to remove.
rho_threshold (float | None, default=None) – Retain components whose canonical correlation is at least this value. Exactly one of
n_removeorrho_thresholdis required.segment_len (float | None, default=None) – Block length in seconds.
Nonelearns one operator for all data.overlap (float, default=0.0) – Fraction of
segment_lenshared between consecutive blocks.preserve_mean (bool, default=True) – Add the fitted channel mean back after cleaning.
verbose (bool | str | int | None, default=None) – MNE-style logging level.
- cleaning_matrix_#
Channel-space operator, applied to mean-centered data. A tuple of matrices when
segment_lenis set.- Type:
ndarray, shape (n_channels, n_channels)
- filters_#
Canonical filters, rows ordered by decreasing correlation.
- Type:
ndarray, shape (n_components, n_channels)
- patterns_#
Least-squares mixing matrix; columns are sensor patterns.
- Type:
ndarray, shape (n_channels, n_components)
- correlations_#
Non-negative canonical correlations in descending order.
- Type:
ndarray, shape (n_components,)
- autocorrelations_#
Signed lag-1 autocorrelation of each component.
- Type:
ndarray, shape (n_components,)
- filter_asymmetry_#
Distance between the two canonical filters of each component.
- Type:
ndarray, shape (n_components,)
- training_mean_#
Channel mean learned during
fit.- Type:
ndarray, shape (n_channels, 1)
- input_rank_#
Number of canonical components, below
n_channels_in_when the training data is rank deficient.- Type:
- n_kept_, n_removed_
Component counts.
- Type:
See also
compute_bss_ccaCanonical array implementation used by
fit.
References
[1]De Clercq, W., Vergult, A., Vanrumste, B., Van Paesschen, W., & Van Huffel, S. (2006). Canonical correlation analysis applied to remove muscle artifacts from the electroencephalogram. IEEE Transactions on Biomedical Engineering, 53(12), 2583-2587. https://doi.org/10.1109/TBME.2006.879459
- __init__(*, lag_samples: int | None = None, lag_seconds: float | None = None, sfreq: float | None = None, n_remove: int | None = None, rho_threshold: float | None = None, segment_len: float | None = None, overlap: float = 0.0, preserve_mean: bool = True, verbose: bool | str | int | None = None) None[source]#
Methods
__init__(*[, lag_samples, lag_seconds, ...])fit(X[, y])Learn the BSS-CCA operators.
fit_transform(X[, y])Fit on
Xand apply the fitted operators toX.get_metadata_routing()Get metadata routing of this object.
get_params([deep])Get parameters for this estimator.
set_output(*[, transform])Set output container.
set_params(**params)Set the parameters of this estimator.
transform(X[, y])Apply the fitted operators to new data.