Browse code

Classes must reside in Main Dir!

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

Christoph Budziszewski authored on18/03/2009 14:58:00
Showing1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,73 @@
1
+function map = LabelMap(varargin)
2
+%LabelMap(labelCellList,valueCellList) maps Label to Classvalues suitable for
3
+%SVM
4
+
5
+switch nargin
6
+    case 2
7
+        condition = varargin{2};
8
+        label     = varargin{1};
9
+        svmvalue  = 'auto';
10
+    case 3
11
+        condition = varargin{2};
12
+        label     = varargin{1};
13
+        svmvalue  = varargin{3};
14
+    otherwise
15
+        error('LabelMap:Constructor:wrongArgs','Wrong Arguments!');
16
+end
17
+
18
+
19
+%         if ~ (iscell(label) && iscell(condition))
20
+%             error('LabelMap:Constructor:argsNoCell','Arguments have to be CellArrays. Vectors not yet supported. sorry.');
21
+%         end
22
+%         if(any(size(label) ~= size(value)))
23
+%             error('LabelMap:Constructor:sizeDontMatch','Label List and Value List must be the same size!');
24
+%         end
25
+
26
+        map.ConditionToLabel = java.util.HashMap;
27
+        map.LabelToCondition = java.util.HashMap;
28
+        map.LabelToValue     = java.util.HashMap;
29
+        map.ValueToLabel     = java.util.HashMap;
30
+        
31
+        
32
+        % condition: {[a,b,c],[d,e,f],...}
33
+        
34
+        for conditionGroupCellID = 1:numel(condition) % cells
35
+            conditionGroupVector = condition{conditionGroupCellID};
36
+
37
+            for conditionID = 1:size(conditionGroupVector,2)
38
+               conditionLabel = cell2mat(label(conditionGroupCellID));
39
+               
40
+               map.ConditionToLabel.put(conditionGroupVector(conditionID),conditionLabel);
41
+               if ~map.LabelToCondition.containsKey(conditionLabel)
42
+                   conditionset = java.util.HashSet;
43
+                   map.LabelToCondition.put(conditionLabel,conditionset);
44
+               end
45
+              map.LabelToCondition.get(conditionLabel).add(conditionGroupVector(conditionID));
46
+           end
47
+        end
48
+        
49
+        for labelid = 1:numel(label)
50
+            if map.LabelToValue.containsKey(label)
51
+                continue;
52
+            end
53
+            
54
+            if ~iscell(svmvalue) || strcmp(cell2mat(svmvalue),'auto')
55
+               map.LabelToValue.put(cell2mat(label(labelid)),labelid);
56
+               map.ValueToLabel.put(labelid,cell2mat(label(labelid)));
57
+            else
58
+               map.LabelToValue.put(cell2mat(label(labelid)),cell2mat(svmvalue(labelid)));
59
+               map.ValueToLabel.put(cell2mat(svmvalue(labelid)),cell2mat(label(labelid)));
60
+            end    
61
+        end
62
+
63
+        
64
+
65
+%         for i = 1:max(size(label)) % cell array is 1:x or x:1, indexing is same
66
+%             map.labelToValue.put(label{i},value{i});
67
+%             map.valueToLabel.put(value{i},label{i});
68
+%         end
69
+
70
+        map = class(map,'LabelMap');
71
+
72
+
73
+end
Browse code

moved stuff, fixing plotDecode

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

