-
Notifications
You must be signed in to change notification settings - Fork 37
/
exampleERRPSSVEPDemo.m
46 lines (36 loc) · 1.17 KB
/
exampleERRPSSVEPDemo.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
% d2 = designfilt('bandpassiir', 'SampleRate', 256, 'FilterOrder', 8 ,'HalfPowerFrequency1', 1, 'HalfPowerFrequency2', 10,'DesignMethod', 'butter');
sess = eegtoolkit.util.Session;
sess.loadSubjectSession(8,5,2);
[z,p,k]=butter(3,[1,10]/64);
[s,g]=zp2sos(z,p,k);
Hd = dfilt.df2sos(s,g);
df = eegtoolkit.preprocessing.DigitalFilter; %
df.filt = Hd;
ss = eegtoolkit.preprocessing.SampleSelection;
ss.channels = [1:14];
ss.sampleRange = [1:6:200];
extr = {};
for i=1:3
extr{i} = eegtoolkit.featextraction.PWelch;
extr{i}.channel = 1;
end
aggr = eegtoolkit.aggregation.ChannelConcat;
classif = eegtoolkit.classification.LIBSVM;
classif.kernel = classif.KERNEL_RBF;
classif.gamma = 1/9;
classif.cost = 1;
%Setup experiment
experiment = eegtoolkit.experiment.Experimenter;
experiment.session = sess;
experiment.preprocessing = {df,ss};
experiment.featextraction = extr;
experiment.aggregator = aggr;
experiment.classification = classif;
experiment.evalMethod = experiment.EVAL_METHOD_XFOLD_CV;
experiment.run(10);
accuracies = [];
for i=1:length(experiment.results)
accuracies(i) = experiment.results{i}.getAccuracy();
end
accuracies'
fprintf('mean acc = %.2f\n',mean(accuracies));