/
run.m
43 lines (29 loc) · 1.31 KB
/
run.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
function [best_options, roc_data] = run( folds, combinations, wr, options)
options.trainsize = folds(1);
data = struct();
[ idxTrain, idxVal, idxTest ] = divide_data( options );
fprintf(1,'Doing a %d-fold Cross Validation\n',options.nfolds);
fprintf(1,'Train size: %d\n',length(idxTrain));
data.idxTrain = idxTrain;
data.idxTest = idxTest;
data.idxVal = idxVal;
fprintf(1,'Training with %d instances.\n',length(idxTrain));
% ---------------------------------------------------------------------------------
global datafeatures
global dataclasses
switch( options.method )
% ---------------------------------------------------------------------------------
case {'threshold','weights'}
% 1,2,3,.. -> 1,3,5,...
dataclasses = (dataclasses-1)*2+1;
options.reduce_now = false;
options.nclasses = max(unique(dataclasses));
end
truedim = size (datafeatures, 2);
options = setfield(options, 'trueDim', truedim);
% ---------------------------------------------------------------------------------
% run models
fprintf(1,'(START) Time: %s\n',datestr(now,'HH:MM:SS'));
[ best_options, roc_data ] = ...
runModels1( folds, combinations, wr, options, data );
return