Christoph Budziszewski authored on16/03/2009 14:41:06
Showing1 changed files
1 1
deleted file mode 100644
... ...
@@ -1,73 +0,0 @@
1
-function map = LabelMap(varargin)
2
-%LabelMap(labelCellList,valueCellList) maps Label to Classvalues suitable for
3
-%SVM
4
-
5
-switch nargin
6
-    case 2
7
-        condition = varargin{2};
8
-        label     = varargin{1};
9
-        svmvalue  = 'auto';
10
-    case 3
11
-        condition = varargin{2};
12
-        label     = varargin{1};
13
-        svmvalue  = varargin{3};
14
-    otherwise
15
-        error('LabelMap:Constructor:wrongArgs','Wrong Arguments!');
16
-end
17
-
18
-
19
-%         if ~ (iscell(label) && iscell(condition))
20
-%             error('LabelMap:Constructor:argsNoCell','Arguments have to be CellArrays. Vectors not yet supported. sorry.');
21
-%         end
22
-%         if(any(size(label) ~= size(value)))
23
-%             error('LabelMap:Constructor:sizeDontMatch','Label List and Value List must be the same size!');
24
-%         end
25
-
26
-        map.ConditionToLabel = java.util.HashMap;
27
-        map.LabelToCondition = java.util.HashMap;
28
-        map.LabelToValue     = java.util.HashMap;
29
-        map.ValueToLabel     = java.util.HashMap;
30
-        
31
-        
32
-        % condition: {[a,b,c],[d,e,f],...}
33
-        
34
-        for conditionGroupCellID = 1:numel(condition) % cells
35
-            conditionGroupVector = condition{conditionGroupCellID};
36
-
37
-            for conditionID = 1:size(conditionGroupVector,2)
38
-               conditionLabel = cell2mat(label(conditionGroupCellID));
39
-               
40
-               map.ConditionToLabel.put(conditionGroupVector(conditionID),conditionLabel);
41
-               if ~map.LabelToCondition.containsKey(conditionLabel)
42
-                   conditionset = java.util.HashSet;
43
-                   map.LabelToCondition.put(conditionLabel,conditionset);
44
-               end
45
-              map.LabelToCondition.get(conditionLabel).add(conditionGroupVector(conditionID));
46
-           end
47
-        end
48
-        
49
-        for labelid = 1:numel(label)
50
-            if map.LabelToValue.containsKey(label)
51
-                continue;
52
-            end
53
-            
54
-            if ~iscell(svmvalue) || strcmp(cell2mat(svmvalue),'auto')
55
-               map.LabelToValue.put(cell2mat(label(labelid)),labelid);
56
-               map.ValueToLabel.put(labelid,cell2mat(label(labelid)));
57
-            else
58
-               map.LabelToValue.put(cell2mat(label(labelid)),cell2mat(svmvalue(labelid)));
59
-               map.ValueToLabel.put(cell2mat(svmvalue(labelid)),cell2mat(label(labelid)));
60
-            end    
61
-        end
62
-
63
-        
64
-
65
-%         for i = 1:max(size(label)) % cell array is 1:x or x:1, indexing is same
66
-%             map.labelToValue.put(label{i},value{i});
67
-%             map.valueToLabel.put(value{i},label{i});
68
-%         end
69
-
70
-        map = class(map,'LabelMap');
71
-
72
-
73
-end
Browse code

new LabelMap new svm grouping method

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

Christoph Budziszewski authored on07/01/2009 18:26:33
Showing1 changed files
... ...
@@ -1,26 +1,73 @@
1
-function map = LabelMap(label,value)
1
+function map = LabelMap(varargin)
2 2
 %LabelMap(labelCellList,valueCellList) maps Label to Classvalues suitable for
3 3
 %SVM
4 4
 
5
-if nargin == 2
6
-    if ~ (iscell(label) && iscell(value))
7
-        error('LabelMap:Constructor:argsNoCell','Arguments have to be CellArrays. Vectors not yet supported. sorry.');
8
-    end   
9
-    if(any(size(label) ~= size(value)))
10
-        error('LabelMap:Constructor:sizeDontMatch','Label List and Value List must be the same size!');
11
-    end
12
-    
13
-    map.labelToValue = java.util.HashMap;
14
-    map.valueToLabel = java.util.HashMap;
15
-    
16
-    for i = 1:max(size(label)) % cell array is 1:x or x:1, indexing is same
17
-       map.labelToValue.put(label{i},value{i}); 
18
-       map.valueToLabel.put(value{i},label{i});
19
-    end
20
-    
21
-    map = class(map,'LabelMap');
22
-else
23
-    error('LabelMap:Constructor:noArgs','Sorry, default constructor not supported yet!');
5
+switch nargin
6
+    case 2
7
+        condition = varargin{2};
8
+        label     = varargin{1};
9
+        svmvalue  = 'auto';
10
+    case 3
11
+        condition = varargin{2};
12
+        label     = varargin{1};
13
+        svmvalue  = varargin{3};
14
+    otherwise
15
+        error('LabelMap:Constructor:wrongArgs','Wrong Arguments!');
24 16
 end
