PearsonCorrelation¶
- class torcheeg.transforms.PearsonCorrelation(absolute: bool = False, apply_to_baseline: bool = False)[source][source]¶
A transform method to calculate the correlation coefficients between the EEG signals of different electrodes.
from torcheeg import transforms t = transforms.PearsonCorrelation() t(eeg=np.random.randn(32, 128))['eeg'].shape >>> (1, 32, 32)
- Parameters:
absolute (bool) – Whether to take the absolute value of the correlation coefficient. (default:
128
)apply_to_baseline – (bool): Whether to act on the baseline signal at the same time, if the baseline is passed in when calling. (default:
False
)
- __call__(*args, eeg: ndarray, baseline: ndarray | None = None, **kwargs) Dict[str, ndarray] [source][source]¶
- Parameters:
eeg (np.ndarray) – The input EEG signals in shape of [number of electrodes, number of data points].
baseline (np.ndarray, optional) – The corresponding baseline signal, if apply_to_baseline is set to True and baseline is passed, the baseline signal will be transformed with the same way as the experimental signal.
- Returns:
The correlation coefficients between EEG signals of different electrodes.
- Return type:
np.ndarray[number of electrodes, number of electrodes]