-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtests.txt
402 lines (319 loc) · 14.9 KB
/
tests.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
Tumor Labels: 1=meningioma, 2=glioma, 3=pituitary tumor
Contents:
3 tests of SVC with varying label counts
3 tests of LinearSVC with varying label counts
3 tests of NuSVC with varying label counts
1 test of SVc, LinearSVC, and NuSVC with all the same label counts
Classification Report Format explanation: http://scikit-learn.org/stable/modules/generated/sklearn.metrics.precision_recall_fscore_support.html#sklearn.metrics.precision_recall_fscore_support
Confusion Matrix explanation: http://scikit-learn.org/stable/modules/generated/sklearn.metrics.confusion_matrix.html
false positive - indicates that a label exists, when it does not
false negative - indicates that a label does NOT exist, while in fact it does
true positive - the proportion of actual labels that are correctly identified as such
true negative - the proportion of actual incorrect-labels that are correctly identified as such
[
[ c0c0 c0c1 c0c2]
[ c1c0 c1c1 c1c2]
[ c2c0 c2c1 c2c2]
]
FORMAT OF TESTS:
----------------------- Start Test #
SVC_TYPE
Trained: {1: # OF 1'S TRAINED ON, 2: # OF 2'S TRAINED ON, 3: # OF 3'S TRAINED ON}
Predicted: {1: # OF 1'S PREDICTED, 2: # OF 2'S PREDICTED, 3: # OF 3'S PREDICTED}
CLASSIFICATION REPORT (with accuracy of model at end)
----------------------- End Test #
@@@BEGIN COMPARISON BETWEEN MODELS - i.e. same trained counts (same targets to train off of) for each model)@@@
----------------------- Start Test 1
SVC
Trained: {1: 144, 2: 154, 3: 201} (same as Linear SVC and Nu SVC)
Predicted: {1: 121, 2: 224, 3: 155}
Classification report for classifier SVC(C=1.0, cache_size=200, class_weight=None, coef0=0.0,
decision_function_shape='ovr', degree=3, gamma=0.001, kernel='rbf',
max_iter=-1, probability=False, random_state=None, shrinking=True,
tol=0.001, verbose=False):
precision recall f1-score support
1 0.79 0.51 0.62 189
2 0.64 0.80 0.71 179
3 0.73 0.86 0.79 132
avg / total 0.72 0.71 0.70 500
Confusion matrix:
[[ 96 65 28]
[ 21 144 14]
[ 4 15 113]]
Accuracy of model: 0.8418418418418419
----------------------- End Test 1
----------------------- Start Test 2
Linear SVC
Trained: {1: 144, 2: 154, 3: 201} (same as SVC and Nu SVC)
Predicted: {1: 165, 2: 166, 3: 169}
Classification report for linear classifier LinearSVC(C=1.0, class_weight=None, dual=True, fit_intercept=True,
intercept_scaling=1, loss='squared_hinge', max_iter=1000,
multi_class='ovr', penalty='l2', random_state=None, tol=0.0001,
verbose=0):
precision recall f1-score support
1 0.68 0.59 0.63 189
2 0.70 0.65 0.68 179
3 0.64 0.82 0.72 132
avg / total 0.68 0.67 0.67 500
Confusion matrix:
[[112 38 39]
[ 40 117 22]
[ 13 11 108]]
Accuracy of model: 0.8368368368368369
----------------------- End Test 2
----------------------- Start Test 3
Nu SVC
Trained: {1: 144, 2: 154, 3: 201} (same as SVC and Linear SVC)
Predicted: {1: 142, 2: 130, 3: 228}
Classification report for nu classifier NuSVC(cache_size=200, class_weight=None, coef0=0.0,
decision_function_shape='ovr', degree=3, gamma='auto', kernel='rbf',
max_iter=-1, nu=0.5, probability=False, random_state=None,
shrinking=True, tol=0.001, verbose=False):
precision recall f1-score support
1 0.62 0.47 0.53 189
2 0.77 0.56 0.65 179
3 0.55 0.95 0.69 132
avg / total 0.65 0.63 0.62 500
Confusion matrix:
[[ 88 30 71]
[ 47 100 32]
[ 7 0 125]]
Accuracy of model: 0.7397397397397397
----------------------- End Test 3
@@@BEGIN SVC (compare between SVC runs ONLY w/ VARYING TARGETS)@@@
----------------------- Start Test 1
SVC
Trained: {1: 181, 2: 162, 3: 156}
Predicted: {1: 157, 2: 170, 3: 173}
Classification report for classifier SVC(C=1.0, cache_size=200, class_weight=None, coef0=0.0,
decision_function_shape='ovr', degree=3, gamma=0.001, kernel='rbf',
max_iter=-1, probability=False, random_state=None, shrinking=True,
tol=0.001, verbose=False):
precision recall f1-score support
1 0.77 0.80 0.78 152
2 0.81 0.81 0.81 171
3 0.92 0.90 0.91 177
avg / total 0.84 0.84 0.84 500
Confusion matrix:
[[121 24 7]
[ 26 138 7]
[ 10 8 159]]
Accuracy of model: 0.9079079079079079
----------------------- End Test 1
----------------------- Start Test 2
SVC
Trained: {1: 183, 2: 156, 3: 160}
Predicted: {1: 159, 2: 162, 3: 179}
Classification report for classifier SVC(C=1.0, cache_size=200, class_weight=None, coef0=0.0,
decision_function_shape='ovr', degree=3, gamma=0.001, kernel='rbf',
max_iter=-1, probability=False, random_state=None, shrinking=True,
tol=0.001, verbose=False):
precision recall f1-score support
1 0.72 0.76 0.74 150
2 0.85 0.78 0.81 177
3 0.86 0.89 0.88 173
avg / total 0.81 0.81 0.81 500
Confusion matrix:
[[114 22 14]
[ 28 138 11]
[ 17 2 154]]
Accuracy of model: 0.8918918918918919
----------------------- End Test 2
----------------------- Start Test 3
SVC
Trained: {1: 161, 2: 171, 3: 167}
Predicted: {1: 123, 2: 193, 3: 184}
Classification report for classifier SVC(C=1.0, cache_size=200, class_weight=None, coef0=0.0,
decision_function_shape='ovr', degree=3, gamma=0.001, kernel='rbf',
max_iter=-1, probability=False, random_state=None, shrinking=True,
tol=0.001, verbose=False):
precision recall f1-score support
1 0.85 0.60 0.71 172
2 0.69 0.83 0.75 162
3 0.82 0.91 0.86 166
avg / total 0.79 0.78 0.77 500
Confusion matrix:
[[104 50 18]
[ 13 134 15]
[ 6 9 151]]
Accuracy of model: 0.8738738738738738
----------------------- End Test 3
@@@BEGIN LINEAR SVC (compare between LINEAR SVC runs ONLY w/ VARYING TARGETS)@@@
----------------------- Start Test 4
Linear SVC
Trained: {1: 161, 2: 178, 3: 160}
Predicted: {1: 160, 2: 155, 3: 185}
Classification report for linear classifier LinearSVC(C=1.0, class_weight=None, dual=True, fit_intercept=True,
intercept_scaling=1, loss='squared_hinge', max_iter=1000,
multi_class='ovr', penalty='l2', random_state=None, tol=0.0001,
verbose=0):
precision recall f1-score support
1 0.76 0.71 0.73 172
2 0.74 0.74 0.74 155
3 0.82 0.88 0.85 173
avg / total 0.77 0.78 0.77 500
Confusion matrix:
[[122 35 15]
[ 23 114 18]
[ 15 6 152]]
Accuracy of model: 0.8878878878878879
----------------------- End Test 4
----------------------- Start Test 5
Linear SVC
Trained: {1: 178, 2: 158, 3: 163}
Predicted: {1: 176, 2: 150, 3: 174}
Classification report for linear classifier LinearSVC(C=1.0, class_weight=None, dual=True, fit_intercept=True,
intercept_scaling=1, loss='squared_hinge', max_iter=1000,
multi_class='ovr', penalty='l2', random_state=None, tol=0.0001,
verbose=0):
precision recall f1-score support
1 0.69 0.78 0.73 155
2 0.83 0.71 0.77 175
3 0.82 0.84 0.83 170
avg / total 0.78 0.78 0.78 500
Confusion matrix:
[[121 16 18]
[ 36 125 14]
[ 19 9 142]]
Accuracy of model: 0.8878878878878879
----------------------- End Test 5
----------------------- Start Test 6
Linear SVC
Trained: {1: 176, 2: 165, 3: 158}
Predicted: {1: 183, 2: 136, 3: 181}
Classification report for linear classifier LinearSVC(C=1.0, class_weight=None, dual=True, fit_intercept=True,
intercept_scaling=1, loss='squared_hinge', max_iter=1000,
multi_class='ovr', penalty='l2', random_state=None, tol=0.0001,
verbose=0):
precision recall f1-score support
1 0.66 0.76 0.71 157
2 0.84 0.68 0.75 168
3 0.83 0.86 0.84 175
avg / total 0.78 0.77 0.77 500
Confusion matrix:
[[120 21 16]
[ 39 114 15]
[ 24 1 150]]
Accuracy of model: 0.8838838838838838
----------------------- End Test 6
@@@BEGIN Nu SVC (compare between NU SVC runs ONLY w/ VARYING TARGETS)@@@
----------------------- Start Test 7
Nu SVC
Trained: {1: 174, 2: 166, 3: 159}
Predicted: {1: 171, 2: 121, 3: 208}
Classification report for nu classifier NuSVC(cache_size=200, class_weight=None, coef0=0.0,
decision_function_shape='ovr', degree=3, gamma='auto', kernel='rbf',
max_iter=-1, nu=0.5, probability=False, random_state=None,
shrinking=True, tol=0.001, verbose=False):
precision recall f1-score support
1 0.67 0.72 0.70 159
2 0.84 0.61 0.71 167
3 0.79 0.94 0.86 174
avg / total 0.77 0.76 0.76 500
Confusion matrix:
[[115 19 25]
[ 46 102 19]
[ 10 0 164]]
Accuracy of model: 0.8038038038038038
----------------------- End Test 7
----------------------- Start Test 8
Nu SVC
Trained: {1: 169, 2: 163, 3: 167}
Predicted: {1: 155, 2: 128, 3: 217}
Classification report for nu classifier NuSVC(cache_size=200, class_weight=None, coef0=0.0,
decision_function_shape='ovr', degree=3, gamma='auto', kernel='rbf',
max_iter=-1, nu=0.5, probability=False, random_state=None,
shrinking=True, tol=0.001, verbose=False):
precision recall f1-score support
1 0.74 0.70 0.72 164
2 0.88 0.66 0.76 170
3 0.74 0.97 0.84 166
avg / total 0.79 0.78 0.77 500
Confusion matrix:
[[115 15 34]
[ 35 113 22]
[ 5 0 161]]
Accuracy of model: 0.8068068068068068
----------------------- End Test 8
----------------------- Start Test 9
Nu SVC
Trained: {1: 176, 2: 155, 3: 168}
Predicted: {1: 162, 2: 126, 3: 212}
Classification report for nu classifier NuSVC(cache_size=200, class_weight=None, coef0=0.0,
decision_function_shape='ovr', degree=3, gamma='auto', kernel='rbf',
max_iter=-1, nu=0.5, probability=False, random_state=None,
shrinking=True, tol=0.001, verbose=False):
precision recall f1-score support
1 0.68 0.70 0.69 157
2 0.86 0.61 0.71 178
3 0.77 0.99 0.86 165
avg / total 0.77 0.76 0.75 500
Confusion matrix:
[[110 18 29]
[ 50 108 20]
[ 2 0 163]]
Accuracy of model: 0.8078078078078078
----------------------- End Test 9
ANALYSIS:
These three methods were tested on 999 MRI scans of brains with tumors. There are three kinds of tumors (meningioma, glioma, pituitary tumors), with 333 images of each type of tumor.
@@@ Comparison Between Each Model with Other Models @@@
Each trained on Same # of Targets: {1: 144, 2: 154, 3: 201}
i.e. 144 meningioma, 152 glioma, 201 pituitary tumors
SVC:
Predicted: {1: 121, 2: 224, 3: 155}
~84.18% accuracy
Linear SVC:
Predicted: {1: 165, 2: 166, 3: 169}
~83.68% accuracy
Nu SVC:
Predicted: {1: 142, 2: 130, 3: 228}
~73.98% accuracy
Analysis for Comparison Between Models:
Comparing the three methods, it appears that the C-Support Vector Classification (SVC) method was the most accurate at around 84.18% correct classifications, with the Linear Support Vector Classification (Linear SVC) method coming in second place at around 83.68% correct classifications. The Nu-Support Vector Classification (Nu SVC) method did the worst at around 73.98% correct classifications.
@@@ Comparison Between Each Model with Itself @@@
SVC:
Test 1:
Trained: {1: 181, 2: 162, 3: 156} i.e. 181 meningioma, 162 glioma, 156 pituitary tumors
Predicted: {1: 157, 2: 170, 3: 173}
~90.79% accuracy
Test 2:
Trained: {1: 183, 2: 156, 3: 160} i.e. 183 meningioma, 156 glioma, 160 pituitary tumors
Predicted: {1: 159, 2: 162, 3: 179}
~89.19% accuracy
Test 3:
Trained: {1: 161, 2: 171, 3: 167} i.e. 161 meningioma, 171 glioma, 167 pituitary tumors
Predicted: {1: 123, 2: 193, 3: 184}
~87.39% accuracy
Linear SVC:
Test 1:
Trained: {1: 161, 2: 178, 3: 160} i.e. 161 meningioma, 178 glioma, 160 pituitary tumors
Predicted: {1: 160, 2: 155, 3: 185}
~88.79% accuracy
Test 2:
Trained: {1: 178, 2: 158, 3: 163} i.e. 178 meningioma, 158 glioma, 163 pituitary tumors
Predicted: {1: 176, 2: 150, 3: 174}
~88.79% accuracy
Test 3:
Trained: {1: 176, 2: 165, 3: 158} i.e. 176 meningioma, 165 glioma, 158 pituitary tumors
Predicted: {1: 183, 2: 136, 3: 181}
~88.39% accuracy
Nu SVC:
Test 1:
Trained: {1: 174, 2: 166, 3: 159} i.e. 174 meningioma, 166 glioma, 159 pituitary tumors
Predicted: {1: 171, 2: 121, 3: 208}
~80.38% accuracy
Test 2:
Trained: {1: 169, 2: 163, 3: 167} i.e. 169 meningioma, 163 glioma, 167 pituitary tumors
Predicted: {1: 155, 2: 128, 3: 217}
~80.68% accuracy
Test 3:
Trained: {1: 176, 2: 155, 3: 168} i.e. 176 meningioma, 155 glioma, 168 pituitary tumors
Predicted: {1: 162, 2: 126, 3: 212}
~80.78% accuracy
Analysis for Models individually:
The C-Support Vector Classification (SVC) method was tested on three runs with varying target training data. SVC had between 87.39% and 90.79% accuracy for correct classifications.
The Linear Support Vector Classification (Linear SVC) method was tested on three runs with varying target training data. Linear SVC had between 88.39% and 88.79% accuracy for correct classifications.
The Nu-Support Vector Classification (Nu SVC) method was tested on three runs with varying target training data. Nu SVC had between 80.38% and 80.78% accuracy for correct classifications.
Overall Analysis:
Overall, it is evident that C-Support Vector Classification is more accurate in correct classification of these three brain tumors. It is 0.5% more accurate than the Linear Support Vector Classification method, and 7.5% more accurate than the Nu-Support Vector Classification method, when taught with the same target data.
Individually, SVC can still perform better (more accurately classify brain tumor images) than both Linear SVC and Nu SVC. However, SVC's classification accuracy is more unstable (has more spread), with a range between 87.39% and 90.79% accuracy (3.4% difference/spread in tests). Linear SVC performed worse than SVC and better than Nu SVC, but it's classification accuracy has less spread than SVC, with a range between 88.39% and 88.79% accuracy (0.4% difference/spread in tests). Nu SVC performs the worst, but it's classification accuracy beats that of SVC and is roughly the same as Linear SVC, with a range between 80.38% and 80.78% accuracy (0.4% difference/spread in tests).