6985c69e8d9d17871756db748c1f69df79f2efa4
Christoph Budziszewski gui layout finished

Christoph Budziszewski authored 15 years ago

1) function classify(varargin)
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

2) 
Christoph Budziszewski new LabelMap new svm groupi...

Christoph Budziszewski authored 15 years ago

3) 
Christoph Budziszewski multi-subject support

Christoph Budziszewski authored 15 years ago

4) 
Christoph Budziszewski gui layout finished

Christoph Budziszewski authored 15 years ago

5) switch nargin
6)     case 1
7)         paramModel = varargin{1};
Christoph Budziszewski new LabelMap new svm groupi...

Christoph Budziszewski authored 15 years ago

8)         % PROJECT_BASE_PATH = 'D:\Analyze\Stimolos';
9)         PROJECT_BASE_PATH = 'D:\Analyze\Choice\24pilot';
10)         PROJECT_RESULT_PATH = 'results\SPM.mat';
Christoph Budziszewski gui layout finished

Christoph Budziszewski authored 15 years ago

11)     otherwise
12)         error('spmtoolbox:SVMCrossVal:arginError','Please Specify action and parameter model');
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

13) end
14) 
Christoph Budziszewski GUI parsing halfway done.

Christoph Budziszewski authored 15 years ago

15)         
Christoph Budziszewski multi-subject support

Christoph Budziszewski authored 15 years ago

16)         % common params
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

17)         calculateParams  = struct;
Christoph Budziszewski killed unnecessary assignin...

Christoph Budziszewski authored 15 years ago

18)         calculateParams.smoothed        = getDouble(paramModel.txtSmoothed);
Christoph Budziszewski multi-subject support

Christoph Budziszewski authored 15 years ago

19) 
Christoph Budziszewski GUI parsing halfway done.

Christoph Budziszewski authored 15 years ago

20)         calculateParams.frameShiftStart = getDouble(paramModel.txtFrameShiftStart);  % -20;
21)         calculateParams.frameShiftEnd   = getDouble(paramModel.txtFrameShiftEnd); %15;
22)         calculateParams.decodeDuration  = getDouble(paramModel.txtFrameShiftDur);
23)         calculateParams.psthStart       = getDouble(paramModel.txtPSTHStart); % -25;
24)         calculateParams.psthEnd         = getDouble(paramModel.txtPSTHEnd); % 20;
25)         calculateParams.baselineStart   = getDouble(paramModel.txtBaselineStart); % -22;
26)         calculateParams.baselineEnd     = getDouble(paramModel.txtBaselineEnd); % -20;
27) 
28)         calculateParams.svmargs         = get(paramModel.txtSVMopts,'String');
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

29)         calculateParams.sessionList     = 1:3;
Christoph Budziszewski GUI parsing halfway done.

Christoph Budziszewski authored 15 years ago

30) 
Christoph Budziszewski class def parsing added str...

Christoph Budziszewski authored 15 years ago

31)         classStruct = parseClassDef(paramModel);
32)         
33)         
Christoph Budziszewski new LabelMap new svm groupi...

Christoph Budziszewski authored 15 years ago

34)         calculateParams.labelMap        = LabelMap(classStruct.labelCells , classStruct.conditionCells, 'auto'); % LabelMap({'<','>','<+<','>+>','<+>','>+<'},{-2,-1,1,2,3,4}); 0 is autolabel
35)         calculateParams.classList       = getClasses(calculateParams.labelMap);
36)         calculateParams.eventList       = classStruct.eventMatrix; %[9,11,13; 10,12,14];
37) %         calculateParams.eventList       = getPSTEventMatrix(calculateParams.labelMap);
38)         
39) %         params = struct;
40) %         params.nClasses = 2;
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

41)         
Christoph Budziszewski multi-subject support

Christoph Budziszewski authored 15 years ago

42)         subjectSelection = getSubjectIDString(paramModel);
43)         decode = struct;
44)         decode.decodePerformance = [];
45)         decode.rawTimeCourse     = [];
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

46)         
Christoph Budziszewski multi-subject support

Christoph Budziszewski authored 15 years ago

47)         for subjectCell = subjectSelection
48)             SubjectID = cell2mat(subjectCell);
Christoph Budziszewski new LabelMap new svm groupi...

Christoph Budziszewski authored 15 years ago

49)             namehelper = strcat('s',SubjectID); %Vars can not start with numbers.
Christoph Budziszewski multi-subject support

Christoph Budziszewski authored 15 years ago

50) 
Christoph Budziszewski new LabelMap new svm groupi...

Christoph Budziszewski authored 15 years ago