25 17
 
26
-end
27 18
\ No newline at end of file
19
+
20
+%         if ~ (iscell(label) && iscell(condition))
21
+%             error('LabelMap:Constructor:argsNoCell','Arguments have to be CellArrays. Vectors not yet supported. sorry.');
22
+%         end
23
+%         if(any(size(label) ~= size(value)))
24
+%             error('LabelMap:Constructor:sizeDontMatch','Label List and Value List must be the same size!');
25
+%         end
26
+
27
+        map.ConditionToLabel = java.util.HashMap;
28
+        map.LabelToCondition = java.util.HashMap;
29
+        map.LabelToValue     = java.util.HashMap;
30
+        map.ValueToLabel     = java.util.HashMap;
31
+        
32
+        
33
+        % condition: {[a,b,c],[d,e,f],...}
34
+        
35
+        for conditionGroupCellID = 1:numel(condition) % cells
36
+            conditionGroupVector = condition{conditionGroupCellID};
37
+
38
+            for conditionID = 1:size(conditionGroupVector,2)
39
+               conditionLabel = cell2mat(label(conditionGroupCellID));
40
+               
41
+               map.ConditionToLabel.put(conditionGroupVector(conditionID),conditionLabel);
42
+               if ~map.LabelToCondition.containsKey(conditionLabel)
43
+                   conditionset = java.util.HashSet;
44
+                   map.LabelToCondition.put(conditionLabel,conditionset);
45
+               end
46
+              map.LabelToCondition.get(conditionLabel).add(conditionGroupVector(conditionID));
47
+           end
48
+        end
49
+        
50
+        for labelid = 1:numel(label)
51
+            if map.LabelToValue.containsKey(label)
52
+                continue;
53
+            end
54
+            
55
+            if ~iscell(svmvalue) || strcmp(cell2mat(svmvalue),'auto')
56
+               map.LabelToValue.put(cell2mat(label(labelid)),labelid);
57
+               map.ValueToLabel.put(labelid,cell2mat(label(labelid)));
58
+            else
59
+               map.LabelToValue.put(cell2mat(label(labelid)),cell2mat(svmvalue(labelid)));
60
+               map.ValueToLabel.put(cell2mat(svmvalue(labelid)),cell2mat(label(labelid)));
61
+            end    
62
+        end
63
+
64
+        
65
+
66
+%         for i = 1:max(size(label)) % cell array is 1:x or x:1, indexing is same
67
+%             map.labelToValue.put(label{i},value{i});
68
+%             map.valueToLabel.put(value{i},label{i});
69
+%         end
70
+
71
+        map = class(map,'LabelMap');
72
+
73
+
74
+end
Browse code

SVMCrossVal toolbox init

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

Christoph Budziszewski authored on17/12/2008 13:45:29
Showing1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,26 @@
1
+function map = LabelMap(label,value)
2
+%LabelMap(labelCellList,valueCellList) maps Label to Classvalues suitable for
3
+%SVM
4
+
5
+if nargin == 2
6
+    if ~ (iscell(label) && iscell(value))
7
+        error('LabelMap:Constructor:argsNoCell','Arguments have to be CellArrays. Vectors not yet supported. sorry.');
8
+    end   
9
+    if(any(size(label) ~= size(value)))
10
+        error('LabelMap:Constructor:sizeDontMatch','Label List and Value List must be the same size!');
11
+    end
12
+    
13
+    map.labelToValue = java.util.HashMap;
14
+    map.valueToLabel = java.util.HashMap;
15
+    
16
+    for i = 1:max(size(label)) % cell array is 1:x or x:1, indexing is same
17
+       map.labelToValue.put(label{i},value{i}); 
18
+       map.valueToLabel.put(value{i},label{i});
19
+    end
20
+    
21
+    map = class(map,'LabelMap');
22
+else
23
+    error('LabelMap:Constructor:noArgs','Sorry, default constructor not supported yet!');
24
+end
25
+
26
+end
0 27
\ No newline at end of file