-
Notifications
You must be signed in to change notification settings - Fork 0
EEG_2: Feature Extraction
Two separate feature extractions were carried out - one directly from the dataset files on MATLAB and the other from functional connectivity matrices extracted from the EEG data. Both of these have been outlined below.
-
Various graph features were extracted from the functional connectivity matrices, ie, Degree Centrality, Betweenness Centrality and Eigenvector centrality.
-
This was done for graphs made from 17 different 31 x 31 connectivity matrices, corresponding to the 17 bands, where 31 is the number of channels.
-
To access the notebook (with a step-by-step explanation), go to the filepath 'codes/fconn_feature_extract.ipynb'.
Various features were extracted from the data, such as amplitude domain features and spectral domain features. Before this, the preprocessed data is divided into epochs.
-
To access the epoching code, go to the filepath 'codes/divide_epochs.m'.
-
Here, the data is divided into 10 epochs with a 50% overlap, each 60s in length.
-
To access the code, go to the filepath 'codes/extract_features.m'.
-
The code contains all the feature extractions combined into a single set of code.
-
First, epoched data is imported. Then, the data is divided into 5 frequency bands (alpha, beta, gamma, theta and delta).
% deltaBand = [0.5, 4];
% thetaBand = [4, 8];
% alphaBand = [8, 14];
% betaBand = [14, 30];
% gammaBand = [30, Inf];
-
Next, the envelope is computed using the Hilbert transform, and amplitude features such as mean, median, mode, standard deviation, kurtosis and skewness are computed.
-
Next, the Power Spectral Density (PSD) is computed, and attributes totalPower, meanPower and edgeFreq are computed.
totalPower = sum(psd);
meanPower = totalPower/(top-arr(b)); % arr(b+1) - arr(b) is the frequency range
totalPower = mean(totalPower);
meanPower = mean(meanPower);
cumulativePower = cumsum(psd);
edgeFreqIdx = find(cumulativePower >= 0.95*totalPower, 1);
edgeFreq = (edgeFreqIdx - 1)*(top-arr(b))/500;
- Finally, relative powers of various combinations of bands are computed into a separate tensor, such as theta/alpha, beta/alpha and so on.
relPowFeatures(ch, 1) = thetaPower / alphaPower;
relPowFeatures(ch, 2) = betaPower / alphaPower;
relPowFeatures(ch, 3) = (thetaPower + alphaPower) / betaPower;
relPowFeatures(ch, 4) = thetaPower / betaPower;
relPowFeatures(ch, 5) = (thetaPower + alphaPower) / (alphaPower + betaPower);
relPowFeatures(ch, 6) = gammaPower / deltaPower;
relPowFeatures(ch, 7) = (gammaPower + betaPower) / (deltaPower + alphaPower);
-
All features are exported into the relevant folders (amp, psd, relPow).
-
The feature extraction was run on the first 152 subjects as well. This can be accessed on the lab server, in the path '/space_lin2/nikhil/exports'.