Browse code

using global variables now. correct nVoxels in Plot title

git-svn-id: https://svn.discofish.de/MATLAB/spmtoolbox/SVMCrossVal@120 83ab2cfd-5345-466c-8aeb-2b2739fb922d

Christoph Budziszewski authored on 28/01/2009 14:05:49
Showing 4 changed files
... ...
@@ -1,5 +1,6 @@
1 1
 function plotDecodePerformance(varargin)
2
-% plotDecodePerformance(timeline,decodePerformance,nClasses,rawData)
2
+
3
+global CROSSVAL_METHOD_DEF;
3 4
 
4 5
 PSTH_AXIS_MIN = -1;
5 6
 PSTH_AXIS_MAX = 1;
... ...
@@ -19,7 +20,7 @@ switch nargin
19 20
         SubjectID         = inputStruct.SubjectID;
20 21
         smoothed          = inputStruct.smoothed;
21 22
         PLOT_METHOD       = inputStruct.CROSSVAL_METHOD;
22
-        CROSSVAL_METHOD_DEF = inputStruct.CROSSVAL_METHOD_DEF;
23
+%         CROSSVAL_METHOD_DEF = inputStruct.CROSSVAL_METHOD_DEF;
23 24
 
24 25
     otherwise
25 26
         error('spmtoolbox:SVMCrossVal:plotDecodePerformance:WrongArgument','Wrong Arguments');
... ...
@@ -74,9 +75,23 @@ end
74 75
     
75 76
     hold off;
76 77
     
77
-    nvoxel = size(psth,2);
78
+    nSubjects = size(SubjectID,2);
79
+    nVoxelPerSubject = size(psth,2)/size(SubjectID,2);
80
+    
81
+    if strcmp(smoothed,'yes')
82
+        smoothedString = 'using smoothed data';
83
+    else
84
+        smoothedString = 'using unsmoothed data';
85
+    end
86
+    
87
+    if nSubjects == 1
88
+        subjectName = cell2Mat(SubjectID);
89
+        title = sprintf('Subject %s, over %g voxel, %s',subjectName,nVoxelPerSubject,smoothedString);
90
+    else
91
+        title = sprintf('%g Subjects, %g Voxel per Subject, %s',nSubjects,nVoxelPerSubject,smoothedString);
92
+    end
93
+    
78 94
 
79
-    title = sprintf('Subject %s, over %g voxel, smoothed %s',SubjectID,nvoxel,smoothed);
80 95
     set(f,'Name',title);
81 96
     display(sprintf('%s',title));
82 97
 
... ...
@@ -1,9 +1,11 @@
1 1
 % function [decodePerformance rawTimecourse ] = calculateDecodePerformance(des,timeLineStart, timeLineEnd, decodeDuration, svmargs, conditionList, sessionList, voxelList, classList, labelMap,normalize)
2 2
 function outputStruct = calculateDecodePerformance(inputStruct,SubjectID)
3 3
 
4
+global CROSSVAL_METHOD_DEF;
5
+
4 6
 addpath 'libsvm-mat-2.88-1';
5 7
 
6
-CROSSVAL_METHOD_DEF = inputStruct.CROSSVAL_METHOD_DEF;
8
+% CROSSVAL_METHOD_DEF = inputStruct.CROSSVAL_METHOD_DEF;
7 9
 METHOD              = inputStruct.CROSSVAL_METHOD;
8 10
 
9 11
 RANDOMIZE_DATAPOINTS = inputStruct.RANDOMIZE;
... ...
@@ -1,9 +1,6 @@
1 1
 function classify(varargin)
2 2
 
3
-CROSSVAL_METHOD_DEF.svmcrossval       = 'svm crossval';
4
-CROSSVAL_METHOD_DEF.classPerformance  = 'svm class performance';
5
-CROSSVAL_METHOD_DEF.crossSubject      = 'svm cross subject testing';
6
-CROSSVAL_METHOD_DEF.somTraining       = 'som Training';
3
+global CROSSVAL_METHOD_DEF;
7 4
 
8 5
 switch nargin
9 6
     case 1
... ...
@@ -18,7 +15,7 @@ end
18 15
         % common params
19 16
         calculateParams  = struct;
20 17
         
21
-        calculateParams.CROSSVAL_METHOD_DEF = CROSSVAL_METHOD_DEF;
18
+%         calculateParams.CROSSVAL_METHOD_DEF = CROSSVAL_METHOD_DEF;
22 19
         calculateParams.CROSSVAL_METHOD     = CROSSVAL_METHOD_DEF.svmcrossval;
23 20
         
24 21
         calculateParams.RANDOMIZE       = 0;
... ...
@@ -83,7 +80,7 @@ end
83 80
 
84 81
         plotParams                   = struct;
85 82
         
86
-        plotParams.CROSSVAL_METHOD_DEF = CROSSVAL_METHOD_DEF;
83
+%         plotParams.CROSSVAL_METHOD_DEF = CROSSVAL_METHOD_DEF;
87 84
         plotParams.CROSSVAL_METHOD     = calculateParams.CROSSVAL_METHOD;
88 85
         
89 86
         plotParams.psthStart         = calculateParams.psthStart;
... ...
@@ -95,11 +92,11 @@ end
95 92
         plotParams.decodePerformance = decode.decodePerformance;
96 93
         plotParams.rawTimeCourse     = decode.rawTimeCourse;
97 94
         
98
-        if numel(subjectSelection) == 1
99
-          plotParams.SubjectID         = SubjectID;
100
-        else
101
-          plotParams.SubjectID         = 'Multiple';
102
-        end
95
+%         if numel(subjectSelection) == 1
96
+%           plotParams.SubjectID         = SubjectID;
97
+%         else
98
+          plotParams.SubjectID         = subjectSelection;
99
+%         end
103 100
 
104 101
         plotParams.smoothed          = boolToYesNoString(calculateParams.smoothed);
105 102
 
... ...
@@ -1,4 +1,13 @@
1 1
 function spm_SVMCrossVal(varargin)
2
+
3
+%define global constants
4
+global CROSSVAL_METHOD_DEF;
5
+
6
+CROSSVAL_METHOD_DEF.svmcrossval       = 'svm crossval';
7
+CROSSVAL_METHOD_DEF.classPerformance  = 'svm class performance';
8
+CROSSVAL_METHOD_DEF.crossSubject      = 'svm cross subject testing';
9
+CROSSVAL_METHOD_DEF.somTraining       = 'som Training';
10
+
2 11
 switch nargin
3 12
 case 0
4 13
 % 	project_UI;