mne-tools / mne-features

MNE-Features software for extracting features from multivariate time series
https://mne-tools.github.io/mne-features/
BSD 3-Clause "New" or "Revised" License
139 stars 32 forks source link

Add Empirical Mode Decomposition to features extraction functions #39

Open GuillaumeCorda opened 6 years ago

GuillaumeCorda commented 6 years ago

I think it would be nice to have the possibility to compute the intrinsic mode functions thanks to the Empirical Mode Decomposition method. It is highly efficient for analyzing nonlinear and non-stationary data such as EEG signals. This could be later integrated into a sub-module of mne-features containing all the functions allowing a signal decomposition.

jbschiratti commented 6 years ago

Thank you @GuillaumeCorda for opening this issue.

From what I understand, the number of IMF (intrinsic mode functions) obtained using the EMD algorithm is data-dependent, meaning that two consecutive epochs may have a different number of IMF. How would you address this problem? (i.e. which features would you extract from the IMFs?)

GuillaumeCorda commented 6 years ago

The EMD would be used as a first step. The IMFs obtained have a well behaved Hilbert transform that allows us to extract meaningful instantaneous frequencies. We could then compute the mean, variance etc. of those frequencies in order to do a classification task (seizure/non seizure for instance).

agramfort commented 6 years ago

so it's like a scikit-learn transformer that takes signals as input and output signals.

that could be a dedicated transformer object as first step in a pipeline

jbschiratti commented 6 years ago

Yes! AFAIK, the multivariate EMD takes as input as multivariate signal and outputs a certain number of signals called intrinsic mode functions (IMF), which have the same dimension as the input signal.

I'm wondering if it wouldn't be more relevant to use the EMD algorithm before epoching the signal. This way, the epoching and feature extraction could be performed on each IMF as well as on the raw data.

agramfort commented 6 years ago

I'm wondering if it wouldn't be more relevant to use the EMD algorithm before epoching the signal.

+1 otherwise you have edge artifacts

jbschiratti commented 6 years ago

Since the EMD should be applied before epoching, shouldn't it be considered for MNE rather than MNE-features? By design, MNE-features assumes that the data is already epoched.

agramfort commented 6 years ago

EMD in Python should already exist and we should use an existing package

jbschiratti commented 6 years ago

I agree!

@GuillaumeCorda Using existing implementations (or clean versions of these implementations) (Univariate/Bivariate EMD ; Multivariate EMD), you could write an example (to be put under mne_features/examples) showing how EMD and MNE-features can be efficiently combined. The example could be written using MNE sample data or the Bonn IEEG dataset (used in mne_features/examples/plot_seizure_example.py, see ref ).

pchholak commented 2 years ago

Indeed, EMD itself results in data-dependent IMFs that can be different in number and moreover, neighboring IMFs may have the same time-scale activity as the one contained in the others at some other time. However, if the goal is to get a time-frequency-energy plot after taking a Hilbert-Huang Transform (HHT), this does not matter because if one of the IMFs captures a particular activity localized in time, then the other IMFs won't. Therefore, if the end goal is to get the frequency response, it does not matter different IMFs are found for different data. At the end, all time-scales (or frequencies) are captured in all the IMFs put together which is the input to the HHT.

It would definitely be useful to have EMD-HHT inbuilt in MNE like other time-frequency plots as it is most suitable for non-stationary and nonlinear data such as M/EEG.