Browse code

New Normalization Methods in CalculatePST

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

Axel Lindner authored on09/01/2009 16:47:12
Showing3 changed files
... ...
@@ -69,6 +69,7 @@ maxPerformance = -inf;
69 69
             svmdata      = tmp(:,2:size(tmp,2));
70 70
             svmlabel     = tmp(:,1);
71 71
             
72
+%             RANDOMIZE INPUT
72 73
 %             rndindex  = randperm(length(svmlabel));
73 74
 %             svmdata   = svmdata(rndindex,:);
74 75
 %             svmlabel  = svmlabel(rndindex);
... ...
@@ -30,7 +30,7 @@ end
30 30
           for label = 1:size(psth{voxel},2)
31 31
               psthData = [];
32 32
               for timepoint = 1:size(psth{voxel}{label},2)
33
-                  psthData = nanmean(psth{voxel}{label}); % +voxel/100; % ???????????
33
+                  psthData = nanmean(psth{voxel}{label});
34 34
               end
35 35
               plot(psthStart:psthEnd,psthData,[colorChooser(voxel), lineStyleChooser(label)]);
36 36
           end
... ...
@@ -123,19 +123,32 @@ function pst = calculatePST(des,globalStart,baselineStart,baselineEnd,globalEnd,
123 123
     end;
124 124
     
125 125
     %%%%%%%%%%% new 090109 Axel: "Normalization" for SVM
126
+
127
+    norm4SVM='none'; %Normalization method for SVM
128
+    disp(['normalization: ' norm4SVM]);   
129
+    % none - no normalization
130
+    % mean - mean normalization (meanPSTH max at .5, baseline at -.5]
131
+    % minmax - all PSTHs between [0 1]
132
+    
133
+    for zr=1:evntrow
134
+          tmp_maxmean(zr)=max(nanmean(pst{zr}));
135
+          tmp_max(zr)=max(max(pst{zr}));
136
+          tmp_min(zr)=min(min(pst{zr}));
137
+    end;
126 138
     
127
-%     for zr=1:evntrow
128
-% %        tmp_max(zr)=max(nanmean(pst{zr}));
129
-%           tmp_max(zr)=max(max(pst{zr}));
130
-%           tmp_min(zr)=min(min(pst{zr}));
131
-%     end;
132
-% %    pstmax=max(tmp_max);
133
-% %    pstmin=min(tmp_min);
134
-%     pstmax=max(abs([tmp_max tmp_min]));
135
-%     for zr=1:evntrow
136
-%         pst{zr}=pst{zr}./pstmax-.5;
137
-% %        pst{zr}=(pst{zr}-pstmin)./(pstmax-pstmin);
138
-%     end;
139
+    pstmaxmean=max(tmp_maxmean);
140
+    pstmax=max(tmp_max);
141
+    pstmin=min(tmp_min);
142
+    
143
+    for zr=1:evntrow
144
+        switch norm4SVM
145
+            case {'none'}
146
+            case {'mean'}
147
+                pst{zr}=pst{zr}./pstmaxmean-.5;
148
+            case {'minmax'}
149
+                pst{zr}=(pst{zr}-pstmin)./(pstmax-pstmin);
150
+        end;
151
+    end;
139 152
     
140 153
     
141 154