51)             display('loading SPM.mat ...');
Christoph Budziszewski multi-subject support

Christoph Budziszewski authored 15 years ago

52)             spm = load(fullfile(PROJECT_BASE_PATH,SubjectID,PROJECT_RESULT_PATH));
Christoph Budziszewski new LabelMap new svm groupi...

Christoph Budziszewski authored 15 years ago

53)             display('... done.');
Christoph Budziszewski multi-subject support

Christoph Budziszewski authored 15 years ago

54) 
55)             %% calculate
Christoph Budziszewski new LabelMap new svm groupi...

Christoph Budziszewski authored 15 years ago

56)             display(sprintf('calculating cross-validation performance time-shift for Subject %s. Please Wait. ...',SubjectID));
Christoph Budziszewski New5 Studie, Var-Name erset...

Christoph Budziszewski authored 15 years ago

57)             calculateParams.(namehelper).des             = spm.SPM;
58)             calculateParams.(namehelper).voxelList       = parseVoxelList(paramModel,SubjectID);
Christoph Budziszewski multi-subject support

Christoph Budziszewski authored 15 years ago

59)             
60)             assignin('base','calculateParams',calculateParams);
61)             
62)     %         [decodeTable rawTimeCourse] = calculateDecodePerformance(spm,params.frameShiftStart,params.frameShiftEnd,params.xTimeWindow,params.svmopts,1:4,params.sessionList,params.voxelList,params.classList,params.labelMap,params.normalize);
63)             display('switching off all warnings');
64)             warning_state = warning('off','all');
Christoph Budziszewski new LabelMap new svm groupi...

Christoph Budziszewski authored 15 years ago

65)             display('calculating ...');
Christoph Budziszewski New5 Studie, Var-Name erset...

Christoph Budziszewski authored 15 years ago

66)             decode.(namehelper) = calculateDecodePerformance(calculateParams,SubjectID);
Christoph Budziszewski new LabelMap new svm groupi...

Christoph Budziszewski authored 15 years ago

67)             display('... done');
Christoph Budziszewski multi-subject support

Christoph Budziszewski authored 15 years ago

68)             display('restoring warnings');
69)             warning(warning_state);
70)             
Christoph Budziszewski New5 Studie, Var-Name erset...

Christoph Budziszewski authored 15 years ago

71)             decode.decodePerformance = [decode.decodePerformance decode.(namehelper).decodePerformance];
72)             decode.rawTimeCourse = [decode.rawTimeCourse decode.(namehelper).rawTimeCourse];
Christoph Budziszewski multi-subject support

Christoph Budziszewski authored 15 years ago

73)   
74)             
75) %             display(sprintf('Min CrossVal Accuracy: %g%% \t Max CrossVal Accuracy: %g%%',decode.minPerformance,decode.maxPerformance));
76) 
77)             assignin('base','decode',decode);
78)         end
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

79) 
80)         display('Finished calculations.');
Christoph Budziszewski multi-subject support

Christoph Budziszewski authored 15 years ago

81)         display('Plotting...');
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

82) 
83)         plotParams = struct;
84)         plotParams.psthStart = calculateParams.psthStart;
85)         plotParams.psthEnd   = calculateParams.psthEnd;
86)         plotParams.nClasses  = length(calculateParams.classList);
Christoph Budziszewski multi-subject support

Christoph Budziszewski authored 15 years ago

87)         
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

88)         plotParams.frameShiftStart   = calculateParams.frameShiftStart;
89)         plotParams.frameShiftEnd     = calculateParams.frameShiftEnd;
90)         plotParams.decodePerformance = decode.decodePerformance;
91)         plotParams.rawTimeCourse     = decode.rawTimeCourse;
92)         
Christoph Budziszewski multi-subject support

Christoph Budziszewski authored 15 years ago

93)         if numel(subjectSelection) == 1
94)           plotParams.SubjectID         = SubjectID;
95)         else
96)           plotParams.SubjectID         = 'Multiple';
97)         end
98) 
99)         plotParams.smoothed          = boolToYesNoString(calculateParams.smoothed);
100)          
101) 
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

102)         assignin('base','plotParams',plotParams);
103) %         plotDecodePerformance(params.psthStart,params.psthEnd,params.nClasses,decode.decodeTable,params.frameShiftStart,params.frameShiftEnd,decode.rawTimeCourse);
104)         plotDecodePerformance(plotParams);
Christoph Budziszewski multi-subject support

Christoph Budziszewski authored 15 years ago

105)             
Christoph Budziszewski new LabelMap new svm groupi...

Christoph Budziszewski authored 15 years ago

106)         display('all done.');
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

107)