b8f957c57897d977ceb737a92b997aef0781fed9
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 gui layout finished

Christoph Budziszewski authored 15 years ago

3) switch nargin
4)     case 0
5)         action = 'decode';
6)         SubjectID = 'JZ006';
7)     case 1
8)         action = 'decode';
9)         paramModel = varargin{1};
10)     otherwise
11)         error('spmtoolbox:SVMCrossVal:arginError','Please Specify action and parameter model');
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

12) end
13) 
Christoph Budziszewski gui layout finished

Christoph Budziszewski authored 15 years ago

14)     
15) 
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

16)     switch(action)
17)     case 'clear'
18)         evalin('base','clear map lm SPM classList dataTimeLine decodeTable labelTimeLine svmopts trialProtocol voxelList xTimeEnd xTimeStart xTimeWindow');
19)       
20)     case 'decode'
Christoph Budziszewski GUI parsing halfway done.

Christoph Budziszewski authored 15 years ago

21)         
22)         SubjectID = getSubjectIDString(paramModel);
23) 
Christoph Budziszewski gui layout finished

Christoph Budziszewski authored 15 years ago

24)         
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

25)         display('loading SPM.mat');
Christoph Budziszewski gui layout finished

Christoph Budziszewski authored 15 years ago

26) %         SubjectID = 'JZ006';
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

27) %         SubjectID = 'AI020';
28) %         SubjectID = 'HG027';
29)         spm = load(fullfile('D:\Analyze\Choice\24pilot',SubjectID,'results\SPM.mat'));
30) 
31)         display('done.');
Christoph Budziszewski GUI parsing halfway done.

Christoph Budziszewski authored 15 years ago

32)         
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

33)         
34)         
35)         params = struct;
36)         params.nClasses = 2;
37) 
38)         assignin('base','params',params);
39)         %% calculate
40)         display('calculating cross-validation performance time-shift');
41)         calculateParams  = struct;
42)         
43)         calculateParams.des             = spm.SPM;
Christoph Budziszewski GUI parsing halfway done.

Christoph Budziszewski authored 15 years ago

44)         
45)         calculateParams.frameShiftStart = getDouble(paramModel.txtFrameShiftStart);  % -20;
46)         calculateParams.frameShiftEnd   = getDouble(paramModel.txtFrameShiftEnd); %15;
47)         calculateParams.decodeDuration  = getDouble(paramModel.txtFrameShiftDur);
48)         calculateParams.psthStart       = getDouble(paramModel.txtPSTHStart); % -25;
49)         calculateParams.psthEnd         = getDouble(paramModel.txtPSTHEnd); % 20;
50)         calculateParams.baselineStart   = getDouble(paramModel.txtBaselineStart); % -22;
51)         calculateParams.baselineEnd     = getDouble(paramModel.txtBaselineEnd); % -20;
52) 
53)         calculateParams.voxelList = parseVoxelList(paramModel);
54) 
55)         calculateParams.svmargs         = get(paramModel.txtSVMopts,'String');
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

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

Christoph Budziszewski authored 15 years ago

57) 
58) %         parseClassDef(paramModel)
Christoph Budziszewski SVMCrossVal toolbox init

Christoph Budziszewski authored 15 years ago

59)         calculateParams.classList       = {'<','>'};
60)         calculateParams.labelMap        = LabelMap({'<','>','<+<','>+>','<+>','>+<'},{-2,-1,1,2,3,4});
61)         calculateParams.eventList       = [9,11,13; 10,12,14];
62)         
63)         assignin('base','calculateParams',calculateParams);
64)         
65) %         [decodeTable rawTimeCourse] = calculateDecodePerformance(spm,params.frameShiftStart,params.frameShiftEnd,params.xTimeWindow,params.svmopts,1:4,params.sessionList,params.voxelList,params.classList,params.labelMap,params.normalize);
66)         decode = calculateDecodePerformance(calculateParams);
67)         display(sprintf('Min CrossVal Accuracy: %g%% \t Max CrossVal Accuracy: %g%%',decode.minPerformance,decode.maxPerformance));
68)         
69)         assignin('base','decode',decode);
70) 
71)         display('Finished calculations.');
72)         display('Plotting.');
73) 
74)         plotParams = struct;
75)         plotParams.psthStart = calculateParams.psthStart;
76)         plotParams.psthEnd   = calculateParams.psthEnd;
77)         plotParams.nClasses  = length(calculateParams.classList);
78)         plotParams.frameShiftStart   = calculateParams.frameShiftStart;
79)         plotParams.frameShiftEnd     = calculateParams.frameShiftEnd;
80)         plotParams.decodePerformance = decode.decodePerformance;
81)         plotParams.rawTimeCourse     = decode.rawTimeCourse;
82)         plotParams.SubjectID         = SubjectID;
83)         
84)         assignin('base','plotParams',plotParams);
85) %         plotDecodePerformance(params.psthStart,params.psthEnd,params.nClasses,decode.decodeTable,params.frameShiftStart,params.frameShiftEnd,decode.rawTimeCourse);
86)         plotDecodePerformance(plotParams);
87) 
88)     otherwise
Christoph Budziszewski gui layout finished

Christoph Budziszewski authored 15 years ago

89)         display('give action command: clear decode');