TEAP (Toolbox for Emotion Analysis using Physiological Signals) doc
extracting_features_DEAP.m
Go to the documentation of this file.
1 %extracting features from DEAP database
2 %path where the mat files are stored
3 %You need to go to http://www.eecs.qmul.ac.uk/mmv/datasets/deap/ to get the data
4 %You should download the mat files and the ratings and set the correct path
5 clear;clc;
6 TEAP_path = fileparts(pwd);
7 curr_path = cd;
8 eval(['cd ' TEAP_path]);
9 init
10 eval(['cd ' curr_path]);
11 %replace the following line by where your phsyio data is located
12 physio_path = 'DEAP/physio_data/';
13 %replcae the following path with your local path of the ratings
14 feedbacks = readtable('DEAP/metadata/participant_ratings.csv');
15 if ~exist([physio_path '/s30_eeglab.mat'],'file')
16  loading_DEAP(physio_path);
17 end
18 for subject=1:32
19  eeglab_file = sprintf('%ss%0.2d_eeglab.mat',physio_path,subject);
20  %loading the file
21  bulk = Bulk_load(eeglab_file);
22  %exracting EMG feaures
23  %TODO extract by subject by epoch
24  for epoch = 1:40
25  [features(subject,epoch).EMG_feats, features(subject,epoch).EMG_feats_names] = ...
26  EMG_feat_extr(bulk(epoch));
27  %extracting EEG features
28  [features(subject,epoch).EEG_feats, features(subject,epoch).EEG_feats_names] = ...
29  EEG_feat_extr(bulk(epoch));
30  %extracting GSR features
31  [features(subject,epoch).GSR_feats, features(subject,epoch).GSR_feats_names] = ...
32  GSR_feat_extr(bulk(epoch));
33  %extracting BVP features
34  [features(subject,epoch).BVP_feats, features(subject,epoch).BVP_feats_names] = ...
35  BVP_feat_extr(bulk(epoch));
36  %extracting skin temperature features
37  % we skip this since there appear to be problems with the HST
38  % signal in the mat files - they are incorrect
39  %[features(subject,epoch).HST_feats, features(subject,epoch).HST_feats_names] = ...
40  % HST_feat_extr(bulk(epoch));
41  %extracting respiration features
42  [features(subject,epoch).RES_feats, features(subject,epoch).RES_feats_names] = ...
43  RES_feat_extr(bulk(epoch));
44  feedback = feedbacks(feedbacks.Participant_id==subject & feedbacks.Experiment_id==epoch,:);
45  features(subject,epoch).feedback.felt_arousal = feedback.Arousal;
46  features(subject,epoch).feedback.felt_valence = feedback.Valence;
47  features(subject,epoch).feedback.felt_dominance = feedback.Dominance;
48  features(subject,epoch).feedback.felt_liking = feedback.Liking;
49  features(subject,epoch).feedback.felt_familiarity = feedback.Familiarity;
50  fprintf('extracted all the features for subject %d epoch %d\n',subject, epoch);
51  end
52 end
53 
54 
55 %we store the features in the same path where the signals were
56 save([physio_path 'deap_features.mat'],'features');
57 
58 
59 fprintf('Done! Successfully extracted the feaures\n');
RES_feat_extr
function RES_feat_extr(in RESsignal, in varargin)
HST_feat_extr
function HST_feat_extr(in HSTsignal, in varargin)
Bulk_load
function Bulk_load(in file_name)
loading_DEAP
function loading_DEAP(in physio_files_path)
EMG_feat_extr
function EMG_feat_extr(in EMGsignal, in varargin)
WARNING: this function will give 'strange' results when applied on a relative signal
GSR_feat_extr
function GSR_feat_extr(in GSRsignal, in varargin)
EEG_feat_extr
function EEG_feat_extr(in EEGsignal, in varargin)
BVP_feat_extr
function BVP_feat_extr(in BVPSignal, in varargin)