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.

fit learns the channel mean and one or more fixed channel-space operators; transform applies 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_len set, the fitted operator is piecewise in time: block k is applied to the samples block k was learned on. transform therefore requires input with the same number of samples as fit saw.

Parameters:
  • lag_samples (int | None, default=None) – Positive lag in samples. None uses the paper’s value of 1 unless lag_seconds is 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_remove or rho_threshold is required.

  • segment_len (float | None, default=None) – Block length in seconds. None learns one operator for all data.

  • overlap (float, default=0.0) – Fraction of segment_len shared 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_len is 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,)

kept_mask_#

Components retained in the reconstruction.

Type:

ndarray of bool, 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:

int

n_kept_, n_removed_

Component counts.

Type:

int

n_channels_in_#

Channels seen during fit.

Type:

int

feature_names_in_#

Channel names when fitted on an MNE object.

Type:

tuple of str | None

See also

compute_bss_cca

Canonical 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 X and apply the fitted operators to X.

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.