-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathtrainModels.m
53 lines (36 loc) · 1.06 KB
/
trainModels.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
47
48
49
50
51
52
53
function [SVMg, RBTg] = trainModels(features, params)
%% General SVM
disp('Training all subjects SVM')
% Create CV object
cv = cvPart(features.fileLists, features.SSL, ...
params.cvParams);
% Create model object
params.modParams.type = 'SVM';
SVMg = seizureModel(params.modParams, cv);
% Train model
SVMg = SVMg.train(features.dataSet, [], 'General');
% Assess model
SVMg = SVMg.assessMod(features.dataSet);
% And plot if on
if params.modParams.plotOn
SVMg.plotAUCs('General model');
end
%% Increment seeds
params.cvParmas.seed = params.cvParmas.seed+100;
params.modParams.seed = params.modParams.seed+100;
%% General RBT
disp('Training all subjects RBT')
% Create cv object with new seed
cv = cvPart(features.fileLists, features.SSL, ...
params.cvParams);
% Create model object
params.modParams.type = 'RBT';
RBTg = seizureModel(params.modParams, cv);
% Train model
RBTg = RBTg.train(features.dataSet, [], 'General');
% Assess model
RBTg = RBTg.assessMod(features.dataSet);
% And plot if on
if params.modParams.plotOn
RBTg.plotAUCs('General model');
end