Dawn@4
|
1 function [ confusionMatrix ] = getConfusionMatrix( groupStats, groupNames,...
|
Dawn@4
|
2 masterFileOutputID, distanceMeasure )
|
Dawn@4
|
3
|
Dawn@4
|
4 groupNames = char(groupNames);
|
Dawn@4
|
5
|
Dawn@4
|
6 % for emotion detection give the confusion matrix as
|
Dawn@4
|
7 % -----------------------------------------------------------------
|
Dawn@4
|
8 % positive correctly identified | positive incorrectly identified (1,2)
|
Dawn@4
|
9 % negative incorrectly identified (2,1) | negative correctly identified
|
Dawn@4
|
10 % ------------------------------------------------------------------
|
Dawn@4
|
11 % which group has the most samples?
|
Dawn@4
|
12 [maxValue, maxIndex] = max( groupStats );
|
Dawn@4
|
13 maxGroup = groupNames( maxIndex,: );
|
Dawn@4
|
14
|
Dawn@4
|
15 % if we are performing emotion detection
|
Dawn@4
|
16 if( ~isempty(strfind( groupNames(1,:), 'N' )) ...
|
Dawn@4
|
17 || ~isempty(strfind( groupNames(1,:), 'P' )))
|
Dawn@4
|
18 confusionMatrix = zeros(2,2);
|
Dawn@4
|
19
|
Dawn@4
|
20 % check groups for any missing
|
Dawn@4
|
21 if( length(groupStats) < 4 )
|
Dawn@4
|
22 % find the missing group
|
Dawn@4
|
23 if( groupFind( groupNames, 'N1' ) == 0 )
|
Dawn@4
|
24 % missing N1
|
Dawn@4
|
25 groupNames = [groupNames; 'N1'];
|
Dawn@4
|
26 groupStats = [groupStats 0];
|
Dawn@4
|
27 end
|
Dawn@4
|
28 if( groupFind( groupNames, 'N2' ) == 0 )
|
Dawn@4
|
29 % missing N2
|
Dawn@4
|
30 groupNames = [groupNames; 'N2'];
|
Dawn@4
|
31 groupStats = [groupStats 0];
|
Dawn@4
|
32 end
|
Dawn@4
|
33 if( groupFind( groupNames, 'P1' ) == 0 )
|
Dawn@4
|
34 % missing P1
|
Dawn@4
|
35 groupNames = [groupNames; 'P1'];
|
Dawn@4
|
36 groupStats = [groupStats 0];
|
Dawn@4
|
37 end
|
Dawn@4
|
38 if( groupFind( groupNames, 'P2' ) == 0 )
|
Dawn@4
|
39 %missing P2
|
Dawn@4
|
40 groupNames = [groupNames; 'P2'];
|
Dawn@4
|
41 groupStats = [groupStats 0];
|
Dawn@4
|
42 end
|
Dawn@4
|
43 end
|
Dawn@4
|
44 % let the group with the maximum success (either 1 or 2) be the
|
Dawn@4
|
45 % cluster for that emotion
|
Dawn@4
|
46 if( strfind( maxGroup, 'N' ))
|
Dawn@4
|
47 % negative samples were detected most reliably
|
Dawn@4
|
48 confusionMatrix(2,2) = maxValue;
|
Dawn@4
|
49 if( strfind( maxGroup, '1' ))
|
Dawn@4
|
50 % group 1 is the negative group
|
Dawn@4
|
51 % find the number of positive samples incorrectly identified
|
Dawn@4
|
52 idx = groupFind( groupNames, 'P1' );
|
Dawn@4
|
53 confusionMatrix(1,2) = groupStats( idx );
|
Dawn@4
|
54 % group 2 is the positive group
|
Dawn@4
|
55 % find the number of positive samples correctly identified
|
Dawn@4
|
56 idx = groupFind( groupNames, 'P2' );
|
Dawn@4
|
57 confusionMatrix(1,1) = groupStats( idx );
|
Dawn@4
|
58 % find the number of negative samples incorrectly identified
|
Dawn@4
|
59 idx = groupFind( groupNames, 'N2' );
|
Dawn@4
|
60 confusionMatrix(2,1) = groupStats( idx );
|
Dawn@4
|
61 else
|
Dawn@4
|
62 % group 2 is the negative group
|
Dawn@4
|
63 % find the number of positive samples incorrectly identified
|
Dawn@4
|
64 idx = groupFind( groupNames, 'P2' );
|
Dawn@4
|
65 confusionMatrix(1,2) = groupStats( idx );
|
Dawn@4
|
66 % group 1 is the positive group
|
Dawn@4
|
67 % find the number of positive samples correctly identified
|
Dawn@4
|
68 idx = groupFind( groupNames, 'P1' );
|
Dawn@4
|
69 confusionMatrix(1,1) = groupStats( idx );
|
Dawn@4
|
70 % find the number of negative samples incorrectly identified
|
Dawn@4
|
71 idx = groupFind( groupNames, 'N1' );
|
Dawn@4
|
72 confusionMatrix(2,1) = groupStats( idx );
|
Dawn@4
|
73 end
|
Dawn@4
|
74 else
|
Dawn@4
|
75 % positive samples were detected most reliably
|
Dawn@4
|
76 confusionMatrix(1,1) = maxValue;
|
Dawn@4
|
77 if( strfind( maxGroup, '1' ))
|
Dawn@4
|
78 % group 1 is the positive group
|
Dawn@4
|
79 % find the number of positive samples incorrectly identified
|
Dawn@4
|
80 idx = groupFind( groupNames, 'P2' );
|
Dawn@4
|
81 confusionMatrix(1,2) = groupStats( idx );
|
Dawn@4
|
82 % group 2 is the negative group
|
Dawn@4
|
83 % find the number of negative samples correctly identified
|
Dawn@4
|
84 idx = groupFind( groupNames, 'N2' );
|
Dawn@4
|
85 confusionMatrix(2,2) = groupStats( idx );
|
Dawn@4
|
86 % find the number of negative samples incorrectly identified
|
Dawn@4
|
87 idx = groupFind( groupNames, 'N1' );
|
Dawn@4
|
88 confusionMatrix(2,1) = groupStats( idx );
|
Dawn@4
|
89 else
|
Dawn@4
|
90 % group 2 is the positive group
|
Dawn@4
|
91 % find the number of positive samples incorrectly identified
|
Dawn@4
|
92 idx = groupFind( groupNames, 'P1' );
|
Dawn@4
|
93 confusionMatrix(1,2) = groupStats( idx );
|
Dawn@4
|
94 % group 1 is the negative group
|
Dawn@4
|
95 % find the number of negative samples correctly identified
|
Dawn@4
|
96 idx = groupFind( groupNames, 'N1' );
|
Dawn@4
|
97 confusionMatrix(2,2) = groupStats( idx );
|
Dawn@4
|
98 % find the number of negative samples incorrectly identified
|
Dawn@4
|
99 idx = groupFind( groupNames, 'N2' );
|
Dawn@4
|
100 confusionMatrix(2,1) = groupStats( idx );
|
Dawn@4
|
101 end
|
Dawn@4
|
102 end
|
Dawn@4
|
103
|
Dawn@4
|
104 confusionMatrix(3,3) = confusionMatrix(1,1) + confusionMatrix(2,2);
|
Dawn@4
|
105 disp(distanceMeasure);
|
Dawn@4
|
106 % print latex results to the screen
|
Dawn@4
|
107 str1 = sprintf(' & %2.2f & %2.2f & \\\\', confusionMatrix(1,1), confusionMatrix(1,2) );
|
Dawn@4
|
108 disp(str1);
|
Dawn@4
|
109 str1 = sprintf(' & %2.2f & %2.2f & \\\\', confusionMatrix(2,1), confusionMatrix(2,2) );
|
Dawn@4
|
110 disp(str1);
|
Dawn@4
|
111 str1 = sprintf(' & & & %2.2f \\\\',confusionMatrix(3,3) );
|
Dawn@4
|
112 disp(str1);
|
Dawn@4
|
113 disp(' ');
|
Dawn@4
|
114
|
Dawn@4
|
115 fprintf( masterFileOutputID, '\n %f \t %f \n %f \t %f \n %f \t %f \t %f \n', confusionMatrix(1,1), confusionMatrix(1,2), confusionMatrix(2,1), confusionMatrix(2,2), 0, 0, confusionMatrix(3,3));
|
Dawn@4
|
116 end
|
Dawn@4
|
117
|
Dawn@4
|
118 % for gender detection give the confusion matrix as
|
Dawn@4
|
119 % --------------------------------------------------------------------
|
Dawn@4
|
120 % male correctly identified as male | male incorrectly identified as female | male incorrectly identified as trans
|
Dawn@4
|
121 % female incorrectly identified as male | female correctly identified | female incorrectly identified as trans
|
Dawn@4
|
122 % trans incorrectly identified as male | trans incorrectly identified as female | trans correctly identified
|
Dawn@4
|
123 % --------------------------------------------------------------------
|
Dawn@4
|
124
|
Dawn@4
|
125 % if we are performing gender detection
|
Dawn@4
|
126 if( ~isempty(strfind( groupNames(1,:), 'F' )) ...
|
Dawn@4
|
127 || ~isempty(strfind( groupNames(1,:), 'M' ))...
|
Dawn@4
|
128 || ~isempty(strfind( groupNames(1,:), 'T' )))
|
Dawn@4
|
129 confusionMatrix = zeros(3,3);
|
Dawn@4
|
130
|
Dawn@4
|
131 % check groups for any missing
|
Dawn@4
|
132 if( length(groupStats) < 9 )
|
Dawn@4
|
133 % find the missing group
|
Dawn@4
|
134 if( groupFind( groupNames, 'M1' ) == 0 )
|
Dawn@4
|
135 groupNames = [groupNames; 'M1'];
|
Dawn@4
|
136 groupStats = [groupStats 0];
|
Dawn@4
|
137 end
|
Dawn@4
|
138 if( groupFind( groupNames, 'M2' ) == 0 )
|
Dawn@4
|
139 groupNames = [groupNames; 'M2'];
|
Dawn@4
|
140 groupStats = [groupStats 0];
|
Dawn@4
|
141 end
|
Dawn@4
|
142 if( groupFind( groupNames, 'M3' ) == 0 )
|
Dawn@4
|
143 groupNames = [groupNames; 'M3'];
|
Dawn@4
|
144 groupStats = [groupStats 0];
|
Dawn@4
|
145 end
|
Dawn@4
|
146 if( groupFind( groupNames, 'F1' ) == 0 )
|
Dawn@4
|
147 groupNames = [groupNames; 'F1'];
|
Dawn@4
|
148 groupStats = [groupStats 0];
|
Dawn@4
|
149 end
|
Dawn@4
|
150 if( groupFind( groupNames, 'F2' ) == 0 )
|
Dawn@4
|
151 groupNames = [groupNames; 'F2'];
|
Dawn@4
|
152 groupStats = [groupStats 0];
|
Dawn@4
|
153 end
|
Dawn@4
|
154 if( groupFind( groupNames, 'F3' ) == 0 )
|
Dawn@4
|
155 groupNames = [groupNames; 'F3'];
|
Dawn@4
|
156 groupStats = [groupStats 0];
|
Dawn@4
|
157 end
|
Dawn@4
|
158 if( groupFind( groupNames, 'T1' ) == 0 )
|
Dawn@4
|
159 groupNames = [groupNames; 'T1'];
|
Dawn@4
|
160 groupStats = [groupStats 0];
|
Dawn@4
|
161 end
|
Dawn@4
|
162 if( groupFind( groupNames, 'T2' ) == 0 )
|
Dawn@4
|
163 groupNames = [groupNames; 'T2'];
|
Dawn@4
|
164 groupStats = [groupStats 0];
|
Dawn@4
|
165 end
|
Dawn@4
|
166 if( groupFind( groupNames, 'T3' ) == 0 )
|
Dawn@4
|
167 groupNames = [groupNames; 'T3'];
|
Dawn@4
|
168 groupStats = [groupStats 0];
|
Dawn@4
|
169 end
|
Dawn@4
|
170
|
Dawn@4
|
171 end
|
Dawn@4
|
172
|
Dawn@4
|
173
|
Dawn@4
|
174 % let the group with the maximum success (either 1, 2 or 3) be the
|
Dawn@4
|
175 % cluster for that gender
|
Dawn@4
|
176 if( strfind( maxGroup, 'M' ))
|
Dawn@4
|
177 % male samples were detected most reliably
|
Dawn@4
|
178 confusionMatrix(1,1) = maxValue;
|
Dawn@4
|
179 if( strfind( maxGroup, '1' ))
|
Dawn@4
|
180 % group 1 is the male group
|
Dawn@4
|
181 % find the female group (F2 or F3, can't be F1)
|
Dawn@4
|
182 idx1 = groupFind( groupNames, 'F2' );
|
Dawn@4
|
183 idx2 = groupFind( groupNames, 'F3' );
|
Dawn@4
|
184 if( groupStats( idx1 ) > groupStats( idx2 ) )
|
Dawn@4
|
185 % group 1 is the male group
|
Dawn@4
|
186 % female is group 2 and trans group 3
|
Dawn@4
|
187 % find the number of male samples incorrectly identified as female
|
Dawn@4
|
188 idx = groupFind( groupNames, 'M2' );
|
Dawn@4
|
189 confusionMatrix(1,2) = groupStats( idx );
|
Dawn@4
|
190 % find the number of male samples incorrectly identified as trans
|
Dawn@4
|
191 idx = groupFind( groupNames, 'M3' );
|
Dawn@4
|
192 confusionMatrix(1,3) = groupStats( idx );
|
Dawn@4
|
193
|
Dawn@4
|
194 % female correctly identified as female
|
Dawn@4
|
195 idx = groupFind( groupNames, 'F2' );
|
Dawn@4
|
196 confusionMatrix(2,2) = groupStats( idx );
|
Dawn@4
|
197 % female incorrectly identified as male
|
Dawn@4
|
198 idx = groupFind( groupNames, 'F1' );
|
Dawn@4
|
199 confusionMatrix(2,1) = groupStats( idx );
|
Dawn@4
|
200 % female incorrectly identified as trans
|
Dawn@4
|
201 idx = groupFind( groupNames, 'F3' );
|
Dawn@4
|
202 confusionMatrix(2,3) = groupStats( idx );
|
Dawn@4
|
203
|
Dawn@4
|
204 % trans correctly identified as trans
|
Dawn@4
|
205 idx = groupFind( groupNames, 'T3' );
|
Dawn@4
|
206 confusionMatrix(3,3) = groupStats( idx );
|
Dawn@4
|
207 % trans incorrectly identified as male
|
Dawn@4
|
208 idx = groupFind( groupNames, 'T1' );
|
Dawn@4
|
209 confusionMatrix(3,1) = groupStats( idx );
|
Dawn@4
|
210 % trans incorrectly identified as female
|
Dawn@4
|
211 idx = groupFind( groupNames, 'T3' );
|
Dawn@4
|
212 confusionMatrix(3,2) = groupStats( idx );
|
Dawn@4
|
213
|
Dawn@4
|
214 else
|
Dawn@4
|
215 % female is group 3 and trans is group 2
|
Dawn@4
|
216
|
Dawn@4
|
217 % find the number of male samples incorrectly identified as female
|
Dawn@4
|
218 idx = groupFind( groupNames, 'M3' );
|
Dawn@4
|
219 confusionMatrix(1,2) = groupStats( idx );
|
Dawn@4
|
220 % find the number of male samples incorrectly identified as trans
|
Dawn@4
|
221 idx = groupFind( groupNames, 'M2' );
|
Dawn@4
|
222 confusionMatrix(1,3) = groupStats( idx );
|
Dawn@4
|
223
|
Dawn@4
|
224 % female correctly identified as female
|
Dawn@4
|
225 idx = groupFind( groupNames, 'F3' );
|
Dawn@4
|
226 confusionMatrix(2,2) = groupStats( idx );
|
Dawn@4
|
227 % female incorrectly identified as male
|
Dawn@4
|
228 idx = groupFind( groupNames, 'F1' );
|
Dawn@4
|
229 confusionMatrix(2,1) = groupStats( idx );
|
Dawn@4
|
230 % female incorrectly identified as trans
|
Dawn@4
|
231 idx = groupFind( groupNames, 'F2' );
|
Dawn@4
|
232 confusionMatrix(2,3) = groupStats( idx );
|
Dawn@4
|
233
|
Dawn@4
|
234 % trans correctly identified as trans
|
Dawn@4
|
235 idx = groupFind( groupNames, 'T2' );
|
Dawn@4
|
236 confusionMatrix(3,3) = groupStats( idx );
|
Dawn@4
|
237 % trans incorrectly identified as male
|
Dawn@4
|
238 idx = groupFind( groupNames, 'T1' );
|
Dawn@4
|
239 confusionMatrix(3,1) = groupStats( idx );
|
Dawn@4
|
240 % trans incorrectly identified as female
|
Dawn@4
|
241 idx = groupFind( groupNames, 'T3' );
|
Dawn@4
|
242 confusionMatrix(3,2) = groupStats( idx );
|
Dawn@4
|
243
|
Dawn@4
|
244 end
|
Dawn@4
|
245
|
Dawn@4
|
246
|
Dawn@4
|
247 elseif( strfind( maxGroup, '2' ))
|
Dawn@4
|
248 % group 2 is the male group
|
Dawn@4
|
249
|
Dawn@4
|
250 % find the female group (F1 or F3, can't be F2)
|
Dawn@4
|
251 idx1 = groupFind( groupNames, 'F1' );
|
Dawn@4
|
252 idx2 = groupFind( groupNames, 'F3' );
|
Dawn@4
|
253 if( groupStats( idx1 ) > groupStats( idx2 ) )
|
Dawn@4
|
254 % female is group 1 and trans group 3
|
Dawn@4
|
255 % find the number of male samples incorrectly identified as female
|
Dawn@4
|
256 idx = groupFind( groupNames, 'M1' );
|
Dawn@4
|
257 confusionMatrix(1,2) = groupStats( idx );
|
Dawn@4
|
258 % find the number of male samples incorrectly identified as trans
|
Dawn@4
|
259 idx = groupFind( groupNames, 'M3' );
|
Dawn@4
|
260 confusionMatrix(1,3) = groupStats( idx );
|
Dawn@4
|
261
|
Dawn@4
|
262 % female correctly identified as female
|
Dawn@4
|
263 idx = groupFind( groupNames, 'F1' );
|
Dawn@4
|
264 confusionMatrix(2,2) = groupStats( idx );
|
Dawn@4
|
265 % female incorrectly identified as male
|
Dawn@4
|
266 idx = groupFind( groupNames, 'F2' );
|
Dawn@4
|
267 confusionMatrix(2,1) = groupStats( idx );
|
Dawn@4
|
268 % female incorrectly identified as trans
|
Dawn@4
|
269 idx = groupFind( groupNames, 'F3' );
|
Dawn@4
|
270 confusionMatrix(2,3) = groupStats( idx );
|
Dawn@4
|
271
|
Dawn@4
|
272 % trans correctly identified as trans
|
Dawn@4
|
273 idx = groupFind( groupNames, 'T3' );
|
Dawn@4
|
274 confusionMatrix(3,3) = groupStats( idx );
|
Dawn@4
|
275 % trans incorrectly identified as male
|
Dawn@4
|
276 idx = groupFind( groupNames, 'T2' );
|
Dawn@4
|
277 confusionMatrix(3,1) = groupStats( idx );
|
Dawn@4
|
278 % trans incorrectly identified as female
|
Dawn@4
|
279 idx = groupFind( groupNames, 'T1' );
|
Dawn@4
|
280 confusionMatrix(3,2) = groupStats( idx );
|
Dawn@4
|
281
|
Dawn@4
|
282 else
|
Dawn@4
|
283 % female is group 3 and trans is group 1
|
Dawn@4
|
284
|
Dawn@4
|
285 % find the number of male samples incorrectly identified as female
|
Dawn@4
|
286 idx = groupFind( groupNames, 'M3' );
|
Dawn@4
|
287 confusionMatrix(1,2) = groupStats( idx );
|
Dawn@4
|
288 % find the number of male samples incorrectly identified as trans
|
Dawn@4
|
289 idx = groupFind( groupNames, 'M1' );
|
Dawn@4
|
290 confusionMatrix(1,3) = groupStats( idx );
|
Dawn@4
|
291
|
Dawn@4
|
292 % female correctly identified as female
|
Dawn@4
|
293 idx = groupFind( groupNames, 'F3' );
|
Dawn@4
|
294 confusionMatrix(2,2) = groupStats( idx );
|
Dawn@4
|
295 % female incorrectly identified as male
|
Dawn@4
|
296 idx = groupFind( groupNames, 'F2' );
|
Dawn@4
|
297 confusionMatrix(2,1) = groupStats( idx );
|
Dawn@4
|
298 % female incorrectly identified as trans
|
Dawn@4
|
299 idx = groupFind( groupNames, 'F1' );
|
Dawn@4
|
300 confusionMatrix(2,3) = groupStats( idx );
|
Dawn@4
|
301
|
Dawn@4
|
302 % trans correctly identified as trans
|
Dawn@4
|
303 idx = groupFind( groupNames, 'T1' );
|
Dawn@4
|
304 confusionMatrix(3,3) = groupStats( idx );
|
Dawn@4
|
305 % trans incorrectly identified as male
|
Dawn@4
|
306 idx = groupFind( groupNames, 'F2' );
|
Dawn@4
|
307 confusionMatrix(3,1) = groupStats( idx );
|
Dawn@4
|
308 % trans incorrectly identified as female
|
Dawn@4
|
309 idx = groupFind( groupNames, 'F3' );
|
Dawn@4
|
310 confusionMatrix(3,2) = groupStats( idx );
|
Dawn@4
|
311
|
Dawn@4
|
312 end
|
Dawn@4
|
313
|
Dawn@4
|
314 else
|
Dawn@4
|
315 % group 3 is the male group
|
Dawn@4
|
316
|
Dawn@4
|
317 % find the female group (F1 or F2, can't be F3)
|
Dawn@4
|
318 idx1 = groupFind( groupNames, 'F1' );
|
Dawn@4
|
319 idx2 = groupFind( groupNames, 'F2' );
|
Dawn@4
|
320 if( groupStats( idx1 ) > groupStats( idx2 ) )
|
Dawn@4
|
321 % female is group 1 and trans group 2
|
Dawn@4
|
322 % find the number of male samples incorrectly identified as female
|
Dawn@4
|
323 idx = groupFind( groupNames, 'M1' );
|
Dawn@4
|
324 confusionMatrix(1,2) = groupStats( idx );
|
Dawn@4
|
325 % find the number of male samples incorrectly identified as trans
|
Dawn@4
|
326 idx = groupFind( groupNames, 'M2' );
|
Dawn@4
|
327 confusionMatrix(1,3) = groupStats( idx );
|
Dawn@4
|
328
|
Dawn@4
|
329 % female correctly identified as female
|
Dawn@4
|
330 idx = groupFind( groupNames, 'F1' );
|
Dawn@4
|
331 confusionMatrix(2,2) = groupStats( idx );
|
Dawn@4
|
332 % female incorrectly identified as male
|
Dawn@4
|
333 idx = groupFind( groupNames, 'F3' );
|
Dawn@4
|
334 confusionMatrix(2,1) = groupStats( idx );
|
Dawn@4
|
335 % female incorrectly identified as trans
|
Dawn@4
|
336 idx = groupFind( groupNames, 'F2' );
|
Dawn@4
|
337 confusionMatrix(2,3) = groupStats( idx );
|
Dawn@4
|
338
|
Dawn@4
|
339 % trans correctly identified as trans
|
Dawn@4
|
340 idx = groupFind( groupNames, 'T2' );
|
Dawn@4
|
341 confusionMatrix(3,3) = groupStats( idx );
|
Dawn@4
|
342 % trans incorrectly identified as male
|
Dawn@4
|
343 idx = groupFind( groupNames, 'F3' );
|
Dawn@4
|
344 confusionMatrix(3,1) = groupStats( idx );
|
Dawn@4
|
345 % trans incorrectly identified as female
|
Dawn@4
|
346 idx = groupFind( groupNames, 'F1' );
|
Dawn@4
|
347 confusionMatrix(3,2) = groupStats( idx );
|
Dawn@4
|
348
|
Dawn@4
|
349 else
|
Dawn@4
|
350 % female is group 2 and trans is group 1
|
Dawn@4
|
351
|
Dawn@4
|
352 % find the number of male samples incorrectly identified as female
|
Dawn@4
|
353 idx = groupFind( groupNames, 'M2' );
|
Dawn@4
|
354 confusionMatrix(1,2) = groupStats( idx );
|
Dawn@4
|
355 % find the number of male samples incorrectly identified as trans
|
Dawn@4
|
356 idx = groupFind( groupNames, 'M1' );
|
Dawn@4
|
357 confusionMatrix(1,3) = groupStats( idx );
|
Dawn@4
|
358
|
Dawn@4
|
359 % female correctly identified as female
|
Dawn@4
|
360 idx = groupFind( groupNames, 'F2' );
|
Dawn@4
|
361 confusionMatrix(2,2) = groupStats( idx );
|
Dawn@4
|
362 % female incorrectly identified as male
|
Dawn@4
|
363 idx = groupFind( groupNames, 'F3' );
|
Dawn@4
|
364 confusionMatrix(2,1) = groupStats( idx );
|
Dawn@4
|
365 % female incorrectly identified as trans
|
Dawn@4
|
366 idx = groupFind( groupNames, 'F1' );
|
Dawn@4
|
367 confusionMatrix(2,3) = groupStats( idx );
|
Dawn@4
|
368
|
Dawn@4
|
369 % trans correctly identified as trans
|
Dawn@4
|
370 idx = groupFind( groupNames, 'T1' );
|
Dawn@4
|
371 confusionMatrix(3,3) = groupStats( idx );
|
Dawn@4
|
372 % trans incorrectly identified as male
|
Dawn@4
|
373 idx = groupFind( groupNames, 'F3' );
|
Dawn@4
|
374 confusionMatrix(3,1) = groupStats( idx );
|
Dawn@4
|
375 % trans incorrectly identified as female
|
Dawn@4
|
376 idx = groupFind( groupNames, 'F2' );
|
Dawn@4
|
377 confusionMatrix(3,2) = groupStats( idx );
|
Dawn@4
|
378
|
Dawn@4
|
379 end
|
Dawn@4
|
380
|
Dawn@4
|
381 end
|
Dawn@4
|
382
|
Dawn@4
|
383 % --------------------------------------------------------------------
|
Dawn@4
|
384 % male correctly identified as male (1,1) | male incorrectly identified as female (1,2) | male incorrectly identified as trans
|
Dawn@4
|
385 % female incorrectly identified as male (2,1) | female correctly identified (2,2) | female incorrectly identified as trans
|
Dawn@4
|
386 % trans incorrectly identified as male (3,1) | trans incorrectly identified as female (3,2) | trans correctly identified (3,3)
|
Dawn@4
|
387 % --------------------------------------------------------------------
|
Dawn@4
|
388
|
Dawn@4
|
389 elseif( strfind( maxGroup, 'F' ))
|
Dawn@4
|
390 % female samples were detected most reliably
|
Dawn@4
|
391 confusionMatrix(2,2) = maxValue;
|
Dawn@4
|
392 if( strfind( maxGroup, '1' ))
|
Dawn@4
|
393 % group 1 is the female group
|
Dawn@4
|
394 % find the male group (F2 or F3, can't be F1)
|
Dawn@4
|
395 idx1 = groupFind( groupNames, 'M2' );
|
Dawn@4
|
396 idx2 = groupFind( groupNames, 'M3' );
|
Dawn@4
|
397 if( groupStats( idx1 ) > groupStats( idx2 ) )
|
Dawn@4
|
398 % male is group 2 and trans group 3
|
Dawn@4
|
399 % find the number of male samples incorrectly identified as female
|
Dawn@4
|
400 idx = groupFind( groupNames, 'M1' );
|
Dawn@4
|
401 confusionMatrix(1,2) = groupStats( idx );
|
Dawn@4
|
402 % find the number of male samples incorrectly identified as trans
|
Dawn@4
|
403 idx = groupFind( groupNames, 'M3' );
|
Dawn@4
|
404 confusionMatrix(1,3) = groupStats( idx );
|
Dawn@4
|
405 % male correctly identified as male
|
Dawn@4
|
406 idx = groupFind( groupNames, 'M2' );
|
Dawn@4
|
407 confusionMatrix(1,1) = groupStats( idx );
|
Dawn@4
|
408
|
Dawn@4
|
409 % female incorrectly identified as male
|
Dawn@4
|
410 idx = groupFind( groupNames, 'F2' );
|
Dawn@4
|
411 confusionMatrix(2,1) = groupStats( idx );
|
Dawn@4
|
412 % female incorrectly identified as trans
|
Dawn@4
|
413 idx = groupFind( groupNames, 'F3' );
|
Dawn@4
|
414 confusionMatrix(2,3) = groupStats( idx );
|
Dawn@4
|
415
|
Dawn@4
|
416 % trans correctly identified as trans
|
Dawn@4
|
417 idx = groupFind( groupNames, 'T3' );
|
Dawn@4
|
418 confusionMatrix(3,3) = groupStats( idx );
|
Dawn@4
|
419 % trans incorrectly identified as male
|
Dawn@4
|
420 idx = groupFind( groupNames, 'T2' );
|
Dawn@4
|
421 confusionMatrix(3,1) = groupStats( idx );
|
Dawn@4
|
422 % trans incorrectly identified as female
|
Dawn@4
|
423 idx = groupFind( groupNames, 'T1' );
|
Dawn@4
|
424 confusionMatrix(3,2) = groupStats( idx );
|
Dawn@4
|
425
|
Dawn@4
|
426 else
|
Dawn@4
|
427 % female is group 1
|
Dawn@4
|
428 % male is group 3 and trans is group 2
|
Dawn@4
|
429
|
Dawn@4
|
430 % find the number of male samples incorrectly identified as female
|
Dawn@4
|
431 idx = groupFind( groupNames, 'M1' );
|
Dawn@4
|
432 confusionMatrix(1,2) = groupStats( idx );
|
Dawn@4
|
433 % find the number of male samples incorrectly identified as trans
|
Dawn@4
|
434 idx = groupFind( groupNames, 'M2' );
|
Dawn@4
|
435 confusionMatrix(1,3) = groupStats( idx );
|
Dawn@4
|
436 % male correctly identified as male
|
Dawn@4
|
437 idx = groupFind( groupNames, 'M3' );
|
Dawn@4
|
438 confusionMatrix(1,1) = groupStats( idx );
|
Dawn@4
|
439
|
Dawn@4
|
440 % female incorrectly identified as male
|
Dawn@4
|
441 idx = groupFind( groupNames, 'F3' );
|
Dawn@4
|
442 confusionMatrix(2,1) = groupStats( idx );
|
Dawn@4
|
443 % female incorrectly identified as trans
|
Dawn@4
|
444 idx = groupFind( groupNames, 'F2' );
|
Dawn@4
|
445 confusionMatrix(2,3) = groupStats( idx );
|
Dawn@4
|
446
|
Dawn@4
|
447 % trans correctly identified as trans
|
Dawn@4
|
448 idx = groupFind( groupNames, 'T2' );
|
Dawn@4
|
449 confusionMatrix(3,3) = groupStats( idx );
|
Dawn@4
|
450 % trans incorrectly identified as male
|
Dawn@4
|
451 idx = groupFind( groupNames, 'T3' );
|
Dawn@4
|
452 confusionMatrix(3,1) = groupStats( idx );
|
Dawn@4
|
453 % trans incorrectly identified as female
|
Dawn@4
|
454 idx = groupFind( groupNames, 'T1' );
|
Dawn@4
|
455 confusionMatrix(3,2) = groupStats( idx );
|
Dawn@4
|
456
|
Dawn@4
|
457 end
|
Dawn@4
|
458
|
Dawn@4
|
459
|
Dawn@4
|
460 elseif( strfind( maxGroup, '2' ))
|
Dawn@4
|
461 % group 2 is the female group
|
Dawn@4
|
462 % find the male group (M1 or M3, can't be M2)
|
Dawn@4
|
463 idx1 = groupFind( groupNames, 'M1' );
|
Dawn@4
|
464 idx2 = groupFind( groupNames, 'M3' );
|
Dawn@4
|
465 if( groupStats( idx1 ) > groupStats( idx2 ) )
|
Dawn@4
|
466 % male is group 1 and trans group 3
|
Dawn@4
|
467 % find the number of male samples incorrectly identified as female
|
Dawn@4
|
468 idx = groupFind( groupNames, 'M2' );
|
Dawn@4
|
469 confusionMatrix(1,2) = groupStats( idx );
|
Dawn@4
|
470 % find the number of male samples incorrectly identified as trans
|
Dawn@4
|
471 idx = groupFind( groupNames, 'M3' );
|
Dawn@4
|
472 confusionMatrix(1,3) = groupStats( idx );
|
Dawn@4
|
473 % male correctly identified as male
|
Dawn@4
|
474 idx = groupFind( groupNames, 'M1' );
|
Dawn@4
|
475 confusionMatrix(1,1) = groupStats( idx );
|
Dawn@4
|
476
|
Dawn@4
|
477 % female incorrectly identified as male
|
Dawn@4
|
478 idx = groupFind( groupNames, 'F1' );
|
Dawn@4
|
479 confusionMatrix(2,1) = groupStats( idx );
|
Dawn@4
|
480 % female incorrectly identified as trans
|
Dawn@4
|
481 idx = groupFind( groupNames, 'F3' );
|
Dawn@4
|
482 confusionMatrix(2,3) = groupStats( idx );
|
Dawn@4
|
483
|
Dawn@4
|
484 % trans correctly identified as trans
|
Dawn@4
|
485 idx = groupFind( groupNames, 'T3' );
|
Dawn@4
|
486 confusionMatrix(3,3) = groupStats( idx );
|
Dawn@4
|
487 % trans incorrectly identified as male
|
Dawn@4
|
488 idx = groupFind( groupNames, 'T1' );
|
Dawn@4
|
489 confusionMatrix(3,1) = groupStats( idx );
|
Dawn@4
|
490 % trans incorrectly identified as female
|
Dawn@4
|
491 idx = groupFind( groupNames, 'T2' );
|
Dawn@4
|
492 confusionMatrix(3,2) = groupStats( idx );
|
Dawn@4
|
493
|
Dawn@4
|
494 else
|
Dawn@4
|
495 % group 2 is the female group
|
Dawn@4
|
496 % male is group 3 and trans is group 1
|
Dawn@4
|
497
|
Dawn@4
|
498 % find the number of male samples incorrectly identified as female
|
Dawn@4
|
499 idx = groupFind( groupNames, 'M2' );
|
Dawn@4
|
500 confusionMatrix(1,2) = groupStats( idx );
|
Dawn@4
|
501 % find the number of male samples incorrectly identified as trans
|
Dawn@4
|
502 idx = groupFind( groupNames, 'M1' );
|
Dawn@4
|
503 confusionMatrix(1,3) = groupStats( idx );
|
Dawn@4
|
504 % male correctly identified as male
|
Dawn@4
|
505 idx = groupFind( groupNames, 'M3' );
|
Dawn@4
|
506 confusionMatrix(1,1) = groupStats( idx );
|
Dawn@4
|
507
|
Dawn@4
|
508 % female incorrectly identified as male
|
Dawn@4
|
509 idx = groupFind( groupNames, 'F3' );
|
Dawn@4
|
510 confusionMatrix(2,1) = groupStats( idx );
|
Dawn@4
|
511 % female incorrectly identified as trans
|
Dawn@4
|
512 idx = groupFind( groupNames, 'F1' );
|
Dawn@4
|
513 confusionMatrix(2,3) = groupStats( idx );
|
Dawn@4
|
514
|
Dawn@4
|
515 % trans correctly identified as trans
|
Dawn@4
|
516 idx = groupFind( groupNames, 'T1' );
|
Dawn@4
|
517 confusionMatrix(3,3) = groupStats( idx );
|
Dawn@4
|
518 % trans incorrectly identified as male
|
Dawn@4
|
519 idx = groupFind( groupNames, 'T3' );
|
Dawn@4
|
520 confusionMatrix(3,1) = groupStats( idx );
|
Dawn@4
|
521 % trans incorrectly identified as female
|
Dawn@4
|
522 idx = groupFind( groupNames, 'T2' );
|
Dawn@4
|
523 confusionMatrix(3,2) = groupStats( idx );
|
Dawn@4
|
524
|
Dawn@4
|
525 end
|
Dawn@4
|
526
|
Dawn@4
|
527 else
|
Dawn@4
|
528 % group 3 is the female group
|
Dawn@4
|
529 % find the male group (M1 or M2, can't be M3)
|
Dawn@4
|
530 idx1 = groupFind( groupNames, 'M1' );
|
Dawn@4
|
531 idx2 = groupFind( groupNames, 'M2' );
|
Dawn@4
|
532 if( groupStats( idx1 ) > groupStats( idx2 ) )
|
Dawn@4
|
533 % male is group 1 and trans group 2
|
Dawn@4
|
534 % find the number of male samples incorrectly identified as female
|
Dawn@4
|
535 idx = groupFind( groupNames, 'M3' );
|
Dawn@4
|
536 confusionMatrix(1,2) = groupStats( idx );
|
Dawn@4
|
537 % find the number of male samples incorrectly identified as trans
|
Dawn@4
|
538 idx = groupFind( groupNames, 'M2' );
|
Dawn@4
|
539 confusionMatrix(1,3) = groupStats( idx );
|
Dawn@4
|
540 % male correctly identified as male
|
Dawn@4
|
541 idx = groupFind( groupNames, 'M1' );
|
Dawn@4
|
542 confusionMatrix(1,1) = groupStats( idx );
|
Dawn@4
|
543
|
Dawn@4
|
544 % female incorrectly identified as male
|
Dawn@4
|
545 idx = groupFind( groupNames, 'F1' );
|
Dawn@4
|
546 confusionMatrix(2,1) = groupStats( idx );
|
Dawn@4
|
547 % female incorrectly identified as trans
|
Dawn@4
|
548 idx = groupFind( groupNames, 'F2' );
|
Dawn@4
|
549 confusionMatrix(2,3) = groupStats( idx );
|
Dawn@4
|
550
|
Dawn@4
|
551 % trans correctly identified as trans
|
Dawn@4
|
552 idx = groupFind( groupNames, 'T2' );
|
Dawn@4
|
553 confusionMatrix(3,3) = groupStats( idx );
|
Dawn@4
|
554 % trans incorrectly identified as male
|
Dawn@4
|
555 idx = groupFind( groupNames, 'T1' );
|
Dawn@4
|
556 confusionMatrix(3,1) = groupStats( idx );
|
Dawn@4
|
557 % trans incorrectly identified as female
|
Dawn@4
|
558 idx = groupFind( groupNames, 'T3' );
|
Dawn@4
|
559 confusionMatrix(3,2) = groupStats( idx );
|
Dawn@4
|
560
|
Dawn@4
|
561 else
|
Dawn@4
|
562 % female is group 3
|
Dawn@4
|
563 % male is group 2 and trans is group 1
|
Dawn@4
|
564
|
Dawn@4
|
565 % find the number of male samples incorrectly identified as female
|
Dawn@4
|
566 idx = groupFind( groupNames, 'M3' );
|
Dawn@4
|
567 confusionMatrix(1,2) = groupStats( idx );
|
Dawn@4
|
568 % find the number of male samples incorrectly identified as trans
|
Dawn@4
|
569 idx = groupFind( groupNames, 'M1' );
|
Dawn@4
|
570 confusionMatrix(1,3) = groupStats( idx );
|
Dawn@4
|
571 % male correctly identified as male
|
Dawn@4
|
572 idx = groupFind( groupNames, 'M2' );
|
Dawn@4
|
573 confusionMatrix(1,1) = groupStats( idx );
|
Dawn@4
|
574
|
Dawn@4
|
575 % female incorrectly identified as male
|
Dawn@4
|
576 idx = groupFind( groupNames, 'F2' );
|
Dawn@4
|
577 confusionMatrix(2,1) = groupStats( idx );
|
Dawn@4
|
578 % female incorrectly identified as trans
|
Dawn@4
|
579 idx = groupFind( groupNames, 'F1' );
|
Dawn@4
|
580 confusionMatrix(2,3) = groupStats( idx );
|
Dawn@4
|
581
|
Dawn@4
|
582 % trans correctly identified as trans
|
Dawn@4
|
583 idx = groupFind( groupNames, 'T1' );
|
Dawn@4
|
584 confusionMatrix(3,3) = groupStats( idx );
|
Dawn@4
|
585 % trans incorrectly identified as male
|
Dawn@4
|
586 idx = groupFind( groupNames, 'T2' );
|
Dawn@4
|
587 confusionMatrix(3,1) = groupStats( idx );
|
Dawn@4
|
588 % trans incorrectly identified as female
|
Dawn@4
|
589 idx = groupFind( groupNames, 'T3' );
|
Dawn@4
|
590 confusionMatrix(3,2) = groupStats( idx );
|
Dawn@4
|
591
|
Dawn@4
|
592 end
|
Dawn@4
|
593
|
Dawn@4
|
594 end
|
Dawn@4
|
595 % --------------------------------------------------------------------
|
Dawn@4
|
596 % male correctly identified as male (1,1) | male incorrectly identified as female (1,2) | male incorrectly identified as trans
|
Dawn@4
|
597 % female incorrectly identified as male (2,1) | female correctly identified (2,2) | female incorrectly identified as trans
|
Dawn@4
|
598 % trans incorrectly identified as male (3,1) | trans incorrectly identified as female (3,2) | trans correctly identified (3,3)
|
Dawn@4
|
599 % --------------------------------------------------------------------
|
Dawn@4
|
600
|
Dawn@4
|
601 elseif( strfind( maxGroup, 'T' ))
|
Dawn@4
|
602 % trans samples were detected most reliably
|
Dawn@4
|
603 confusionMatrix(3,3) = maxValue;
|
Dawn@4
|
604 if( strfind( maxGroup, '1' ))
|
Dawn@4
|
605 % group 1 is the trans group
|
Dawn@4
|
606 % find the female group (F2 or F3, can't be F1)
|
Dawn@4
|
607 idx1 = groupFind( groupNames, 'F2' );
|
Dawn@4
|
608 idx2 = groupFind( groupNames, 'F3' );
|
Dawn@4
|
609 if( groupStats( idx1 ) > groupStats( idx2 ) )
|
Dawn@4
|
610 % female is group 2 and male group 3
|
Dawn@4
|
611 % find the number of male samples incorrectly identified as female
|
Dawn@4
|
612 idx = groupFind( groupNames, 'M2' );
|
Dawn@4
|
613 confusionMatrix(1,2) = groupStats( idx );
|
Dawn@4
|
614 % find the number of male samples incorrectly identified as trans
|
Dawn@4
|
615 idx = groupFind( groupNames, 'M1' );
|
Dawn@4
|
616 confusionMatrix(1,3) = groupStats( idx );
|
Dawn@4
|
617 % male correctly identified as male
|
Dawn@4
|
618 idx = groupFind( groupNames, 'M3' );
|
Dawn@4
|
619 confusionMatrix(1,1) = groupStats( idx );
|
Dawn@4
|
620
|
Dawn@4
|
621 % female correctly identified as female
|
Dawn@4
|
622 idx = groupFind( groupNames, 'F2' );
|
Dawn@4
|
623 confusionMatrix(2,2) = groupStats( idx );
|
Dawn@4
|
624 % female incorrectly identified as male
|
Dawn@4
|
625 idx = groupFind( groupNames, 'F3' );
|
Dawn@4
|
626 confusionMatrix(2,1) = groupStats( idx );
|
Dawn@4
|
627 % female incorrectly identified as trans
|
Dawn@4
|
628 idx = groupFind( groupNames, 'F1' );
|
Dawn@4
|
629 confusionMatrix(1,3) = groupStats( idx );
|
Dawn@4
|
630
|
Dawn@4
|
631 % trans incorrectly identified as male
|
Dawn@4
|
632 idx = groupFind( groupNames, 'T3' );
|
Dawn@4
|
633 confusionMatrix(3,1) = groupStats( idx );
|
Dawn@4
|
634 % trans incorrectly identified as female
|
Dawn@4
|
635 idx = groupFind( groupNames, 'T2' );
|
Dawn@4
|
636 confusionMatrix(3,2) = groupStats( idx );
|
Dawn@4
|
637
|
Dawn@4
|
638 else
|
Dawn@4
|
639 % female is group 3 and male is group 2
|
Dawn@4
|
640 % find the number of male samples incorrectly identified as female
|
Dawn@4
|
641 idx = groupFind( groupNames, 'M3' );
|
Dawn@4
|
642 confusionMatrix(1,2) = groupStats( idx );
|
Dawn@4
|
643 % find the number of male samples incorrectly identified as trans
|
Dawn@4
|
644 idx = groupFind( groupNames, 'M1' );
|
Dawn@4
|
645 confusionMatrix(1,3) = groupStats( idx );
|
Dawn@4
|
646 % male correctly identified as male
|
Dawn@4
|
647 idx = groupFind( groupNames, 'M2' );
|
Dawn@4
|
648 confusionMatrix(1,1) = groupStats( idx );
|
Dawn@4
|
649
|
Dawn@4
|
650 % female correctly identified as female
|
Dawn@4
|
651 idx = groupFind( groupNames, 'F3' );
|
Dawn@4
|
652 confusionMatrix(2,2) = groupStats( idx );
|
Dawn@4
|
653 % female incorrectly identified as male
|
Dawn@4
|
654 idx = groupFind( groupNames, 'F2' );
|
Dawn@4
|
655 confusionMatrix(2,1) = groupStats( idx );
|
Dawn@4
|
656 % female incorrectly identified as trans
|
Dawn@4
|
657 idx = groupFind( groupNames, 'F1' );
|
Dawn@4
|
658 confusionMatrix(1,3) = groupStats( idx );
|
Dawn@4
|
659
|
Dawn@4
|
660 % trans incorrectly identified as male
|
Dawn@4
|
661 idx = groupFind( groupNames, 'T2' );
|
Dawn@4
|
662 confusionMatrix(3,1) = groupStats( idx );
|
Dawn@4
|
663 % trans incorrectly identified as female
|
Dawn@4
|
664 idx = groupFind( groupNames, 'T3' );
|
Dawn@4
|
665 confusionMatrix(3,2) = groupStats( idx );
|
Dawn@4
|
666 end
|
Dawn@4
|
667
|
Dawn@4
|
668 elseif( strfind( maxGroup, '2' ))
|
Dawn@4
|
669 % group 2 is the trans group
|
Dawn@4
|
670 % find the female group (F1 or F3, can't be F2)
|
Dawn@4
|
671 idx1 = groupFind( groupNames, 'F1' );
|
Dawn@4
|
672 idx2 = groupFind( groupNames, 'F3' );
|
Dawn@4
|
673 if( groupStats( idx1 ) > groupStats( idx2 ) )
|
Dawn@4
|
674 % female is group 1 and male group 3
|
Dawn@4
|
675 % find the number of male samples incorrectly identified as female
|
Dawn@4
|
676 idx = groupFind( groupNames, 'M1' );
|
Dawn@4
|
677 confusionMatrix(1,2) = groupStats( idx );
|
Dawn@4
|
678 % find the number of male samples incorrectly identified as trans
|
Dawn@4
|
679 idx = groupFind( groupNames, 'M2' );
|
Dawn@4
|
680 confusionMatrix(1,3) = groupStats( idx );
|
Dawn@4
|
681 % male correctly identified as male
|
Dawn@4
|
682 idx = groupFind( groupNames, 'M3' );
|
Dawn@4
|
683 confusionMatrix(1,1) = groupStats( idx );
|
Dawn@4
|
684
|
Dawn@4
|
685 % female correctly identified as female
|
Dawn@4
|
686 idx = groupFind( groupNames, 'F1' );
|
Dawn@4
|
687 confusionMatrix(2,2) = groupStats( idx );
|
Dawn@4
|
688 % female incorrectly identified as male
|
Dawn@4
|
689 idx = groupFind( groupNames, 'F3' );
|
Dawn@4
|
690 confusionMatrix(2,1) = groupStats( idx );
|
Dawn@4
|
691 % female incorrectly identified as trans
|
Dawn@4
|
692 idx = groupFind( groupNames, 'F2' );
|
Dawn@4
|
693 confusionMatrix(1,3) = groupStats( idx );
|
Dawn@4
|
694
|
Dawn@4
|
695 % trans incorrectly identified as male
|
Dawn@4
|
696 idx = groupFind( groupNames, 'T3' );
|
Dawn@4
|
697 confusionMatrix(3,1) = groupStats( idx );
|
Dawn@4
|
698 % trans incorrectly identified as female
|
Dawn@4
|
699 idx = groupFind( groupNames, 'T1' );
|
Dawn@4
|
700 confusionMatrix(3,2) = groupStats( idx );
|
Dawn@4
|
701
|
Dawn@4
|
702 else
|
Dawn@4
|
703 % group 2 is the trans group
|
Dawn@4
|
704 % female is group 3 and male is group 1
|
Dawn@4
|
705 % find the number of male samples incorrectly identified as female
|
Dawn@4
|
706 idx = groupFind( groupNames, 'M3' );
|
Dawn@4
|
707 confusionMatrix(1,2) = groupStats( idx );
|
Dawn@4
|
708 % find the number of male samples incorrectly identified as trans
|
Dawn@4
|
709 idx = groupFind( groupNames, 'M2' );
|
Dawn@4
|
710 confusionMatrix(1,3) = groupStats( idx );
|
Dawn@4
|
711 % male correctly identified as male
|
Dawn@4
|
712 idx = groupFind( groupNames, 'M1' );
|
Dawn@4
|
713 confusionMatrix(1,1) = groupStats( idx );
|
Dawn@4
|
714
|
Dawn@4
|
715 % female correctly identified as female
|
Dawn@4
|
716 idx = groupFind( groupNames, 'F3' );
|
Dawn@4
|
717 confusionMatrix(2,2) = groupStats( idx );
|
Dawn@4
|
718 % female incorrectly identified as male
|
Dawn@4
|
719 idx = groupFind( groupNames, 'F1' );
|
Dawn@4
|
720 confusionMatrix(2,1) = groupStats( idx );
|
Dawn@4
|
721 % female incorrectly identified as trans
|
Dawn@4
|
722 idx = groupFind( groupNames, 'F2' );
|
Dawn@4
|
723 confusionMatrix(1,3) = groupStats( idx );
|
Dawn@4
|
724
|
Dawn@4
|
725 % trans incorrectly identified as male
|
Dawn@4
|
726 idx = groupFind( groupNames, 'T1' );
|
Dawn@4
|
727 confusionMatrix(3,1) = groupStats( idx );
|
Dawn@4
|
728 % trans incorrectly identified as female
|
Dawn@4
|
729 idx = groupFind( groupNames, 'T3' );
|
Dawn@4
|
730 confusionMatrix(3,2) = groupStats( idx );
|
Dawn@4
|
731
|
Dawn@4
|
732 end
|
Dawn@4
|
733
|
Dawn@4
|
734 else
|
Dawn@4
|
735 % group 3 is the trans group
|
Dawn@4
|
736 % find the female group (F1 or F2, can't be F3)
|
Dawn@4
|
737 idx1 = groupFind( groupNames, 'F1' );
|
Dawn@4
|
738 idx2 = groupFind( groupNames, 'F2' );
|
Dawn@4
|
739 if( groupStats( idx1 ) > groupStats( idx2 ) )
|
Dawn@4
|
740 % female is group 1 and male group 2
|
Dawn@4
|
741 % find the number of male samples incorrectly identified as female
|
Dawn@4
|
742 idx = groupFind( groupNames, 'M1' );
|
Dawn@4
|
743 confusionMatrix(1,2) = groupStats( idx );
|
Dawn@4
|
744 % find the number of male samples incorrectly identified as trans
|
Dawn@4
|
745 idx = groupFind( groupNames, 'M3' );
|
Dawn@4
|
746 confusionMatrix(1,3) = groupStats( idx );
|
Dawn@4
|
747 % male correctly identified as male
|
Dawn@4
|
748 idx = groupFind( groupNames, 'M2' );
|
Dawn@4
|
749 confusionMatrix(1,1) = groupStats( idx );
|
Dawn@4
|
750
|
Dawn@4
|
751 % female correctly identified as female
|
Dawn@4
|
752 idx = groupFind( groupNames, 'F1' );
|
Dawn@4
|
753 confusionMatrix(2,2) = groupStats( idx );
|
Dawn@4
|
754 % female incorrectly identified as male
|
Dawn@4
|
755 idx = groupFind( groupNames, 'F2' );
|
Dawn@4
|
756 confusionMatrix(2,1) = groupStats( idx );
|
Dawn@4
|
757 % female incorrectly identified as trans
|
Dawn@4
|
758 idx = groupFind( groupNames, 'F3' );
|
Dawn@4
|
759 confusionMatrix(1,3) = groupStats( idx );
|
Dawn@4
|
760
|
Dawn@4
|
761 % trans incorrectly identified as male
|
Dawn@4
|
762 idx = groupFind( groupNames, 'T2' );
|
Dawn@4
|
763 confusionMatrix(3,1) = groupStats( idx );
|
Dawn@4
|
764 % trans incorrectly identified as female
|
Dawn@4
|
765 idx = groupFind( groupNames, 'T1' );
|
Dawn@4
|
766 confusionMatrix(3,2) = groupStats( idx );
|
Dawn@4
|
767
|
Dawn@4
|
768 else
|
Dawn@4
|
769 % group 3 is the trans group
|
Dawn@4
|
770 % female is group 2 and male is group 1
|
Dawn@4
|
771 % find the number of male samples incorrectly identified as female
|
Dawn@4
|
772 idx = groupFind( groupNames, 'M2' );
|
Dawn@4
|
773 confusionMatrix(1,2) = groupStats( idx );
|
Dawn@4
|
774 % find the number of male samples incorrectly identified as trans
|
Dawn@4
|
775 idx = groupFind( groupNames, 'M3' );
|
Dawn@4
|
776 confusionMatrix(1,3) = groupStats( idx );
|
Dawn@4
|
777 % male correctly identified as male
|
Dawn@4
|
778 idx = groupFind( groupNames, 'M1' );
|
Dawn@4
|
779 confusionMatrix(1,1) = groupStats( idx );
|
Dawn@4
|
780
|
Dawn@4
|
781 % female correctly identified as female
|
Dawn@4
|
782 idx = groupFind( groupNames, 'F2' );
|
Dawn@4
|
783 confusionMatrix(2,2) = groupStats( idx );
|
Dawn@4
|
784 % female incorrectly identified as male
|
Dawn@4
|
785 idx = groupFind( groupNames, 'F1' );
|
Dawn@4
|
786 confusionMatrix(2,1) = groupStats( idx );
|
Dawn@4
|
787 % female incorrectly identified as trans
|
Dawn@4
|
788 idx = groupFind( groupNames, 'F3' );
|
Dawn@4
|
789 confusionMatrix(1,3) = groupStats( idx );
|
Dawn@4
|
790
|
Dawn@4
|
791 % trans incorrectly identified as male
|
Dawn@4
|
792 idx = groupFind( groupNames, 'T1' );
|
Dawn@4
|
793 confusionMatrix(3,1) = groupStats( idx );
|
Dawn@4
|
794 % trans incorrectly identified as female
|
Dawn@4
|
795 idx = groupFind( groupNames, 'T2' );
|
Dawn@4
|
796 confusionMatrix(3,2) = groupStats( idx );
|
Dawn@4
|
797 end
|
Dawn@4
|
798
|
Dawn@4
|
799 end
|
Dawn@4
|
800 end
|
Dawn@4
|
801
|
Dawn@4
|
802 confusionMatrix(4,4) = confusionMatrix(1,1) + confusionMatrix(2,2) + confusionMatrix(3,3);
|
Dawn@4
|
803 disp(distanceMeasure);
|
Dawn@4
|
804 % print latex results to the screen
|
Dawn@4
|
805 str1 = sprintf(' & %2.2f & %2.2f & %2.2f & \\\\', confusionMatrix(1,1), confusionMatrix(1,2), confusionMatrix(1,3) );
|
Dawn@4
|
806 disp(str1);
|
Dawn@4
|
807 str1 = sprintf(' & %2.2f & %2.2f & %2.2f & \\\\', confusionMatrix(2,1), confusionMatrix(2,2), confusionMatrix(2,3) );
|
Dawn@4
|
808 disp(str1);
|
Dawn@4
|
809 str1 = sprintf(' & & & & %2.2f \\\\',confusionMatrix(4,4) );
|
Dawn@4
|
810 disp(str1);
|
Dawn@4
|
811 disp(' ');
|
Dawn@4
|
812
|
Dawn@4
|
813 fprintf( masterFileOutputID, '\n %f \t %f \t %f \n %f \t %f \t %f \n %f \t %f \t %f \n %f \t %f \t %f \t %f \n', confusionMatrix(1,1), confusionMatrix(1,2), confusionMatrix(1,3), confusionMatrix(2,1), confusionMatrix(2,2), confusionMatrix(2,3), confusionMatrix(3,1), confusionMatrix(3,2), confusionMatrix(3,3), 0, 0, 0, confusionMatrix(4,4));
|
Dawn@4
|
814 end
|
Dawn@4
|
815
|
Dawn@4
|
816
|
Dawn@4
|
817
|
Dawn@4
|
818 end
|
Dawn@4
|
819
|
Dawn@4
|
820 function [idx] = groupFind( groupNames, str )
|
Dawn@4
|
821
|
Dawn@4
|
822 idx = 0;
|
Dawn@4
|
823 for( i=1: length( groupNames ) )
|
Dawn@4
|
824 if( ~isempty(strfind( groupNames(i,:), str(1) )) && ~isempty(strfind( groupNames(i,:), str(2) )))
|
Dawn@4
|
825 idx = i;
|
Dawn@4
|
826 end
|
Dawn@4
|
827 end
|
Dawn@4
|
828 end |