a b/SMOTE-NC/R2-XGB-SMOTENC.ipynb
1
{
2
 "cells": [
3
  {
4
   "cell_type": "code",
5
   "execution_count": 1,
6
   "metadata": {},
7
   "outputs": [
8
    {
9
     "data": {
10
      "text/html": [
11
       "<script type=\"text/javascript\">window.PlotlyConfig = {MathJaxConfig: 'local'};</script><script type=\"text/javascript\">if (window.MathJax) {MathJax.Hub.Config({SVG: {font: \"STIX-Web\"}});}</script><script>requirejs.config({paths: { 'plotly': ['https://cdn.plot.ly/plotly-latest.min']},});if(!window._Plotly) {require(['plotly'],function(plotly) {window._Plotly=plotly;});}</script>"
12
      ],
13
      "text/vnd.plotly.v1+html": [
14
       "<script type=\"text/javascript\">window.PlotlyConfig = {MathJaxConfig: 'local'};</script><script type=\"text/javascript\">if (window.MathJax) {MathJax.Hub.Config({SVG: {font: \"STIX-Web\"}});}</script><script>requirejs.config({paths: { 'plotly': ['https://cdn.plot.ly/plotly-latest.min']},});if(!window._Plotly) {require(['plotly'],function(plotly) {window._Plotly=plotly;});}</script>"
15
      ]
16
     },
17
     "metadata": {},
18
     "output_type": "display_data"
19
    }
20
   ],
21
   "source": [
22
    "# Import libraries\n",
23
    "import numpy as np\n",
24
    "import pandas as pd\n",
25
    "import matplotlib.pyplot as plt\n",
26
    "import getpass\n",
27
    "import pdvega\n",
28
    "import plotly.graph_objs as go\n",
29
    "\n",
30
    "from plotly.offline import iplot, init_notebook_mode\n",
31
    "import plotly.io as pio\n",
32
    "from plotly.graph_objs import *\n",
33
    "\n",
34
    "# for configuring connection \n",
35
    "from configobj import ConfigObj\n",
36
    "import os\n",
37
    "\n",
38
    "%matplotlib inline\n",
39
    "\n",
40
    "\n",
41
    "import os\n",
42
    "\n",
43
    "\n",
44
    "from sklearn import linear_model\n",
45
    "from sklearn import metrics\n",
46
    "from sklearn.model_selection import train_test_split\n",
47
    "\n",
48
    "#configure the notebook for use in offline mode\n",
49
    "init_notebook_mode(connected=True)"
50
   ]
51
  },
52
  {
53
   "cell_type": "code",
54
   "execution_count": 2,
55
   "metadata": {},
56
   "outputs": [
57
    {
58
     "data": {
59
      "text/html": [
60
       "<div>\n",
61
       "<style scoped>\n",
62
       "    .dataframe tbody tr th:only-of-type {\n",
63
       "        vertical-align: middle;\n",
64
       "    }\n",
65
       "\n",
66
       "    .dataframe tbody tr th {\n",
67
       "        vertical-align: top;\n",
68
       "    }\n",
69
       "\n",
70
       "    .dataframe thead th {\n",
71
       "        text-align: right;\n",
72
       "    }\n",
73
       "</style>\n",
74
       "<table border=\"1\" class=\"dataframe\">\n",
75
       "  <thead>\n",
76
       "    <tr style=\"text-align: right;\">\n",
77
       "      <th></th>\n",
78
       "      <th>Unnamed: 0</th>\n",
79
       "      <th>hospitalid</th>\n",
80
       "      <th>sodium</th>\n",
81
       "      <th>electivesurgery</th>\n",
82
       "      <th>vent</th>\n",
83
       "      <th>dialysis</th>\n",
84
       "      <th>gcs</th>\n",
85
       "      <th>urine</th>\n",
86
       "      <th>wbc</th>\n",
87
       "      <th>temperature</th>\n",
88
       "      <th>...</th>\n",
89
       "      <th>m11_True</th>\n",
90
       "      <th>m12_True</th>\n",
91
       "      <th>m13_True</th>\n",
92
       "      <th>m14_True</th>\n",
93
       "      <th>m15_True</th>\n",
94
       "      <th>m16_True</th>\n",
95
       "      <th>m17_True</th>\n",
96
       "      <th>m18_True</th>\n",
97
       "      <th>m19_True</th>\n",
98
       "      <th>m20_True</th>\n",
99
       "    </tr>\n",
100
       "  </thead>\n",
101
       "  <tbody>\n",
102
       "    <tr>\n",
103
       "      <th>0</th>\n",
104
       "      <td>0</td>\n",
105
       "      <td>59.0</td>\n",
106
       "      <td>139.0</td>\n",
107
       "      <td>-1.0</td>\n",
108
       "      <td>0.0</td>\n",
109
       "      <td>0.0</td>\n",
110
       "      <td>15.0</td>\n",
111
       "      <td>-1.0</td>\n",
112
       "      <td>14.7</td>\n",
113
       "      <td>36.1</td>\n",
114
       "      <td>...</td>\n",
115
       "      <td>1</td>\n",
116
       "      <td>0</td>\n",
117
       "      <td>0</td>\n",
118
       "      <td>1</td>\n",
119
       "      <td>1</td>\n",
120
       "      <td>0</td>\n",
121
       "      <td>0</td>\n",
122
       "      <td>0</td>\n",
123
       "      <td>1</td>\n",
124
       "      <td>0</td>\n",
125
       "    </tr>\n",
126
       "    <tr>\n",
127
       "      <th>1</th>\n",
128
       "      <td>1</td>\n",
129
       "      <td>73.0</td>\n",
130
       "      <td>134.0</td>\n",
131
       "      <td>-1.0</td>\n",
132
       "      <td>0.0</td>\n",
133
       "      <td>0.0</td>\n",
134
       "      <td>13.0</td>\n",
135
       "      <td>-1.0</td>\n",
136
       "      <td>14.1</td>\n",
137
       "      <td>39.3</td>\n",
138
       "      <td>...</td>\n",
139
       "      <td>1</td>\n",
140
       "      <td>0</td>\n",
141
       "      <td>0</td>\n",
142
       "      <td>1</td>\n",
143
       "      <td>1</td>\n",
144
       "      <td>0</td>\n",
145
       "      <td>0</td>\n",
146
       "      <td>0</td>\n",
147
       "      <td>1</td>\n",
148
       "      <td>0</td>\n",
149
       "    </tr>\n",
150
       "    <tr>\n",
151
       "      <th>2</th>\n",
152
       "      <td>2</td>\n",
153
       "      <td>73.0</td>\n",
154
       "      <td>-1.0</td>\n",
155
       "      <td>1.0</td>\n",
156
       "      <td>1.0</td>\n",
157
       "      <td>0.0</td>\n",
158
       "      <td>15.0</td>\n",
159
       "      <td>-1.0</td>\n",
160
       "      <td>8.0</td>\n",
161
       "      <td>34.8</td>\n",
162
       "      <td>...</td>\n",
163
       "      <td>0</td>\n",
164
       "      <td>0</td>\n",
165
       "      <td>1</td>\n",
166
       "      <td>0</td>\n",
167
       "      <td>0</td>\n",
168
       "      <td>1</td>\n",
169
       "      <td>0</td>\n",
170
       "      <td>1</td>\n",
171
       "      <td>0</td>\n",
172
       "      <td>0</td>\n",
173
       "    </tr>\n",
174
       "    <tr>\n",
175
       "      <th>3</th>\n",
176
       "      <td>3</td>\n",
177
       "      <td>63.0</td>\n",
178
       "      <td>137.0</td>\n",
179
       "      <td>-1.0</td>\n",
180
       "      <td>0.0</td>\n",
181
       "      <td>0.0</td>\n",
182
       "      <td>15.0</td>\n",
183
       "      <td>-1.0</td>\n",
184
       "      <td>10.9</td>\n",
185
       "      <td>36.6</td>\n",
186
       "      <td>...</td>\n",
187
       "      <td>1</td>\n",
188
       "      <td>0</td>\n",
189
       "      <td>1</td>\n",
190
       "      <td>1</td>\n",
191
       "      <td>1</td>\n",
192
       "      <td>0</td>\n",
193
       "      <td>0</td>\n",
194
       "      <td>1</td>\n",
195
       "      <td>1</td>\n",
196
       "      <td>0</td>\n",
197
       "    </tr>\n",
198
       "    <tr>\n",
199
       "      <th>4</th>\n",
200
       "      <td>4</td>\n",
201
       "      <td>63.0</td>\n",
202
       "      <td>135.0</td>\n",
203
       "      <td>-1.0</td>\n",
204
       "      <td>0.0</td>\n",
205
       "      <td>0.0</td>\n",
206
       "      <td>15.0</td>\n",
207
       "      <td>-1.0</td>\n",
208
       "      <td>5.9</td>\n",
209
       "      <td>35.0</td>\n",
210
       "      <td>...</td>\n",
211
       "      <td>0</td>\n",
212
       "      <td>0</td>\n",
213
       "      <td>1</td>\n",
214
       "      <td>0</td>\n",
215
       "      <td>0</td>\n",
216
       "      <td>0</td>\n",
217
       "      <td>0</td>\n",
218
       "      <td>1</td>\n",
219
       "      <td>0</td>\n",
220
       "      <td>0</td>\n",
221
       "    </tr>\n",
222
       "  </tbody>\n",
223
       "</table>\n",
224
       "<p>5 rows × 85 columns</p>\n",
225
       "</div>"
226
      ],
227
      "text/plain": [
228
       "   Unnamed: 0  hospitalid  sodium  electivesurgery  vent  dialysis   gcs  \\\n",
229
       "0           0        59.0   139.0             -1.0   0.0       0.0  15.0   \n",
230
       "1           1        73.0   134.0             -1.0   0.0       0.0  13.0   \n",
231
       "2           2        73.0    -1.0              1.0   1.0       0.0  15.0   \n",
232
       "3           3        63.0   137.0             -1.0   0.0       0.0  15.0   \n",
233
       "4           4        63.0   135.0             -1.0   0.0       0.0  15.0   \n",
234
       "\n",
235
       "   urine   wbc  temperature  ...  m11_True  m12_True  m13_True  m14_True  \\\n",
236
       "0   -1.0  14.7         36.1  ...         1         0         0         1   \n",
237
       "1   -1.0  14.1         39.3  ...         1         0         0         1   \n",
238
       "2   -1.0   8.0         34.8  ...         0         0         1         0   \n",
239
       "3   -1.0  10.9         36.6  ...         1         0         1         1   \n",
240
       "4   -1.0   5.9         35.0  ...         0         0         1         0   \n",
241
       "\n",
242
       "   m15_True  m16_True  m17_True  m18_True  m19_True  m20_True  \n",
243
       "0         1         0         0         0         1         0  \n",
244
       "1         1         0         0         0         1         0  \n",
245
       "2         0         1         0         1         0         0  \n",
246
       "3         1         0         0         1         1         0  \n",
247
       "4         0         0         0         1         0         0  \n",
248
       "\n",
249
       "[5 rows x 85 columns]"
250
      ]
251
     },
252
     "execution_count": 2,
253
     "metadata": {},
254
     "output_type": "execute_result"
255
    }
256
   ],
257
   "source": [
258
    "df= pd.read_csv(\"analysis.csv\")\n",
259
    "df.head()"
260
   ]
261
  },
262
  {
263
   "cell_type": "code",
264
   "execution_count": 4,
265
   "metadata": {},
266
   "outputs": [
267
    {
268
     "data": {
269
      "text/plain": [
270
       "(95148, 85)"
271
      ]
272
     },
273
     "execution_count": 4,
274
     "metadata": {},
275
     "output_type": "execute_result"
276
    }
277
   ],
278
   "source": [
279
    "df.shape"
280
   ]
281
  },
282
  {
283
   "cell_type": "code",
284
   "execution_count": 5,
285
   "metadata": {},
286
   "outputs": [],
287
   "source": [
288
    "del df['hospitalid']\n",
289
    "\n",
290
    "df = df.drop(df.columns[[0]], axis=1)\n",
291
    "df = df.drop(df.columns[[63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82]], axis=1)"
292
   ]
293
  },
294
  {
295
   "cell_type": "code",
296
   "execution_count": 6,
297
   "metadata": {},
298
   "outputs": [
299
    {
300
     "data": {
301
      "text/plain": [
302
       "sodium                        18244\n",
303
       "electivesurgery               74997\n",
304
       "vent                              0\n",
305
       "dialysis                          0\n",
306
       "gcs                            1728\n",
307
       "urine                         45829\n",
308
       "wbc                           22141\n",
309
       "temperature                    4139\n",
310
       "respiratoryrate                 582\n",
311
       "heartrate                       188\n",
312
       "meanbp                          263\n",
313
       "creatinine                    18332\n",
314
       "ph                            73474\n",
315
       "hematocrit                    20021\n",
316
       "albumin                       58143\n",
317
       "pao2                          73474\n",
318
       "pco2                          73474\n",
319
       "bun                           18774\n",
320
       "glucose                       10909\n",
321
       "bilirubin                     60797\n",
322
       "fio2                          73474\n",
323
       "age                            3356\n",
324
       "thrombolytics                     0\n",
325
       "aids                              0\n",
326
       "hepaticfailure                    0\n",
327
       "lymphoma                          0\n",
328
       "metastaticcancer                  0\n",
329
       "leukemia                          0\n",
330
       "immunosuppression                 0\n",
331
       "cirrhosis                         0\n",
332
       "                              ...  \n",
333
       "admitsource_1.0                   0\n",
334
       "admitsource_2.0                   0\n",
335
       "admitsource_3.0                   0\n",
336
       "admitsource_4.0                   0\n",
337
       "admitsource_5.0                   0\n",
338
       "admitsource_6.0                   0\n",
339
       "admitsource_7.0                   0\n",
340
       "admitsource_8.0                   0\n",
341
       "diaggroup_ARF                     0\n",
342
       "diaggroup_Asthma-Emphys           0\n",
343
       "diaggroup_CABG                    0\n",
344
       "diaggroup_CHF                     0\n",
345
       "diaggroup_CVA                     0\n",
346
       "diaggroup_CVOther                 0\n",
347
       "diaggroup_CardiacArrest           0\n",
348
       "diaggroup_ChestPainUnknown        0\n",
349
       "diaggroup_Coma                    0\n",
350
       "diaggroup_DKA                     0\n",
351
       "diaggroup_GIBleed                 0\n",
352
       "diaggroup_GIObstruction           0\n",
353
       "diaggroup_Neuro                   0\n",
354
       "diaggroup_Other                   0\n",
355
       "diaggroup_Overdose                0\n",
356
       "diaggroup_PNA                     0\n",
357
       "diaggroup_RespMedOther            0\n",
358
       "diaggroup_Sepsis                  0\n",
359
       "diaggroup_Trauma                  0\n",
360
       "diaggroup_ValveDz                 0\n",
361
       "gender_Male                       0\n",
362
       "gender_Other                      0\n",
363
       "Length: 63, dtype: int64"
364
      ]
365
     },
366
     "execution_count": 6,
367
     "metadata": {},
368
     "output_type": "execute_result"
369
    }
370
   ],
371
   "source": [
372
    "missing_values_count = df.isnull().sum()\n",
373
    "#df.replace('-1.0', np.nan)\n",
374
    "df = df.replace({-1.0:np.nan, -1.0:np.nan})\n",
375
    "df.head()\n",
376
    "missing_values_count = df.isnull().sum()\n",
377
    "missing_values_count"
378
   ]
379
  },
380
  {
381
   "cell_type": "markdown",
382
   "metadata": {},
383
   "source": [
384
    "**We moved all the pre-processing including splitting>imputation>Standardization to the CV iterations**"
385
   ]
386
  },
387
  {
388
   "cell_type": "code",
389
   "execution_count": 8,
390
   "metadata": {},
391
   "outputs": [],
392
   "source": [
393
    "cols_to_norm=['gcs', 'urine', 'wbc', 'sodium',\n",
394
    "       'temperature', 'respiratoryrate', 'heartrate', 'meanbp', 'creatinine',\n",
395
    "       'ph', 'hematocrit', 'albumin', 'pao2', 'pco2', 'bun', 'glucose',\n",
396
    "       'bilirubin', 'fio2', 'age', 'offset']\n",
397
    "\n",
398
    "X=df.drop('destcopy', 1)\n",
399
    "y=df['destcopy']\n",
400
    "df_cols = list(X)     #fancy impute removes column names."
401
   ]
402
  },
403
  {
404
   "cell_type": "code",
405
   "execution_count": 9,
406
   "metadata": {},
407
   "outputs": [
408
    {
409
     "data": {
410
      "text/plain": [
411
       "Index(['sodium', 'electivesurgery', 'vent', 'dialysis', 'gcs', 'urine', 'wbc',\n",
412
       "       'temperature', 'respiratoryrate', 'heartrate', 'meanbp', 'creatinine',\n",
413
       "       'ph', 'hematocrit', 'albumin', 'pao2', 'pco2', 'bun', 'glucose',\n",
414
       "       'bilirubin', 'fio2', 'age', 'thrombolytics', 'aids', 'hepaticfailure',\n",
415
       "       'lymphoma', 'metastaticcancer', 'leukemia', 'immunosuppression',\n",
416
       "       'cirrhosis', 'readmit', 'offset', 'destcopy', 'admitsource_1.0',\n",
417
       "       'admitsource_2.0', 'admitsource_3.0', 'admitsource_4.0',\n",
418
       "       'admitsource_5.0', 'admitsource_6.0', 'admitsource_7.0',\n",
419
       "       'admitsource_8.0', 'diaggroup_ARF', 'diaggroup_Asthma-Emphys',\n",
420
       "       'diaggroup_CABG', 'diaggroup_CHF', 'diaggroup_CVA', 'diaggroup_CVOther',\n",
421
       "       'diaggroup_CardiacArrest', 'diaggroup_ChestPainUnknown',\n",
422
       "       'diaggroup_Coma', 'diaggroup_DKA', 'diaggroup_GIBleed',\n",
423
       "       'diaggroup_GIObstruction', 'diaggroup_Neuro', 'diaggroup_Other',\n",
424
       "       'diaggroup_Overdose', 'diaggroup_PNA', 'diaggroup_RespMedOther',\n",
425
       "       'diaggroup_Sepsis', 'diaggroup_Trauma', 'diaggroup_ValveDz',\n",
426
       "       'gender_Male', 'gender_Other'],\n",
427
       "      dtype='object')"
428
      ]
429
     },
430
     "execution_count": 9,
431
     "metadata": {},
432
     "output_type": "execute_result"
433
    }
434
   ],
435
   "source": [
436
    "df.columns"
437
   ]
438
  },
439
  {
440
   "cell_type": "markdown",
441
   "metadata": {},
442
   "source": [
443
    "**XGB**"
444
   ]
445
  },
446
  {
447
   "cell_type": "code",
448
   "execution_count": 10,
449
   "metadata": {},
450
   "outputs": [],
451
   "source": [
452
    "from collections import Counter"
453
   ]
454
  },
455
  {
456
   "cell_type": "code",
457
   "execution_count": 11,
458
   "metadata": {},
459
   "outputs": [
460
    {
461
     "name": "stderr",
462
     "output_type": "stream",
463
     "text": [
464
      "C:\\Users\\llois\\Anaconda\\lib\\site-packages\\sklearn\\externals\\six.py:31: DeprecationWarning:\n",
465
      "\n",
466
      "The module is deprecated in version 0.21 and will be removed in version 0.23 since we've dropped support for Python 2.7. Please rely on the official version of six (https://pypi.org/project/six/).\n",
467
      "\n"
468
     ]
469
    },
470
    {
471
     "name": "stdout",
472
     "output_type": "stream",
473
     "text": [
474
      "[(1, 59442), (2, 59442), (3, 59442), (4, 59442)]\n",
475
      "For fold 1:\n",
476
      "Accuracy: 0.7169732002101944\n",
477
      "f-score: 0.7169732002101944\n",
478
      "                   pre       rec       spe        f1       geo       iba       sup\n",
479
      "\n",
480
      "          1       0.39      0.48      0.95      0.43      0.68      0.44       642\n",
481
      "          2       0.79      0.90      0.41      0.84      0.61      0.39      6776\n",
482
      "          3       0.46      0.20      0.95      0.28      0.44      0.18      1716\n",
483
      "          4       0.15      0.10      0.98      0.12      0.31      0.09       381\n",
484
      "\n",
485
      "avg / total       0.68      0.72      0.57      0.69      0.57      0.34      9515\n",
486
      "\n",
487
      "[(1, 58698), (2, 58698), (3, 58698), (4, 58698)]\n",
488
      "For fold 2:\n",
489
      "Accuracy: 0.7043615344193379\n",
490
      "f-score: 0.7043615344193379\n",
491
      "                   pre       rec       spe        f1       geo       iba       sup\n",
492
      "\n",
493
      "          1       0.47      0.51      0.93      0.49      0.69      0.46       974\n",
494
      "          2       0.87      0.79      0.57      0.83      0.67      0.46      7520\n",
495
      "          3       0.16      0.30      0.87      0.20      0.51      0.24       697\n",
496
      "          4       0.10      0.10      0.97      0.10      0.30      0.08       324\n",
497
      "\n",
498
      "avg / total       0.75      0.70      0.64      0.73      0.65      0.43      9515\n",
499
      "\n",
500
      "[(1, 59633), (2, 59633), (3, 59633), (4, 59633)]\n",
501
      "For fold 3:\n",
502
      "Accuracy: 0.7086705202312139\n",
503
      "f-score: 0.7086705202312139\n",
504
      "                   pre       rec       spe        f1       geo       iba       sup\n",
505
      "\n",
506
      "          1       0.57      0.59      0.93      0.58      0.74      0.53      1247\n",
507
      "          2       0.81      0.86      0.54      0.83      0.68      0.48      6585\n",
508
      "          3       0.33      0.23      0.91      0.27      0.46      0.20      1462\n",
509
      "          4       0.10      0.10      0.98      0.10      0.31      0.08       221\n",
510
      "\n",
511
      "avg / total       0.69      0.71      0.66      0.70      0.65      0.43      9515\n",
512
      "\n",
513
      "[(1, 59870), (2, 59870), (3, 59870), (4, 59870)]\n",
514
      "For fold 4:\n",
515
      "Accuracy: 0.6671571203363111\n",
516
      "f-score: 0.6671571203363111\n",
517
      "                   pre       rec       spe        f1       geo       iba       sup\n",
518
      "\n",
519
      "          1       0.48      0.58      0.92      0.52      0.73      0.51      1129\n",
520
      "          2       0.78      0.84      0.51      0.81      0.66      0.45      6348\n",
521
      "          3       0.30      0.19      0.93      0.23      0.42      0.16      1285\n",
522
      "          4       0.22      0.13      0.96      0.17      0.36      0.12       753\n",
523
      "\n",
524
      "avg / total       0.63      0.67      0.65      0.65      0.61      0.39      9515\n",
525
      "\n",
526
      "[(1, 59781), (2, 59781), (3, 59781), (4, 59781)]\n",
527
      "For fold 5:\n",
528
      "Accuracy: 0.6906988964792433\n",
529
      "f-score: 0.6906988964792433\n",
530
      "                   pre       rec       spe        f1       geo       iba       sup\n",
531
      "\n",
532
      "          1       0.53      0.55      0.94      0.54      0.72      0.49      1085\n",
533
      "          2       0.78      0.87      0.50      0.82      0.66      0.45      6437\n",
534
      "          3       0.40      0.19      0.94      0.26      0.43      0.17      1657\n",
535
      "          4       0.12      0.16      0.96      0.14      0.39      0.14       336\n",
536
      "\n",
537
      "avg / total       0.66      0.69      0.64      0.67      0.61      0.39      9515\n",
538
      "\n",
539
      "[(1, 59994), (2, 59994), (3, 59994), (4, 59994)]\n",
540
      "For fold 6:\n",
541
      "Accuracy: 0.6855491329479769\n",
542
      "f-score: 0.6855491329479769\n",
543
      "                   pre       rec       spe        f1       geo       iba       sup\n",
544
      "\n",
545
      "          1       0.42      0.55      0.93      0.47      0.71      0.49       785\n",
546
      "          2       0.76      0.90      0.46      0.82      0.64      0.43      6224\n",
547
      "          3       0.50      0.22      0.94      0.31      0.46      0.19      2026\n",
548
      "          4       0.19      0.08      0.98      0.11      0.28      0.07       480\n",
549
      "\n",
550
      "avg / total       0.65      0.69      0.63      0.65      0.59      0.37      9515\n",
551
      "\n",
552
      "[(1, 59534), (2, 59534), (3, 59534), (4, 59534)]\n",
553
      "For fold 7:\n",
554
      "Accuracy: 0.7142406726221755\n",
555
      "f-score: 0.7142406726221755\n",
556
      "                   pre       rec       spe        f1       geo       iba       sup\n",
557
      "\n",
558
      "          1       0.50      0.51      0.95      0.51      0.70      0.47       853\n",
559
      "          2       0.80      0.90      0.46      0.84      0.64      0.43      6684\n",
560
      "          3       0.35      0.26      0.93      0.29      0.49      0.22      1209\n",
561
      "          4       0.26      0.08      0.98      0.12      0.28      0.07       769\n",
562
      "\n",
563
      "avg / total       0.67      0.71      0.61      0.69      0.60      0.38      9515\n",
564
      "\n",
565
      "[(1, 59573), (2, 59573), (3, 59573), (4, 59573)]\n",
566
      "For fold 8:\n",
567
      "Accuracy: 0.7141355754072517\n",
568
      "f-score: 0.7141355754072517\n",
569
      "                   pre       rec       spe        f1       geo       iba       sup\n",
570
      "\n",
571
      "          1       0.55      0.46      0.96      0.50      0.66      0.42       933\n",
572
      "          2       0.78      0.91      0.41      0.84      0.61      0.39      6645\n",
573
      "          3       0.39      0.20      0.93      0.26      0.43      0.17      1675\n",
574
      "          4       0.10      0.06      0.98      0.08      0.25      0.06       262\n",
575
      "\n",
576
      "avg / total       0.67      0.71      0.57      0.68      0.57      0.34      9515\n",
577
      "\n",
578
      "[(1, 59819), (2, 59819), (3, 59819), (4, 59819)]\n",
579
      "For fold 9:\n",
580
      "Accuracy: 0.6835190245953332\n",
581
      "f-score: 0.6835190245953332\n",
582
      "                   pre       rec       spe        f1       geo       iba       sup\n",
583
      "\n",
584
      "          1       0.52      0.54      0.94      0.53      0.71      0.49      1031\n",
585
      "          2       0.78      0.87      0.50      0.82      0.66      0.46      6399\n",
586
      "          3       0.35      0.20      0.93      0.25      0.43      0.17      1495\n",
587
      "          4       0.16      0.13      0.96      0.14      0.35      0.11       589\n",
588
      "\n",
589
      "avg / total       0.65      0.68      0.65      0.66      0.61      0.39      9514\n",
590
      "\n",
591
      "[(1, 59618), (2, 59618), (3, 59618), (4, 59618)]\n",
592
      "For fold 10:\n",
593
      "Accuracy: 0.6930838763926844\n",
594
      "f-score: 0.6930838763926844\n",
595
      "                   pre       rec       spe        f1       geo       iba       sup\n",
596
      "\n",
597
      "          1       0.52      0.61      0.92      0.56      0.75      0.54      1157\n",
598
      "          2       0.81      0.85      0.56      0.83      0.69      0.48      6600\n",
599
      "          3       0.30      0.22      0.93      0.25      0.45      0.19      1156\n",
600
      "          4       0.12      0.09      0.96      0.11      0.30      0.08       601\n",
601
      "\n",
602
      "avg / total       0.67      0.69      0.67      0.68      0.64      0.43      9514\n",
603
      "\n",
604
      "[(1, 59442), (2, 59442), (3, 59442), (4, 59442)]\n",
605
      "For fold 1:\n",
606
      "Accuracy: 0.7202312138728324\n",
607
      "f-score: 0.7202312138728324\n",
608
      "                   pre       rec       spe        f1       geo       iba       sup\n",
609
      "\n",
610
      "          1       0.42      0.49      0.95      0.45      0.68      0.44       642\n",
611
      "          2       0.79      0.91      0.41      0.84      0.61      0.39      6776\n",
612
      "          3       0.45      0.21      0.94      0.29      0.44      0.18      1716\n",
613
      "          4       0.18      0.11      0.98      0.14      0.33      0.10       381\n",
614
      "\n",
615
      "avg / total       0.68      0.72      0.57      0.69      0.57      0.34      9515\n",
616
      "\n",
617
      "[(1, 58698), (2, 58698), (3, 58698), (4, 58698)]\n",
618
      "For fold 2:\n",
619
      "Accuracy: 0.7106673673147662\n",
620
      "f-score: 0.7106673673147662\n",
621
      "                   pre       rec       spe        f1       geo       iba       sup\n",
622
      "\n",
623
      "          1       0.48      0.54      0.93      0.50      0.71      0.48       974\n",
624
      "          2       0.88      0.80      0.58      0.84      0.68      0.48      7520\n",
625
      "          3       0.17      0.31      0.88      0.22      0.52      0.26       697\n",
626
      "          4       0.09      0.08      0.97      0.09      0.28      0.07       324\n",
627
      "\n",
628
      "avg / total       0.76      0.71      0.66      0.73      0.66      0.45      9515\n",
629
      "\n",
630
      "[(1, 59633), (2, 59633), (3, 59633), (4, 59633)]\n",
631
      "For fold 3:\n",
632
      "Accuracy: 0.7089858118759853\n",
633
      "f-score: 0.7089858118759853\n",
634
      "                   pre       rec       spe        f1       geo       iba       sup\n",
635
      "\n",
636
      "          1       0.57      0.58      0.93      0.57      0.73      0.52      1247\n",
637
      "          2       0.81      0.86      0.55      0.83      0.68      0.48      6585\n",
638
      "          3       0.34      0.25      0.91      0.29      0.48      0.21      1462\n",
639
      "          4       0.06      0.06      0.98      0.06      0.24      0.05       221\n",
640
      "\n",
641
      "avg / total       0.69      0.71      0.66      0.70      0.65      0.44      9515\n",
642
      "\n",
643
      "[(1, 59870), (2, 59870), (3, 59870), (4, 59870)]\n",
644
      "For fold 4:\n",
645
      "Accuracy: 0.6689437729900157\n",
646
      "f-score: 0.6689437729900157\n",
647
      "                   pre       rec       spe        f1       geo       iba       sup\n",
648
      "\n",
649
      "          1       0.47      0.57      0.91      0.52      0.72      0.51      1129\n",
650
      "          2       0.78      0.84      0.52      0.81      0.67      0.46      6348\n",
651
      "          3       0.31      0.20      0.93      0.24      0.43      0.17      1285\n",
652
      "          4       0.23      0.13      0.96      0.16      0.35      0.11       753\n",
653
      "\n",
654
      "avg / total       0.64      0.67      0.66      0.65      0.62      0.40      9515\n",
655
      "\n",
656
      "[(1, 59781), (2, 59781), (3, 59781), (4, 59781)]\n",
657
      "For fold 5:\n",
658
      "Accuracy: 0.6909090909090909\n",
659
      "f-score: 0.6909090909090909\n",
660
      "                   pre       rec       spe        f1       geo       iba       sup\n",
661
      "\n",
662
      "          1       0.54      0.56      0.94      0.55      0.73      0.51      1085\n",
663
      "          2       0.79      0.87      0.51      0.83      0.66      0.46      6437\n",
664
      "          3       0.41      0.20      0.94      0.27      0.43      0.17      1657\n",
665
      "          4       0.08      0.11      0.95      0.09      0.32      0.09       336\n",
666
      "\n",
667
      "avg / total       0.67      0.69      0.65      0.67      0.62      0.40      9515\n",
668
      "\n",
669
      "[(1, 59994), (2, 59994), (3, 59994), (4, 59994)]\n",
670
      "For fold 6:\n",
671
      "Accuracy: 0.6831318970047294\n",
672
      "f-score: 0.6831318970047294\n",
673
      "                   pre       rec       spe        f1       geo       iba       sup\n",
674
      "\n",
675
      "          1       0.42      0.53      0.93      0.47      0.70      0.47       785\n",
676
      "          2       0.76      0.90      0.45      0.82      0.64      0.43      6224\n",
677
      "          3       0.50      0.21      0.94      0.30      0.45      0.19      2026\n",
678
      "          4       0.15      0.07      0.98      0.10      0.26      0.06       480\n",
679
      "\n",
680
      "avg / total       0.64      0.68      0.62      0.65      0.59      0.36      9515\n",
681
      "\n",
682
      "[(1, 59534), (2, 59534), (3, 59534), (4, 59534)]\n",
683
      "For fold 7:\n",
684
      "Accuracy: 0.7130846032580137\n",
685
      "f-score: 0.7130846032580137\n",
686
      "                   pre       rec       spe        f1       geo       iba       sup\n",
687
      "\n",
688
      "          1       0.49      0.51      0.95      0.50      0.69      0.46       853\n",
689
      "          2       0.80      0.89      0.47      0.84      0.65      0.43      6684\n",
690
      "          3       0.36      0.28      0.93      0.31      0.51      0.24      1209\n",
691
      "          4       0.29      0.08      0.98      0.13      0.29      0.07       769\n",
692
      "\n",
693
      "avg / total       0.67      0.71      0.61      0.69      0.60      0.38      9515\n",
694
      "\n",
695
      "[(1, 59573), (2, 59573), (3, 59573), (4, 59573)]\n",
696
      "For fold 8:\n",
697
      "Accuracy: 0.7142406726221755\n",
698
      "f-score: 0.7142406726221755\n",
699
      "                   pre       rec       spe        f1       geo       iba       sup\n",
700
      "\n",
701
      "          1       0.54      0.47      0.96      0.50      0.67      0.43       933\n",
702
      "          2       0.78      0.91      0.41      0.84      0.61      0.39      6645\n",
703
      "          3       0.40      0.20      0.94      0.26      0.43      0.17      1675\n",
704
      "          4       0.08      0.05      0.98      0.06      0.23      0.05       262\n",
705
      "\n",
706
      "avg / total       0.67      0.71      0.57      0.68      0.57      0.34      9515\n",
707
      "\n",
708
      "[(1, 59819), (2, 59819), (3, 59819), (4, 59819)]\n",
709
      "For fold 9:\n",
710
      "Accuracy: 0.6776329619508094\n",
711
      "f-score: 0.6776329619508094\n",
712
      "                   pre       rec       spe        f1       geo       iba       sup\n",
713
      "\n",
714
      "          1       0.49      0.54      0.93      0.51      0.71      0.48      1031\n",
715
      "          2       0.78      0.86      0.52      0.82      0.67      0.46      6399\n",
716
      "          3       0.35      0.21      0.93      0.26      0.44      0.18      1495\n",
717
      "          4       0.15      0.12      0.95      0.13      0.34      0.10       589\n",
718
      "\n",
719
      "avg / total       0.65      0.68      0.65      0.66      0.61      0.40      9514\n",
720
      "\n",
721
      "[(1, 59618), (2, 59618), (3, 59618), (4, 59618)]\n",
722
      "For fold 10:\n",
723
      "Accuracy: 0.6961320159764558\n",
724
      "f-score: 0.6961320159764558\n",
725
      "                   pre       rec       spe        f1       geo       iba       sup\n",
726
      "\n",
727
      "          1       0.52      0.61      0.92      0.56      0.75      0.55      1157\n",
728
      "          2       0.81      0.85      0.56      0.83      0.69      0.49      6600\n",
729
      "          3       0.29      0.22      0.93      0.25      0.45      0.19      1156\n",
730
      "          4       0.16      0.09      0.97      0.12      0.30      0.08       601\n",
731
      "\n",
732
      "avg / total       0.67      0.70      0.67      0.68      0.64      0.43      9514\n",
733
      "\n",
734
      "[(1, 59442), (2, 59442), (3, 59442), (4, 59442)]\n",
735
      "For fold 1:\n",
736
      "Accuracy: 0.7162375197057278\n",
737
      "f-score: 0.7162375197057278\n",
738
      "                   pre       rec       spe        f1       geo       iba       sup\n",
739
      "\n",
740
      "          1       0.41      0.50      0.95      0.45      0.69      0.45       642\n",
741
      "          2       0.79      0.91      0.40      0.84      0.60      0.38      6776\n",
742
      "          3       0.45      0.18      0.95      0.26      0.42      0.16      1716\n",
743
      "          4       0.16      0.11      0.98      0.13      0.32      0.10       381\n",
744
      "\n",
745
      "avg / total       0.68      0.72      0.56      0.68      0.56      0.34      9515\n",
746
      "\n",
747
      "[(1, 58698), (2, 58698), (3, 58698), (4, 58698)]\n",
748
      "For fold 2:\n",
749
      "Accuracy: 0.7158171308460326\n",
750
      "f-score: 0.7158171308460325\n",
751
      "                   pre       rec       spe        f1       geo       iba       sup\n",
752
      "\n",
753
      "          1       0.48      0.55      0.93      0.51      0.71      0.49       974\n",
754
      "          2       0.88      0.80      0.59      0.84      0.69      0.48      7520\n",
755
      "          3       0.18      0.32      0.88      0.23      0.53      0.27       697\n",
756
      "          4       0.07      0.07      0.97      0.07      0.26      0.06       324\n",
757
      "\n",
758
      "avg / total       0.76      0.72      0.66      0.74      0.66      0.45      9515\n",
759
      "\n",
760
      "[(1, 59633), (2, 59633), (3, 59633), (4, 59633)]\n",
761
      "For fold 3:\n",
762
      "Accuracy: 0.7233841303205465\n",
763
      "f-score: 0.7233841303205465\n",
764
      "                   pre       rec       spe        f1       geo       iba       sup\n",
765
      "\n",
766
      "          1       0.59      0.58      0.94      0.58      0.74      0.53      1247\n",
767
      "          2       0.81      0.88      0.53      0.84      0.68      0.48      6585\n",
768
      "          3       0.36      0.23      0.92      0.28      0.46      0.20      1462\n",
769
      "          4       0.11      0.06      0.99      0.08      0.25      0.06       221\n",
770
      "\n",
771
      "avg / total       0.69      0.72      0.65      0.70      0.65      0.43      9515\n",
772
      "\n",
773
      "[(1, 59870), (2, 59870), (3, 59870), (4, 59870)]\n",
774
      "For fold 4:\n",
775
      "Accuracy: 0.670940620073568\n",
776
      "f-score: 0.670940620073568\n",
777
      "                   pre       rec       spe        f1       geo       iba       sup\n",
778
      "\n",
779
      "          1       0.50      0.60      0.92      0.54      0.74      0.54      1129\n",
780
      "          2       0.78      0.84      0.52      0.81      0.66      0.45      6348\n",
781
      "          3       0.31      0.20      0.93      0.24      0.43      0.17      1285\n",
782
      "          4       0.21      0.12      0.96      0.16      0.34      0.11       753\n",
783
      "\n",
784
      "avg / total       0.64      0.67      0.66      0.65      0.61      0.40      9515\n",
785
      "\n",
786
      "[(1, 59781), (2, 59781), (3, 59781), (4, 59781)]\n",
787
      "For fold 5:\n",
788
      "Accuracy: 0.6832369942196532\n",
789
      "f-score: 0.6832369942196532\n",
790
      "                   pre       rec       spe        f1       geo       iba       sup\n",
791
      "\n",
792
      "          1       0.51      0.56      0.93      0.53      0.72      0.50      1085\n",
793
      "          2       0.79      0.86      0.51      0.82      0.66      0.46      6437\n",
794
      "          3       0.37      0.19      0.93      0.25      0.42      0.16      1657\n",
795
      "          4       0.10      0.13      0.96      0.11      0.35      0.11       336\n",
796
      "\n",
797
      "avg / total       0.66      0.68      0.65      0.66      0.62      0.40      9515\n",
798
      "\n",
799
      "[(1, 59994), (2, 59994), (3, 59994), (4, 59994)]\n",
800
      "For fold 6:\n",
801
      "Accuracy: 0.6956384655806621\n",
802
      "f-score: 0.6956384655806621\n",
803
      "                   pre       rec       spe        f1       geo       iba       sup\n",
804
      "\n",
805
      "          1       0.44      0.54      0.94      0.49      0.71      0.49       785\n",
806
      "          2       0.76      0.91      0.46      0.83      0.65      0.44      6224\n",
807
      "          3       0.55      0.25      0.94      0.34      0.48      0.22      2026\n",
808
      "          4       0.15      0.07      0.98      0.09      0.26      0.06       480\n",
809
      "\n",
810
      "avg / total       0.66      0.70      0.63      0.66      0.60      0.38      9515\n",
811
      "\n",
812
      "[(1, 59534), (2, 59534), (3, 59534), (4, 59534)]\n",
813
      "For fold 7:\n",
814
      "Accuracy: 0.7121387283236994\n",
815
      "f-score: 0.7121387283236994\n",
816
      "                   pre       rec       spe        f1       geo       iba       sup\n",
817
      "\n",
818
      "          1       0.49      0.52      0.95      0.51      0.70      0.47       853\n",
819
      "          2       0.79      0.89      0.45      0.84      0.64      0.42      6684\n",
820
      "          3       0.33      0.24      0.93      0.28      0.47      0.21      1209\n",
821
      "          4       0.32      0.09      0.98      0.14      0.30      0.08       769\n",
822
      "\n",
823
      "avg / total       0.67      0.71      0.60      0.68      0.59      0.37      9515\n",
824
      "\n",
825
      "[(1, 59573), (2, 59573), (3, 59573), (4, 59573)]\n",
826
      "For fold 8:\n",
827
      "Accuracy: 0.7149763531266421\n",
828
      "f-score: 0.714976353126642\n",
829
      "                   pre       rec       spe        f1       geo       iba       sup\n",
830
      "\n",
831
      "          1       0.55      0.47      0.96      0.51      0.67      0.43       933\n",
832
      "          2       0.78      0.91      0.40      0.84      0.60      0.38      6645\n",
833
      "          3       0.41      0.19      0.94      0.26      0.43      0.17      1675\n",
834
      "          4       0.06      0.04      0.98      0.05      0.20      0.04       262\n",
835
      "\n",
836
      "avg / total       0.67      0.71      0.57      0.68      0.57      0.34      9515\n",
837
      "\n",
838
      "[(1, 59819), (2, 59819), (3, 59819), (4, 59819)]\n",
839
      "For fold 9:\n",
840
      "Accuracy: 0.6824679419802396\n",
841
      "f-score: 0.6824679419802396\n",
842
      "                   pre       rec       spe        f1       geo       iba       sup\n",
843
      "\n",
844
      "          1       0.52      0.55      0.94      0.53      0.72      0.49      1031\n",
845
      "          2       0.78      0.87      0.51      0.82      0.66      0.46      6399\n",
846
      "          3       0.33      0.21      0.92      0.26      0.44      0.18      1495\n",
847
      "          4       0.18      0.13      0.96      0.15      0.35      0.11       589\n",
848
      "\n",
849
      "avg / total       0.65      0.68      0.65      0.66      0.62      0.40      9514\n",
850
      "\n",
851
      "[(1, 59618), (2, 59618), (3, 59618), (4, 59618)]\n",
852
      "For fold 10:\n",
853
      "Accuracy: 0.6994954803447551\n",
854
      "f-score: 0.6994954803447551\n",
855
      "                   pre       rec       spe        f1       geo       iba       sup\n",
856
      "\n",
857
      "          1       0.51      0.61      0.92      0.55      0.75      0.54      1157\n",
858
      "          2       0.81      0.85      0.55      0.83      0.69      0.49      6600\n",
859
      "          3       0.31      0.22      0.93      0.26      0.45      0.19      1156\n",
860
      "          4       0.15      0.09      0.97      0.11      0.29      0.08       601\n",
861
      "\n",
862
      "avg / total       0.67      0.70      0.67      0.68      0.64      0.43      9514\n",
863
      "\n",
864
      "[(1, 59442), (2, 59442), (3, 59442), (4, 59442)]\n",
865
      "For fold 1:\n",
866
      "Accuracy: 0.72044140830268\n",
867
      "f-score: 0.72044140830268\n",
868
      "                   pre       rec       spe        f1       geo       iba       sup\n",
869
      "\n",
870
      "          1       0.42      0.49      0.95      0.45      0.68      0.44       642\n",
871
      "          2       0.79      0.91      0.41      0.84      0.61      0.39      6776\n",
872
      "          3       0.47      0.21      0.95      0.29      0.45      0.19      1716\n",
873
      "          4       0.16      0.10      0.98      0.12      0.31      0.09       381\n",
874
      "\n",
875
      "avg / total       0.68      0.72      0.56      0.69      0.57      0.34      9515\n",
876
      "\n",
877
      "[(1, 58698), (2, 58698), (3, 58698), (4, 58698)]\n",
878
      "For fold 2:\n",
879
      "Accuracy: 0.7086705202312139\n",
880
      "f-score: 0.7086705202312139\n",
881
      "                   pre       rec       spe        f1       geo       iba       sup\n",
882
      "\n",
883
      "          1       0.48      0.54      0.93      0.51      0.71      0.48       974\n",
884
      "          2       0.88      0.80      0.58      0.84      0.68      0.48      7520\n",
885
      "          3       0.16      0.29      0.88      0.20      0.50      0.24       697\n",
886
      "          4       0.09      0.09      0.97      0.09      0.29      0.08       324\n",
887
      "\n",
888
      "avg / total       0.76      0.71      0.65      0.73      0.66      0.45      9515\n",
889
      "\n",
890
      "[(1, 59633), (2, 59633), (3, 59633), (4, 59633)]\n",
891
      "For fold 3:\n",
892
      "Accuracy: 0.7070940620073568\n",
893
      "f-score: 0.7070940620073568\n",
894
      "                   pre       rec       spe        f1       geo       iba       sup\n",
895
      "\n",
896
      "          1       0.56      0.58      0.93      0.57      0.73      0.52      1247\n",
897
      "          2       0.81      0.86      0.54      0.83      0.68      0.48      6585\n",
898
      "          3       0.32      0.22      0.92      0.26      0.45      0.19      1462\n",
899
      "          4       0.08      0.08      0.98      0.08      0.27      0.07       221\n",
900
      "\n",
901
      "avg / total       0.68      0.71      0.66      0.69      0.64      0.43      9515\n",
902
      "\n",
903
      "[(1, 59870), (2, 59870), (3, 59870), (4, 59870)]\n",
904
      "For fold 4:\n",
905
      "Accuracy: 0.6684182869153967\n",
906
      "f-score: 0.6684182869153967\n",
907
      "                   pre       rec       spe        f1       geo       iba       sup\n",
908
      "\n",
909
      "          1       0.48      0.59      0.91      0.53      0.73      0.52      1129\n",
910
      "          2       0.78      0.85      0.52      0.81      0.66      0.45      6348\n",
911
      "          3       0.27      0.18      0.93      0.21      0.40      0.15      1285\n",
912
      "          4       0.22      0.12      0.97      0.15      0.34      0.10       753\n",
913
      "\n",
914
      "avg / total       0.63      0.67      0.65      0.65      0.61      0.39      9515\n",
915
      "\n",
916
      "[(1, 59781), (2, 59781), (3, 59781), (4, 59781)]\n",
917
      "For fold 5:\n",
918
      "Accuracy: 0.6949027850761955\n",
919
      "f-score: 0.6949027850761955\n",
920
      "                   pre       rec       spe        f1       geo       iba       sup\n",
921
      "\n",
922
      "          1       0.51      0.54      0.93      0.53      0.71      0.49      1085\n",
923
      "          2       0.79      0.88      0.50      0.83      0.66      0.46      6437\n",
924
      "          3       0.42      0.20      0.94      0.27      0.44      0.18      1657\n",
925
      "          4       0.11      0.13      0.96      0.12      0.35      0.12       336\n",
926
      "\n",
927
      "avg / total       0.67      0.69      0.64      0.67      0.62      0.40      9515\n",
928
      "\n",
929
      "[(1, 59994), (2, 59994), (3, 59994), (4, 59994)]\n",
930
      "For fold 6:\n",
931
      "Accuracy: 0.6911192853389385\n",
932
      "f-score: 0.6911192853389385\n",
933
      "                   pre       rec       spe        f1       geo       iba       sup\n",
934
      "\n",
935
      "          1       0.44      0.55      0.94      0.49      0.72      0.50       785\n",
936
      "          2       0.76      0.91      0.47      0.83      0.65      0.44      6224\n",
937
      "          3       0.51      0.23      0.94      0.32      0.47      0.20      2026\n",
938
      "          4       0.16      0.07      0.98      0.10      0.27      0.07       480\n",
939
      "\n",
940
      "avg / total       0.65      0.69      0.63      0.66      0.60      0.38      9515\n",
941
      "\n",
942
      "[(1, 59534), (2, 59534), (3, 59534), (4, 59534)]\n",
943
      "For fold 7:\n",
944
      "Accuracy: 0.7078297425118234\n",
945
      "f-score: 0.7078297425118234\n",
946
      "                   pre       rec       spe        f1       geo       iba       sup\n",
947
      "\n",
948
      "          1       0.48      0.50      0.95      0.49      0.69      0.45       853\n",
949
      "          2       0.80      0.89      0.47      0.84      0.64      0.43      6684\n",
950
      "          3       0.33      0.27      0.92      0.30      0.50      0.23      1209\n",
951
      "          4       0.26      0.07      0.98      0.12      0.27      0.07       769\n",
952
      "\n",
953
      "avg / total       0.67      0.71      0.61      0.68      0.60      0.38      9515\n",
954
      "\n",
955
      "[(1, 59573), (2, 59573), (3, 59573), (4, 59573)]\n",
956
      "For fold 8:\n",
957
      "Accuracy: 0.7168681029952706\n",
958
      "f-score: 0.7168681029952706\n",
959
      "                   pre       rec       spe        f1       geo       iba       sup\n",
960
      "\n",
961
      "          1       0.56      0.45      0.96      0.50      0.66      0.41       933\n",
962
      "          2       0.78      0.91      0.41      0.84      0.61      0.39      6645\n",
963
      "          3       0.40      0.21      0.93      0.28      0.44      0.18      1675\n",
964
      "          4       0.11      0.07      0.98      0.09      0.27      0.06       262\n",
965
      "\n",
966
      "avg / total       0.68      0.72      0.57      0.69      0.58      0.35      9515\n",
967
      "\n",
968
      "[(1, 59819), (2, 59819), (3, 59819), (4, 59819)]\n",
969
      "For fold 9:\n",
970
      "Accuracy: 0.6847803237334454\n",
971
      "f-score: 0.6847803237334454\n",
972
      "                   pre       rec       spe        f1       geo       iba       sup\n",
973
      "\n",
974
      "          1       0.50      0.54      0.93      0.52      0.71      0.49      1031\n",
975
      "          2       0.79      0.87      0.52      0.83      0.67      0.47      6399\n",
976
      "          3       0.35      0.23      0.92      0.27      0.46      0.19      1495\n",
977
      "          4       0.19      0.12      0.97      0.15      0.34      0.11       589\n",
978
      "\n",
979
      "avg / total       0.65      0.68      0.66      0.66      0.62      0.40      9514\n",
980
      "\n",
981
      "[(1, 59618), (2, 59618), (3, 59618), (4, 59618)]\n",
982
      "For fold 10:\n",
983
      "Accuracy: 0.6996005886062645\n",
984
      "f-score: 0.6996005886062645\n",
985
      "                   pre       rec       spe        f1       geo       iba       sup\n",
986
      "\n",
987
      "          1       0.51      0.61      0.92      0.56      0.75      0.54      1157\n",
988
      "          2       0.82      0.85      0.56      0.83      0.69      0.49      6600\n",
989
      "          3       0.30      0.22      0.93      0.26      0.46      0.19      1156\n",
990
      "          4       0.14      0.08      0.97      0.10      0.28      0.07       601\n",
991
      "\n",
992
      "avg / total       0.67      0.70      0.68      0.68      0.64      0.44      9514\n",
993
      "\n",
994
      "[(1, 59442), (2, 59442), (3, 59442), (4, 59442)]\n",
995
      "For fold 1:\n",
996
      "Accuracy: 0.7178139779295849\n",
997
      "f-score: 0.7178139779295849\n",
998
      "                   pre       rec       spe        f1       geo       iba       sup\n",
999
      "\n",
1000
      "          1       0.42      0.51      0.95      0.46      0.69      0.46       642\n",
1001
      "          2       0.79      0.90      0.41      0.84      0.61      0.39      6776\n",
1002
      "          3       0.45      0.21      0.95      0.28      0.44      0.18      1716\n",
1003
      "          4       0.14      0.08      0.98      0.10      0.29      0.07       381\n",
1004
      "\n",
1005
      "avg / total       0.68      0.72      0.57      0.69      0.57      0.34      9515\n",
1006
      "\n",
1007
      "[(1, 58698), (2, 58698), (3, 58698), (4, 58698)]\n",
1008
      "For fold 2:\n",
1009
      "Accuracy: 0.7165528113504992\n",
1010
      "f-score: 0.7165528113504992\n",
1011
      "                   pre       rec       spe        f1       geo       iba       sup\n",
1012
      "\n",
1013
      "          1       0.49      0.53      0.94      0.50      0.70      0.47       974\n",
1014
      "          2       0.88      0.80      0.58      0.84      0.68      0.48      7520\n",
1015
      "          3       0.18      0.32      0.88      0.23      0.53      0.27       697\n",
1016
      "          4       0.10      0.09      0.97      0.10      0.30      0.08       324\n",
1017
      "\n",
1018
      "avg / total       0.76      0.72      0.65      0.74      0.66      0.45      9515\n",
1019
      "\n",
1020
      "[(1, 59633), (2, 59633), (3, 59633), (4, 59633)]\n",
1021
      "For fold 3:\n",
1022
      "Accuracy: 0.7057277982133473\n",
1023
      "f-score: 0.7057277982133473\n",
1024
      "                   pre       rec       spe        f1       geo       iba       sup\n",
1025
      "\n",
1026
      "          1       0.56      0.59      0.93      0.57      0.74      0.53      1247\n",
1027
      "          2       0.81      0.85      0.54      0.83      0.68      0.48      6585\n",
1028
      "          3       0.33      0.23      0.92      0.27      0.46      0.20      1462\n",
1029
      "          4       0.10      0.10      0.98      0.10      0.30      0.08       221\n",
1030
      "\n",
1031
      "avg / total       0.68      0.71      0.66      0.69      0.64      0.43      9515\n",
1032
      "\n",
1033
      "[(1, 59870), (2, 59870), (3, 59870), (4, 59870)]\n",
1034
      "For fold 4:\n",
1035
      "Accuracy: 0.6705202312138728\n",
1036
      "f-score: 0.6705202312138728\n",
1037
      "                   pre       rec       spe        f1       geo       iba       sup\n",
1038
      "\n",
1039
      "          1       0.48      0.58      0.91      0.53      0.73      0.51      1129\n",
1040
      "          2       0.78      0.85      0.52      0.81      0.66      0.45      6348\n",
1041
      "          3       0.32      0.19      0.94      0.24      0.42      0.16      1285\n",
1042
      "          4       0.20      0.12      0.96      0.15      0.35      0.11       753\n",
1043
      "\n",
1044
      "avg / total       0.64      0.67      0.66      0.65      0.61      0.39      9515\n",
1045
      "\n",
1046
      "[(1, 59781), (2, 59781), (3, 59781), (4, 59781)]\n",
1047
      "For fold 5:\n",
1048
      "Accuracy: 0.6850236468733578\n",
1049
      "f-score: 0.6850236468733578\n",
1050
      "                   pre       rec       spe        f1       geo       iba       sup\n",
1051
      "\n",
1052
      "          1       0.53      0.55      0.94      0.54      0.72      0.50      1085\n",
1053
      "          2       0.78      0.86      0.51      0.82      0.66      0.45      6437\n",
1054
      "          3       0.41      0.22      0.93      0.28      0.45      0.19      1657\n",
1055
      "          4       0.09      0.12      0.95      0.10      0.35      0.11       336\n",
1056
      "\n",
1057
      "avg / total       0.67      0.69      0.65      0.67      0.62      0.40      9515\n",
1058
      "\n",
1059
      "[(1, 59994), (2, 59994), (3, 59994), (4, 59994)]\n",
1060
      "For fold 6:\n",
1061
      "Accuracy: 0.6862848134524435\n",
1062
      "f-score: 0.6862848134524435\n",
1063
      "                   pre       rec       spe        f1       geo       iba       sup\n",
1064
      "\n",
1065
      "          1       0.42      0.52      0.93      0.46      0.70      0.47       785\n",
1066
      "          2       0.76      0.90      0.46      0.82      0.64      0.43      6224\n",
1067
      "          3       0.52      0.23      0.94      0.32      0.46      0.20      2026\n",
1068
      "          4       0.18      0.09      0.98      0.12      0.30      0.08       480\n",
1069
      "\n",
1070
      "avg / total       0.65      0.69      0.63      0.65      0.59      0.37      9515\n",
1071
      "\n",
1072
      "[(1, 59534), (2, 59534), (3, 59534), (4, 59534)]\n",
1073
      "For fold 7:\n",
1074
      "Accuracy: 0.7088807146610615\n",
1075
      "f-score: 0.7088807146610615\n",
1076
      "                   pre       rec       spe        f1       geo       iba       sup\n",
1077
      "\n",
1078
      "          1       0.49      0.50      0.95      0.49      0.69      0.45       853\n",
1079
      "          2       0.80      0.89      0.46      0.84      0.64      0.43      6684\n",
1080
      "          3       0.33      0.26      0.93      0.29      0.49      0.22      1209\n",
1081
      "          4       0.27      0.09      0.98      0.13      0.29      0.08       769\n",
1082
      "\n",
1083
      "avg / total       0.67      0.71      0.61      0.68      0.60      0.38      9515\n",
1084
      "\n",
1085
      "[(1, 59573), (2, 59573), (3, 59573), (4, 59573)]\n",
1086
      "For fold 8:\n",
1087
      "Accuracy: 0.7135049921177089\n",
1088
      "f-score: 0.713504992117709\n",
1089
      "                   pre       rec       spe        f1       geo       iba       sup\n",
1090
      "\n",
1091
      "          1       0.57      0.45      0.96      0.50      0.66      0.41       933\n",
1092
      "          2       0.78      0.91      0.40      0.84      0.61      0.39      6645\n",
1093
      "          3       0.38      0.19      0.93      0.25      0.42      0.16      1675\n",
1094
      "          4       0.10      0.07      0.98      0.09      0.27      0.06       262\n",
1095
      "\n",
1096
      "avg / total       0.67      0.71      0.57      0.68      0.57      0.34      9515\n",
1097
      "\n",
1098
      "[(1, 59819), (2, 59819), (3, 59819), (4, 59819)]\n",
1099
      "For fold 9:\n",
1100
      "Accuracy: 0.6846752154719361\n",
1101
      "f-score: 0.6846752154719361\n",
1102
      "                   pre       rec       spe        f1       geo       iba       sup\n",
1103
      "\n",
1104
      "          1       0.51      0.53      0.94      0.52      0.70      0.48      1031\n",
1105
      "          2       0.78      0.87      0.51      0.83      0.66      0.46      6399\n",
1106
      "          3       0.35      0.21      0.93      0.27      0.44      0.18      1495\n",
1107
      "          4       0.18      0.13      0.96      0.15      0.35      0.11       589\n",
1108
      "\n",
1109
      "avg / total       0.65      0.68      0.65      0.66      0.61      0.39      9514\n",
1110
      "\n",
1111
      "[(1, 59618), (2, 59618), (3, 59618), (4, 59618)]\n",
1112
      "For fold 10:\n",
1113
      "Accuracy: 0.6931889846541939\n",
1114
      "f-score: 0.6931889846541939\n",
1115
      "                   pre       rec       spe        f1       geo       iba       sup\n",
1116
      "\n",
1117
      "          1       0.50      0.61      0.91      0.55      0.75      0.54      1157\n",
1118
      "          2       0.81      0.85      0.55      0.83      0.69      0.48      6600\n",
1119
      "          3       0.28      0.20      0.93      0.23      0.43      0.17      1156\n",
1120
      "          4       0.14      0.09      0.96      0.11      0.29      0.08       601\n",
1121
      "\n",
1122
      "avg / total       0.67      0.69      0.67      0.68      0.64      0.43      9514\n",
1123
      "\n",
1124
      "[(1, 59442), (2, 59442), (3, 59442), (4, 59442)]\n",
1125
      "For fold 1:\n",
1126
      "Accuracy: 0.7158171308460326\n",
1127
      "f-score: 0.7158171308460325\n",
1128
      "                   pre       rec       spe        f1       geo       iba       sup\n",
1129
      "\n",
1130
      "          1       0.40      0.48      0.95      0.44      0.68      0.44       642\n",
1131
      "          2       0.79      0.90      0.40      0.84      0.60      0.38      6776\n",
1132
      "          3       0.46      0.21      0.95      0.29      0.44      0.18      1716\n",
1133
      "          4       0.12      0.07      0.98      0.09      0.27      0.07       381\n",
1134
      "\n",
1135
      "avg / total       0.68      0.72      0.56      0.68      0.57      0.34      9515\n",
1136
      "\n",
1137
      "[(1, 58698), (2, 58698), (3, 58698), (4, 58698)]\n",
1138
      "For fold 2:\n",
1139
      "Accuracy: 0.7128744088281661\n",
1140
      "f-score: 0.7128744088281661\n",
1141
      "                   pre       rec       spe        f1       geo       iba       sup\n",
1142
      "\n",
1143
      "          1       0.47      0.54      0.93      0.50      0.71      0.48       974\n",
1144
      "          2       0.88      0.80      0.58      0.84      0.68      0.48      7520\n",
1145
      "          3       0.17      0.32      0.88      0.22      0.53      0.26       697\n",
1146
      "          4       0.08      0.07      0.97      0.07      0.26      0.06       324\n",
1147
      "\n",
1148
      "avg / total       0.76      0.71      0.65      0.73      0.66      0.45      9515\n",
1149
      "\n",
1150
      "[(1, 59633), (2, 59633), (3, 59633), (4, 59633)]\n",
1151
      "For fold 3:\n",
1152
      "Accuracy: 0.708039936941671\n",
1153
      "f-score: 0.708039936941671\n",
1154
      "                   pre       rec       spe        f1       geo       iba       sup\n",
1155
      "\n",
1156
      "          1       0.57      0.58      0.93      0.58      0.74      0.52      1247\n",
1157
      "          2       0.81      0.86      0.54      0.83      0.68      0.48      6585\n",
1158
      "          3       0.33      0.23      0.91      0.27      0.46      0.19      1462\n",
1159
      "          4       0.08      0.09      0.98      0.08      0.29      0.08       221\n",
1160
      "\n",
1161
      "avg / total       0.69      0.71      0.66      0.70      0.65      0.43      9515\n",
1162
      "\n",
1163
      "[(1, 59870), (2, 59870), (3, 59870), (4, 59870)]\n",
1164
      "For fold 4:\n",
1165
      "Accuracy: 0.6690488702049395\n",
1166
      "f-score: 0.6690488702049395\n",
1167
      "                   pre       rec       spe        f1       geo       iba       sup\n",
1168
      "\n",
1169
      "          1       0.48      0.57      0.92      0.52      0.72      0.51      1129\n",
1170
      "          2       0.78      0.84      0.52      0.81      0.66      0.45      6348\n",
1171
      "          3       0.32      0.21      0.93      0.25      0.44      0.18      1285\n",
1172
      "          4       0.21      0.12      0.96      0.15      0.34      0.11       753\n",
1173
      "\n",
1174
      "avg / total       0.64      0.67      0.66      0.65      0.61      0.39      9515\n",
1175
      "\n",
1176
      "[(1, 59781), (2, 59781), (3, 59781), (4, 59781)]\n",
1177
      "For fold 5:\n",
1178
      "Accuracy: 0.6901734104046243\n",
1179
      "f-score: 0.6901734104046243\n",
1180
      "                   pre       rec       spe        f1       geo       iba       sup\n",
1181
      "\n",
1182
      "          1       0.51      0.55      0.93      0.53      0.72      0.50      1085\n",
1183
      "          2       0.78      0.87      0.50      0.83      0.66      0.45      6437\n",
1184
      "          3       0.41      0.19      0.94      0.26      0.42      0.16      1657\n",
1185
      "          4       0.11      0.15      0.96      0.13      0.37      0.13       336\n",
1186
      "\n",
1187
      "avg / total       0.66      0.69      0.64      0.67      0.61      0.40      9515\n",
1188
      "\n",
1189
      "[(1, 59994), (2, 59994), (3, 59994), (4, 59994)]\n",
1190
      "For fold 6:\n",
1191
      "Accuracy: 0.6906988964792433\n",
1192
      "f-score: 0.6906988964792433\n",
1193
      "                   pre       rec       spe        f1       geo       iba       sup\n",
1194
      "\n",
1195
      "          1       0.44      0.55      0.94      0.49      0.72      0.50       785\n",
1196
      "          2       0.76      0.91      0.46      0.83      0.64      0.43      6224\n",
1197
      "          3       0.51      0.22      0.94      0.31      0.46      0.20      2026\n",
1198
      "          4       0.20      0.09      0.98      0.12      0.29      0.08       480\n",
1199
      "\n",
1200
      "avg / total       0.65      0.69      0.63      0.65      0.59      0.37      9515\n",
1201
      "\n",
1202
      "[(1, 59534), (2, 59534), (3, 59534), (4, 59534)]\n",
1203
      "For fold 7:\n",
1204
      "Accuracy: 0.7046768260641093\n",
1205
      "f-score: 0.7046768260641093\n",
1206
      "                   pre       rec       spe        f1       geo       iba       sup\n",
1207
      "\n",
1208
      "          1       0.46      0.49      0.94      0.48      0.68      0.44       853\n",
1209
      "          2       0.80      0.88      0.48      0.84      0.65      0.44      6684\n",
1210
      "          3       0.33      0.26      0.92      0.29      0.49      0.23      1209\n",
1211
      "          4       0.29      0.10      0.98      0.15      0.32      0.09       769\n",
1212
      "\n",
1213
      "avg / total       0.67      0.70      0.62      0.68      0.61      0.38      9515\n",
1214
      "\n",
1215
      "[(1, 59573), (2, 59573), (3, 59573), (4, 59573)]\n",
1216
      "For fold 8:\n",
1217
      "Accuracy: 0.711823436678928\n",
1218
      "f-score: 0.711823436678928\n",
1219
      "                   pre       rec       spe        f1       geo       iba       sup\n",
1220
      "\n",
1221
      "          1       0.55      0.46      0.96      0.50      0.67      0.42       933\n",
1222
      "          2       0.78      0.91      0.41      0.84      0.61      0.39      6645\n",
1223
      "          3       0.37      0.19      0.93      0.25      0.42      0.16      1675\n",
1224
      "          4       0.07      0.05      0.98      0.06      0.22      0.04       262\n",
1225
      "\n",
1226
      "avg / total       0.67      0.71      0.57      0.68      0.57      0.34      9515\n",
1227
      "\n",
1228
      "[(1, 59819), (2, 59819), (3, 59819), (4, 59819)]\n",
1229
      "For fold 9:\n",
1230
      "Accuracy: 0.6871978137481606\n",
1231
      "f-score: 0.6871978137481606\n",
1232
      "                   pre       rec       spe        f1       geo       iba       sup\n",
1233
      "\n",
1234
      "          1       0.51      0.55      0.94      0.53      0.71      0.49      1031\n",
1235
      "          2       0.79      0.87      0.51      0.83      0.67      0.46      6399\n",
1236
      "          3       0.35      0.22      0.93      0.27      0.45      0.19      1495\n",
1237
      "          4       0.19      0.13      0.96      0.15      0.35      0.11       589\n",
1238
      "\n",
1239
      "avg / total       0.65      0.69      0.65      0.66      0.62      0.40      9514\n",
1240
      "\n",
1241
      "[(1, 59618), (2, 59618), (3, 59618), (4, 59618)]\n",
1242
      "For fold 10:\n",
1243
      "Accuracy: 0.6958166911919277\n",
1244
      "f-score: 0.6958166911919277\n",
1245
      "                   pre       rec       spe        f1       geo       iba       sup\n",
1246
      "\n",
1247
      "          1       0.52      0.60      0.93      0.56      0.74      0.53      1157\n",
1248
      "          2       0.81      0.85      0.56      0.83      0.69      0.49      6600\n",
1249
      "          3       0.29      0.23      0.92      0.26      0.46      0.20      1156\n",
1250
      "          4       0.13      0.08      0.96      0.10      0.27      0.07       601\n",
1251
      "\n",
1252
      "avg / total       0.67      0.70      0.67      0.68      0.64      0.43      9514\n",
1253
      "\n",
1254
      "[(1, 59442), (2, 59442), (3, 59442), (4, 59442)]\n",
1255
      "For fold 1:\n",
1256
      "Accuracy: 0.7193904361534419\n",
1257
      "f-score: 0.7193904361534419\n",
1258
      "                   pre       rec       spe        f1       geo       iba       sup\n",
1259
      "\n",
1260
      "          1       0.41      0.47      0.95      0.44      0.67      0.43       642\n",
1261
      "          2       0.79      0.91      0.40      0.85      0.60      0.38      6776\n",
1262
      "          3       0.45      0.20      0.95      0.28      0.44      0.18      1716\n",
1263
      "          4       0.16      0.09      0.98      0.12      0.30      0.08       381\n",
1264
      "\n",
1265
      "avg / total       0.68      0.72      0.56      0.69      0.57      0.34      9515\n",
1266
      "\n",
1267
      "[(1, 58698), (2, 58698), (3, 58698), (4, 58698)]\n",
1268
      "For fold 2:\n",
1269
      "Accuracy: 0.7104571728849185\n",
1270
      "f-score: 0.7104571728849185\n",
1271
      "                   pre       rec       spe        f1       geo       iba       sup\n",
1272
      "\n",
1273
      "          1       0.48      0.54      0.93      0.51      0.71      0.49       974\n",
1274
      "          2       0.88      0.80      0.59      0.84      0.68      0.48      7520\n",
1275
      "          3       0.17      0.32      0.87      0.22      0.53      0.26       697\n",
1276
      "          4       0.08      0.07      0.97      0.07      0.26      0.06       324\n",
1277
      "\n",
1278
      "avg / total       0.76      0.71      0.66      0.73      0.66      0.45      9515\n",
1279
      "\n",
1280
      "[(1, 59633), (2, 59633), (3, 59633), (4, 59633)]\n",
1281
      "For fold 3:\n",
1282
      "Accuracy: 0.7130846032580137\n",
1283
      "f-score: 0.7130846032580137\n",
1284
      "                   pre       rec       spe        f1       geo       iba       sup\n",
1285
      "\n",
1286
      "          1       0.57      0.60      0.93      0.59      0.75      0.54      1247\n",
1287
      "          2       0.81      0.87      0.54      0.84      0.68      0.48      6585\n",
1288
      "          3       0.33      0.22      0.92      0.27      0.45      0.19      1462\n",
1289
      "          4       0.10      0.09      0.98      0.10      0.30      0.08       221\n",
1290
      "\n",
1291
      "avg / total       0.69      0.71      0.66      0.70      0.65      0.43      9515\n",
1292
      "\n",
1293
      "[(1, 59870), (2, 59870), (3, 59870), (4, 59870)]\n",
1294
      "For fold 4:\n",
1295
      "Accuracy: 0.6694692590646348\n",
1296
      "f-score: 0.6694692590646348\n",
1297
      "                   pre       rec       spe        f1       geo       iba       sup\n",
1298
      "\n",
1299
      "          1       0.49      0.60      0.92      0.54      0.74      0.53      1129\n",
1300
      "          2       0.78      0.84      0.52      0.81      0.66      0.45      6348\n",
1301
      "          3       0.30      0.20      0.93      0.24      0.43      0.17      1285\n",
1302
      "          4       0.20      0.10      0.96      0.14      0.32      0.09       753\n",
1303
      "\n",
1304
      "avg / total       0.63      0.67      0.66      0.65      0.61      0.40      9515\n",
1305
      "\n",
1306
      "[(1, 59781), (2, 59781), (3, 59781), (4, 59781)]\n",
1307
      "For fold 5:\n",
1308
      "Accuracy: 0.6890173410404624\n",
1309
      "f-score: 0.6890173410404624\n",
1310
      "                   pre       rec       spe        f1       geo       iba       sup\n",
1311
      "\n",
1312
      "          1       0.51      0.57      0.93      0.54      0.73      0.51      1085\n",
1313
      "          2       0.79      0.87      0.50      0.82      0.66      0.45      6437\n",
1314
      "          3       0.41      0.19      0.94      0.26      0.42      0.16      1657\n",
1315
      "          4       0.10      0.14      0.96      0.12      0.36      0.12       336\n",
1316
      "\n",
1317
      "avg / total       0.66      0.69      0.64      0.67      0.62      0.40      9515\n",
1318
      "\n",
1319
      "[(1, 59994), (2, 59994), (3, 59994), (4, 59994)]\n",
1320
      "For fold 6:\n",
1321
      "Accuracy: 0.6895428271150814\n",
1322
      "f-score: 0.6895428271150814\n",
1323
      "                   pre       rec       spe        f1       geo       iba       sup\n",
1324
      "\n",
1325
      "          1       0.42      0.55      0.93      0.48      0.72      0.50       785\n",
1326
      "          2       0.76      0.91      0.47      0.83      0.65      0.44      6224\n",
1327
      "          3       0.52      0.22      0.95      0.31      0.45      0.19      2026\n",
1328
      "          4       0.19      0.10      0.98      0.13      0.31      0.09       480\n",
1329
      "\n",
1330
      "avg / total       0.66      0.69      0.63      0.65      0.60      0.38      9515\n",
1331
      "\n",
1332
      "[(1, 59534), (2, 59534), (3, 59534), (4, 59534)]\n",
1333
      "For fold 7:\n",
1334
      "Accuracy: 0.6986862848134524\n",
1335
      "f-score: 0.6986862848134524\n",
1336
      "                   pre       rec       spe        f1       geo       iba       sup\n",
1337
      "\n",
1338
      "          1       0.46      0.51      0.94      0.48      0.69      0.46       853\n",
1339
      "          2       0.80      0.87      0.48      0.83      0.65      0.44      6684\n",
1340
      "          3       0.32      0.26      0.92      0.29      0.49      0.23      1209\n",
1341
      "          4       0.23      0.09      0.97      0.13      0.30      0.08       769\n",
1342
      "\n",
1343
      "avg / total       0.66      0.70      0.62      0.68      0.60      0.38      9515\n",
1344
      "\n",
1345
      "[(1, 59573), (2, 59573), (3, 59573), (4, 59573)]\n",
1346
      "For fold 8:\n",
1347
      "Accuracy: 0.7104571728849185\n",
1348
      "f-score: 0.7104571728849185\n",
1349
      "                   pre       rec       spe        f1       geo       iba       sup\n",
1350
      "\n",
1351
      "          1       0.55      0.47      0.96      0.51      0.67      0.43       933\n",
1352
      "          2       0.78      0.90      0.41      0.83      0.61      0.38      6645\n",
1353
      "          3       0.39      0.19      0.93      0.26      0.42      0.17      1675\n",
1354
      "          4       0.11      0.08      0.98      0.09      0.29      0.07       262\n",
1355
      "\n",
1356
      "avg / total       0.67      0.71      0.57      0.68      0.57      0.34      9515\n",
1357
      "\n",
1358
      "[(1, 59819), (2, 59819), (3, 59819), (4, 59819)]\n",
1359
      "For fold 9:\n",
1360
      "Accuracy: 0.6823628337187303\n",
1361
      "f-score: 0.6823628337187303\n",
1362
      "                   pre       rec       spe        f1       geo       iba       sup\n",
1363
      "\n",
1364
      "          1       0.51      0.53      0.94      0.52      0.71      0.48      1031\n",
1365
      "          2       0.79      0.86      0.53      0.82      0.67      0.47      6399\n",
1366
      "          3       0.33      0.22      0.92      0.26      0.45      0.19      1495\n",
1367
      "          4       0.20      0.16      0.96      0.17      0.39      0.14       589\n",
1368
      "\n",
1369
      "avg / total       0.65      0.68      0.66      0.66      0.62      0.41      9514\n",
1370
      "\n",
1371
      "[(1, 59618), (2, 59618), (3, 59618), (4, 59618)]\n",
1372
      "For fold 10:\n",
1373
      "Accuracy: 0.6949758250998529\n",
1374
      "f-score: 0.6949758250998529\n",
1375
      "                   pre       rec       spe        f1       geo       iba       sup\n",
1376
      "\n",
1377
      "          1       0.49      0.60      0.91      0.54      0.74      0.53      1157\n",
1378
      "          2       0.81      0.85      0.56      0.83      0.69      0.49      6600\n",
1379
      "          3       0.29      0.21      0.93      0.24      0.44      0.18      1156\n",
1380
      "          4       0.16      0.10      0.96      0.12      0.31      0.09       601\n",
1381
      "\n",
1382
      "avg / total       0.67      0.69      0.67      0.68      0.64      0.43      9514\n",
1383
      "\n",
1384
      "[(1, 59442), (2, 59442), (3, 59442), (4, 59442)]\n",
1385
      "For fold 1:\n",
1386
      "Accuracy: 0.7212821860220704\n",
1387
      "f-score: 0.7212821860220704\n",
1388
      "                   pre       rec       spe        f1       geo       iba       sup\n",
1389
      "\n",
1390
      "          1       0.42      0.51      0.95      0.46      0.70      0.46       642\n",
1391
      "          2       0.79      0.91      0.41      0.85      0.61      0.39      6776\n",
1392
      "          3       0.47      0.19      0.95      0.27      0.43      0.17      1716\n",
1393
      "          4       0.17      0.10      0.98      0.13      0.32      0.09       381\n",
1394
      "\n",
1395
      "avg / total       0.68      0.72      0.56      0.69      0.57      0.34      9515\n",
1396
      "\n",
1397
      "[(1, 58698), (2, 58698), (3, 58698), (4, 58698)]\n",
1398
      "For fold 2:\n",
1399
      "Accuracy: 0.7012086179716237\n",
1400
      "f-score: 0.7012086179716237\n",
1401
      "                   pre       rec       spe        f1       geo       iba       sup\n",
1402
      "\n",
1403
      "          1       0.47      0.53      0.93      0.50      0.70      0.47       974\n",
1404
      "          2       0.88      0.79      0.59      0.83      0.68      0.47      7520\n",
1405
      "          3       0.15      0.30      0.87      0.20      0.51      0.24       697\n",
1406
      "          4       0.06      0.06      0.97      0.06      0.24      0.05       324\n",
1407
      "\n",
1408
      "avg / total       0.76      0.70      0.66      0.72      0.66      0.44      9515\n",
1409
      "\n",
1410
      "[(1, 59633), (2, 59633), (3, 59633), (4, 59633)]\n",
1411
      "For fold 3:\n",
1412
      "Accuracy: 0.7096163951655281\n",
1413
      "f-score: 0.7096163951655281\n",
1414
      "                   pre       rec       spe        f1       geo       iba       sup\n",
1415
      "\n",
1416
      "          1       0.58      0.58      0.94      0.58      0.74      0.53      1247\n",
1417
      "          2       0.81      0.86      0.54      0.83      0.68      0.48      6585\n",
1418
      "          3       0.32      0.23      0.91      0.27      0.46      0.20      1462\n",
1419
      "          4       0.09      0.07      0.98      0.08      0.27      0.06       221\n",
1420
      "\n",
1421
      "avg / total       0.69      0.71      0.66      0.70      0.65      0.44      9515\n",
1422
      "\n",
1423
      "[(1, 59870), (2, 59870), (3, 59870), (4, 59870)]\n",
1424
      "For fold 4:\n",
1425
      "Accuracy: 0.6687335785601681\n",
1426
      "f-score: 0.6687335785601681\n",
1427
      "                   pre       rec       spe        f1       geo       iba       sup\n",
1428
      "\n",
1429
      "          1       0.48      0.59      0.91      0.53      0.73      0.52      1129\n",
1430
      "          2       0.78      0.85      0.52      0.81      0.66      0.45      6348\n",
1431
      "          3       0.30      0.18      0.93      0.23      0.41      0.16      1285\n",
1432
      "          4       0.20      0.12      0.96      0.15      0.35      0.11       753\n",
1433
      "\n",
1434
      "avg / total       0.63      0.67      0.66      0.65      0.61      0.39      9515\n",
1435
      "\n",
1436
      "[(1, 59781), (2, 59781), (3, 59781), (4, 59781)]\n",
1437
      "For fold 5:\n",
1438
      "Accuracy: 0.6735680504466631\n",
1439
      "f-score: 0.6735680504466631\n",
1440
      "                   pre       rec       spe        f1       geo       iba       sup\n",
1441
      "\n",
1442
      "          1       0.49      0.55      0.93      0.52      0.71      0.49      1085\n",
1443
      "          2       0.79      0.84      0.53      0.81      0.67      0.46      6437\n",
1444
      "          3       0.38      0.22      0.92      0.28      0.45      0.19      1657\n",
1445
      "          4       0.10      0.15      0.95      0.12      0.38      0.13       336\n",
1446
      "\n",
1447
      "avg / total       0.66      0.67      0.66      0.66      0.62      0.40      9515\n",
1448
      "\n",
1449
      "[(1, 59994), (2, 59994), (3, 59994), (4, 59994)]\n",
1450
      "For fold 6:\n",
1451
      "Accuracy: 0.6888071466106148\n",
1452
      "f-score: 0.6888071466106148\n",
1453
      "                   pre       rec       spe        f1       geo       iba       sup\n",
1454
      "\n",
1455
      "          1       0.42      0.53      0.93      0.47      0.71      0.48       785\n",
1456
      "          2       0.76      0.91      0.46      0.83      0.65      0.44      6224\n",
1457
      "          3       0.52      0.23      0.94      0.32      0.46      0.20      2026\n",
1458
      "          4       0.16      0.07      0.98      0.10      0.27      0.07       480\n",
1459
      "\n",
1460
      "avg / total       0.65      0.69      0.63      0.65      0.59      0.37      9515\n",
1461
      "\n",
1462
      "[(1, 59534), (2, 59534), (3, 59534), (4, 59534)]\n",
1463
      "For fold 7:\n",
1464
      "Accuracy: 0.7138202837624803\n",
1465
      "f-score: 0.7138202837624804\n",
1466
      "                   pre       rec       spe        f1       geo       iba       sup\n",
1467
      "\n",
1468
      "          1       0.48      0.51      0.95      0.50      0.69      0.46       853\n",
1469
      "          2       0.80      0.90      0.46      0.84      0.64      0.43      6684\n",
1470
      "          3       0.35      0.26      0.93      0.29      0.49      0.22      1209\n",
1471
      "          4       0.29      0.08      0.98      0.13      0.29      0.08       769\n",
1472
      "\n",
1473
      "avg / total       0.67      0.71      0.61      0.69      0.60      0.38      9515\n",
1474
      "\n",
1475
      "[(1, 59573), (2, 59573), (3, 59573), (4, 59573)]\n",
1476
      "For fold 8:\n",
1477
      "Accuracy: 0.7114030478192328\n",
1478
      "f-score: 0.7114030478192328\n",
1479
      "                   pre       rec       spe        f1       geo       iba       sup\n",
1480
      "\n",
1481
      "          1       0.55      0.45      0.96      0.50      0.66      0.41       933\n",
1482
      "          2       0.78      0.90      0.41      0.84      0.61      0.39      6645\n",
1483
      "          3       0.40      0.22      0.93      0.28      0.45      0.19      1675\n",
1484
      "          4       0.07      0.05      0.98      0.06      0.21      0.04       262\n",
1485
      "\n",
1486
      "avg / total       0.67      0.71      0.57      0.68      0.57      0.34      9515\n",
1487
      "\n",
1488
      "[(1, 59819), (2, 59819), (3, 59819), (4, 59819)]\n",
1489
      "For fold 9:\n",
1490
      "Accuracy: 0.684359890687408\n",
1491
      "f-score: 0.684359890687408\n",
1492
      "                   pre       rec       spe        f1       geo       iba       sup\n",
1493
      "\n",
1494
      "          1       0.50      0.53      0.94      0.52      0.71      0.48      1031\n",
1495
      "          2       0.79      0.87      0.52      0.83      0.67      0.46      6399\n",
1496
      "          3       0.36      0.23      0.92      0.28      0.46      0.19      1495\n",
1497
      "          4       0.18      0.13      0.96      0.15      0.35      0.11       589\n",
1498
      "\n",
1499
      "avg / total       0.65      0.68      0.65      0.66      0.62      0.40      9514\n",
1500
      "\n",
1501
      "[(1, 59618), (2, 59618), (3, 59618), (4, 59618)]\n",
1502
      "For fold 10:\n",
1503
      "Accuracy: 0.6882488963632541\n",
1504
      "f-score: 0.6882488963632541\n",
1505
      "                   pre       rec       spe        f1       geo       iba       sup\n",
1506
      "\n",
1507
      "          1       0.52      0.62      0.92      0.56      0.75      0.55      1157\n",
1508
      "          2       0.81      0.83      0.57      0.82      0.69      0.49      6600\n",
1509
      "          3       0.30      0.22      0.93      0.26      0.45      0.19      1156\n",
1510
      "          4       0.15      0.13      0.95      0.14      0.36      0.12       601\n",
1511
      "\n",
1512
      "avg / total       0.67      0.69      0.68      0.68      0.65      0.43      9514\n",
1513
      "\n",
1514
      "[(1, 59442), (2, 59442), (3, 59442), (4, 59442)]\n",
1515
      "For fold 1:\n",
1516
      "Accuracy: 0.7191802417235943\n",
1517
      "f-score: 0.7191802417235943\n",
1518
      "                   pre       rec       spe        f1       geo       iba       sup\n",
1519
      "\n",
1520
      "          1       0.41      0.52      0.95      0.46      0.70      0.47       642\n",
1521
      "          2       0.79      0.90      0.41      0.84      0.61      0.39      6776\n",
1522
      "          3       0.47      0.20      0.95      0.28      0.43      0.17      1716\n",
1523
      "          4       0.17      0.11      0.98      0.13      0.32      0.10       381\n",
1524
      "\n",
1525
      "avg / total       0.68      0.72      0.57      0.69      0.57      0.34      9515\n",
1526
      "\n",
1527
      "[(1, 58698), (2, 58698), (3, 58698), (4, 58698)]\n",
1528
      "For fold 2:\n",
1529
      "Accuracy: 0.7133998949027851\n",
1530
      "f-score: 0.7133998949027851\n",
1531
      "                   pre       rec       spe        f1       geo       iba       sup\n",
1532
      "\n",
1533
      "          1       0.48      0.54      0.93      0.51      0.71      0.48       974\n",
1534
      "          2       0.88      0.80      0.58      0.84      0.69      0.48      7520\n",
1535
      "          3       0.16      0.29      0.88      0.21      0.51      0.24       697\n",
1536
      "          4       0.09      0.08      0.97      0.09      0.28      0.07       324\n",
1537
      "\n",
1538
      "avg / total       0.76      0.71      0.66      0.73      0.66      0.45      9515\n",
1539
      "\n",
1540
      "[(1, 59633), (2, 59633), (3, 59633), (4, 59633)]\n",
1541
      "For fold 3:\n",
1542
      "Accuracy: 0.7060430898581188\n",
1543
      "f-score: 0.7060430898581188\n",
1544
      "                   pre       rec       spe        f1       geo       iba       sup\n",
1545
      "\n",
1546
      "          1       0.57      0.59      0.93      0.58      0.74      0.53      1247\n",
1547
      "          2       0.81      0.85      0.55      0.83      0.68      0.48      6585\n",
1548
      "          3       0.33      0.24      0.91      0.28      0.47      0.20      1462\n",
1549
      "          4       0.08      0.08      0.98      0.08      0.27      0.07       221\n",
1550
      "\n",
1551
      "avg / total       0.69      0.71      0.66      0.69      0.65      0.44      9515\n",
1552
      "\n",
1553
      "[(1, 59870), (2, 59870), (3, 59870), (4, 59870)]\n",
1554
      "For fold 4:\n",
1555
      "Accuracy: 0.6672622175512349\n",
1556
      "f-score: 0.6672622175512349\n",
1557
      "                   pre       rec       spe        f1       geo       iba       sup\n",
1558
      "\n",
1559
      "          1       0.47      0.57      0.91      0.52      0.72      0.50      1129\n",
1560
      "          2       0.77      0.85      0.51      0.81      0.66      0.44      6348\n",
1561
      "          3       0.29      0.18      0.93      0.22      0.41      0.15      1285\n",
1562
      "          4       0.20      0.11      0.96      0.14      0.32      0.10       753\n",
1563
      "\n",
1564
      "avg / total       0.63      0.67      0.65      0.64      0.60      0.38      9515\n",
1565
      "\n",
1566
      "[(1, 59781), (2, 59781), (3, 59781), (4, 59781)]\n",
1567
      "For fold 5:\n",
1568
      "Accuracy: 0.6905937992643195\n",
1569
      "f-score: 0.6905937992643195\n",
1570
      "                   pre       rec       spe        f1       geo       iba       sup\n",
1571
      "\n",
1572
      "          1       0.52      0.54      0.94      0.53      0.71      0.49      1085\n",
1573
      "          2       0.79      0.87      0.50      0.83      0.66      0.45      6437\n",
1574
      "          3       0.43      0.21      0.94      0.28      0.44      0.18      1657\n",
1575
      "          4       0.11      0.15      0.95      0.12      0.37      0.13       336\n",
1576
      "\n",
1577
      "avg / total       0.67      0.69      0.65      0.67      0.62      0.40      9515\n",
1578
      "\n",
1579
      "[(1, 59994), (2, 59994), (3, 59994), (4, 59994)]\n",
1580
      "For fold 6:\n",
1581
      "Accuracy: 0.687651077246453\n",
1582
      "f-score: 0.687651077246453\n",
1583
      "                   pre       rec       spe        f1       geo       iba       sup\n",
1584
      "\n",
1585
      "          1       0.42      0.53      0.93      0.47      0.71      0.48       785\n",
1586
      "          2       0.76      0.90      0.46      0.83      0.65      0.43      6224\n",
1587
      "          3       0.52      0.23      0.94      0.32      0.47      0.20      2026\n",
1588
      "          4       0.16      0.08      0.98      0.10      0.27      0.07       480\n",
1589
      "\n",
1590
      "avg / total       0.65      0.69      0.63      0.65      0.59      0.37      9515\n",
1591
      "\n",
1592
      "[(1, 59534), (2, 59534), (3, 59534), (4, 59534)]\n",
1593
      "For fold 7:\n",
1594
      "Accuracy: 0.7031003678402522\n",
1595
      "f-score: 0.7031003678402522\n",
1596
      "                   pre       rec       spe        f1       geo       iba       sup\n",
1597
      "\n",
1598
      "          1       0.47      0.53      0.94      0.50      0.70      0.47       853\n",
1599
      "          2       0.80      0.87      0.49      0.84      0.66      0.45      6684\n",
1600
      "          3       0.33      0.27      0.92      0.29      0.49      0.23      1209\n",
1601
      "          4       0.28      0.11      0.97      0.16      0.33      0.10       769\n",
1602
      "\n",
1603
      "avg / total       0.67      0.70      0.63      0.68      0.61      0.39      9515\n",
1604
      "\n",
1605
      "[(1, 59573), (2, 59573), (3, 59573), (4, 59573)]\n",
1606
      "For fold 8:\n",
1607
      "Accuracy: 0.7104571728849185\n",
1608
      "f-score: 0.7104571728849185\n",
1609
      "                   pre       rec       spe        f1       geo       iba       sup\n",
1610
      "\n",
1611
      "          1       0.53      0.45      0.96      0.49      0.66      0.41       933\n",
1612
      "          2       0.78      0.90      0.40      0.84      0.60      0.38      6645\n",
1613
      "          3       0.40      0.19      0.94      0.26      0.42      0.16      1675\n",
1614
      "          4       0.11      0.09      0.98      0.10      0.29      0.08       262\n",
1615
      "\n",
1616
      "avg / total       0.67      0.71      0.57      0.68      0.57      0.34      9515\n",
1617
      "\n",
1618
      "[(1, 59819), (2, 59819), (3, 59819), (4, 59819)]\n",
1619
      "For fold 9:\n",
1620
      "Accuracy: 0.6803657767500526\n",
1621
      "f-score: 0.6803657767500526\n",
1622
      "                   pre       rec       spe        f1       geo       iba       sup\n",
1623
      "\n",
1624
      "          1       0.51      0.55      0.94      0.53      0.72      0.49      1031\n",
1625
      "          2       0.79      0.86      0.53      0.82      0.67      0.47      6399\n",
1626
      "          3       0.32      0.22      0.91      0.26      0.45      0.19      1495\n",
1627
      "          4       0.20      0.14      0.96      0.16      0.36      0.12       589\n",
1628
      "\n",
1629
      "avg / total       0.65      0.68      0.66      0.66      0.62      0.40      9514\n",
1630
      "\n",
1631
      "[(1, 59618), (2, 59618), (3, 59618), (4, 59618)]\n",
1632
      "For fold 10:\n",
1633
      "Accuracy: 0.6965524490224931\n",
1634
      "f-score: 0.6965524490224931\n",
1635
      "                   pre       rec       spe        f1       geo       iba       sup\n",
1636
      "\n",
1637
      "          1       0.51      0.60      0.92      0.55      0.74      0.54      1157\n",
1638
      "          2       0.81      0.85      0.55      0.83      0.69      0.48      6600\n",
1639
      "          3       0.31      0.22      0.93      0.25      0.45      0.19      1156\n",
1640
      "          4       0.16      0.11      0.96      0.13      0.33      0.10       601\n",
1641
      "\n",
1642
      "avg / total       0.67      0.70      0.67      0.68      0.64      0.43      9514\n",
1643
      "\n",
1644
      "[(1, 59442), (2, 59442), (3, 59442), (4, 59442)]\n",
1645
      "For fold 1:\n",
1646
      "Accuracy: 0.7225433526011561\n",
1647
      "f-score: 0.7225433526011561\n",
1648
      "                   pre       rec       spe        f1       geo       iba       sup\n",
1649
      "\n",
1650
      "          1       0.41      0.50      0.95      0.45      0.69      0.45       642\n",
1651
      "          2       0.79      0.91      0.41      0.85      0.61      0.39      6776\n",
1652
      "          3       0.47      0.19      0.95      0.27      0.43      0.17      1716\n",
1653
      "          4       0.19      0.12      0.98      0.14      0.34      0.10       381\n",
1654
      "\n",
1655
      "avg / total       0.68      0.72      0.56      0.69      0.57      0.34      9515\n",
1656
      "\n",
1657
      "[(1, 58698), (2, 58698), (3, 58698), (4, 58698)]\n",
1658
      "For fold 2:\n",
1659
      "Accuracy: 0.7017341040462428\n",
1660
      "f-score: 0.7017341040462428\n",
1661
      "                   pre       rec       spe        f1       geo       iba       sup\n",
1662
      "\n",
1663
      "          1       0.46      0.52      0.93      0.49      0.70      0.47       974\n",
1664
      "          2       0.88      0.79      0.58      0.83      0.68      0.47      7520\n",
1665
      "          3       0.16      0.31      0.87      0.21      0.52      0.26       697\n",
1666
      "          4       0.06      0.06      0.97      0.06      0.23      0.05       324\n",
1667
      "\n",
1668
      "avg / total       0.75      0.70      0.65      0.72      0.65      0.44      9515\n",
1669
      "\n",
1670
      "[(1, 59633), (2, 59633), (3, 59633), (4, 59633)]\n",
1671
      "For fold 3:\n",
1672
      "Accuracy: 0.7066736731476616\n",
1673
      "f-score: 0.7066736731476616\n",
1674
      "                   pre       rec       spe        f1       geo       iba       sup\n",
1675
      "\n",
1676
      "          1       0.58      0.58      0.94      0.58      0.73      0.52      1247\n",
1677
      "          2       0.81      0.86      0.54      0.83      0.68      0.48      6585\n",
1678
      "          3       0.33      0.24      0.91      0.28      0.47      0.20      1462\n",
1679
      "          4       0.10      0.10      0.98      0.10      0.31      0.09       221\n",
1680
      "\n",
1681
      "avg / total       0.69      0.71      0.66      0.70      0.65      0.43      9515\n",
1682
      "\n",
1683
      "[(1, 59870), (2, 59870), (3, 59870), (4, 59870)]\n",
1684
      "For fold 4:\n",
1685
      "Accuracy: 0.6660010509721492\n",
1686
      "f-score: 0.6660010509721492\n",
1687
      "                   pre       rec       spe        f1       geo       iba       sup\n",
1688
      "\n",
1689
      "          1       0.48      0.59      0.91      0.53      0.74      0.53      1129\n",
1690
      "          2       0.78      0.84      0.52      0.81      0.66      0.45      6348\n",
1691
      "          3       0.29      0.18      0.93      0.22      0.41      0.15      1285\n",
1692
      "          4       0.18      0.11      0.96      0.14      0.32      0.10       753\n",
1693
      "\n",
1694
      "avg / total       0.63      0.67      0.66      0.64      0.61      0.39      9515\n",
1695
      "\n",
1696
      "[(1, 59781), (2, 59781), (3, 59781), (4, 59781)]\n",
1697
      "For fold 5:\n",
1698
      "Accuracy: 0.6910141881240147\n",
1699
      "f-score: 0.6910141881240147\n",
1700
      "                   pre       rec       spe        f1       geo       iba       sup\n",
1701
      "\n",
1702
      "          1       0.52      0.53      0.94      0.53      0.71      0.48      1085\n",
1703
      "          2       0.78      0.88      0.49      0.83      0.66      0.45      6437\n",
1704
      "          3       0.40      0.19      0.94      0.26      0.42      0.16      1657\n",
1705
      "          4       0.09      0.11      0.96      0.10      0.32      0.10       336\n",
1706
      "\n",
1707
      "avg / total       0.66      0.69      0.64      0.67      0.61      0.39      9515\n",
1708
      "\n",
1709
      "[(1, 59994), (2, 59994), (3, 59994), (4, 59994)]\n",
1710
      "For fold 6:\n",
1711
      "Accuracy: 0.6917498686284813\n",
1712
      "f-score: 0.6917498686284813\n",
1713
      "                   pre       rec       spe        f1       geo       iba       sup\n",
1714
      "\n",
1715
      "          1       0.44      0.56      0.94      0.49      0.72      0.50       785\n",
1716
      "          2       0.76      0.90      0.47      0.83      0.65      0.44      6224\n",
1717
      "          3       0.53      0.25      0.94      0.34      0.48      0.22      2026\n",
1718
      "          4       0.17      0.08      0.98      0.11      0.29      0.07       480\n",
1719
      "\n",
1720
      "avg / total       0.66      0.69      0.64      0.66      0.60      0.38      9515\n",
1721
      "\n",
1722
      "[(1, 59534), (2, 59534), (3, 59534), (4, 59534)]\n",
1723
      "For fold 7:\n",
1724
      "Accuracy: 0.7042564372044141\n",
1725
      "f-score: 0.7042564372044141\n",
1726
      "                   pre       rec       spe        f1       geo       iba       sup\n",
1727
      "\n",
1728
      "          1       0.46      0.52      0.94      0.49      0.70      0.47       853\n",
1729
      "          2       0.80      0.87      0.50      0.84      0.66      0.45      6684\n",
1730
      "          3       0.34      0.29      0.92      0.31      0.51      0.25      1209\n",
1731
      "          4       0.30      0.11      0.98      0.16      0.33      0.10       769\n",
1732
      "\n",
1733
      "avg / total       0.67      0.70      0.63      0.68      0.62      0.40      9515\n",
1734
      "\n",
1735
      "[(1, 59573), (2, 59573), (3, 59573), (4, 59573)]\n",
1736
      "For fold 8:\n",
1737
      "Accuracy: 0.7128744088281661\n",
1738
      "f-score: 0.7128744088281661\n",
1739
      "                   pre       rec       spe        f1       geo       iba       sup\n",
1740
      "\n",
1741
      "          1       0.57      0.46      0.96      0.51      0.67      0.42       933\n",
1742
      "          2       0.78      0.90      0.42      0.84      0.61      0.39      6645\n",
1743
      "          3       0.38      0.22      0.92      0.27      0.45      0.19      1675\n",
1744
      "          4       0.12      0.07      0.98      0.09      0.27      0.06       262\n",
1745
      "\n",
1746
      "avg / total       0.67      0.71      0.58      0.68      0.58      0.35      9515\n",
1747
      "\n",
1748
      "[(1, 59819), (2, 59819), (3, 59819), (4, 59819)]\n",
1749
      "For fold 9:\n",
1750
      "Accuracy: 0.6898255202858945\n",
1751
      "f-score: 0.6898255202858945\n",
1752
      "                   pre       rec       spe        f1       geo       iba       sup\n",
1753
      "\n",
1754
      "          1       0.51      0.54      0.94      0.53      0.71      0.49      1031\n",
1755
      "          2       0.79      0.87      0.51      0.83      0.67      0.46      6399\n",
1756
      "          3       0.35      0.21      0.93      0.27      0.45      0.18      1495\n",
1757
      "          4       0.22      0.15      0.97      0.18      0.38      0.13       589\n",
1758
      "\n",
1759
      "avg / total       0.65      0.69      0.65      0.67      0.62      0.40      9514\n",
1760
      "\n",
1761
      "[(1, 59618), (2, 59618), (3, 59618), (4, 59618)]\n",
1762
      "For fold 10:\n",
1763
      "Accuracy: 0.6950809333613622\n",
1764
      "f-score: 0.6950809333613622\n",
1765
      "                   pre       rec       spe        f1       geo       iba       sup\n",
1766
      "\n",
1767
      "          1       0.52      0.60      0.92      0.56      0.75      0.54      1157\n",
1768
      "          2       0.81      0.85      0.56      0.83      0.69      0.49      6600\n",
1769
      "          3       0.28      0.21      0.93      0.24      0.44      0.18      1156\n",
1770
      "          4       0.18      0.13      0.96      0.15      0.35      0.11       601\n",
1771
      "\n",
1772
      "avg / total       0.67      0.70      0.67      0.68      0.64      0.43      9514\n",
1773
      "\n"
1774
     ]
1775
    },
1776
    {
1777
     "data": {
1778
      "text/plain": [
1779
       "<Figure size 576x396 with 0 Axes>"
1780
      ]
1781
     },
1782
     "metadata": {},
1783
     "output_type": "display_data"
1784
    }
1785
   ],
1786
   "source": [
1787
    "from sklearn.model_selection import KFold\n",
1788
    "from sklearn import preprocessing\n",
1789
    "from imblearn.over_sampling import SMOTENC\n",
1790
    "from sklearn.metrics import f1_score\n",
1791
    "from imblearn.metrics import classification_report_imbalanced\n",
1792
    "from yellowbrick.classifier import ROCAUC\n",
1793
    "# explicitly require this experimental feature\n",
1794
    "from sklearn.experimental import enable_iterative_imputer  # noqa\n",
1795
    "# now you can import normally from sklearn.impute\n",
1796
    "from sklearn.impute import IterativeImputer\n",
1797
    "from sklearn.linear_model import LogisticRegression\n",
1798
    "from numpy import loadtxt\n",
1799
    "import os\n",
1800
    "os.environ['KMP_DUPLICATE_LIB_OK']='True'\n",
1801
    "from xgboost import XGBClassifier\n",
1802
    "from sklearn.model_selection import train_test_split\n",
1803
    "from sklearn.metrics import accuracy_score\n",
1804
    "import io \n",
1805
    "\n",
1806
    "classes=['Death','Home','Nursing Home','Rehabilitation']\n",
1807
    "\n",
1808
    "\n",
1809
    "\n",
1810
    "kf = KFold(n_splits=10)\n",
1811
    "\n",
1812
    "\n",
1813
    "for i in range (1,11):\n",
1814
    "\n",
1815
    "    for fold, (train_index, test_index) in enumerate(kf.split(X), 1):\n",
1816
    "        X_train = X.iloc[train_index]\n",
1817
    "        y_train = y.iloc[train_index]  # Based on your code, you might need a ravel call here, but I would look into how you're generating your y\n",
1818
    "        X_test = X.iloc[test_index]\n",
1819
    "        y_test = y.iloc[test_index]  # See comment on ravel and  y_train\n",
1820
    "    \n",
1821
    "    \n",
1822
    "    #------------------------------IMPUTE Training Set------------------------------------\n",
1823
    "\n",
1824
    "        # Use MICE to fill in each row's missing features\n",
1825
    "        X_train = pd.DataFrame(IterativeImputer(verbose=False, sample_posterior=True).fit_transform(X_train))\n",
1826
    "        X_train.columns = df_cols\n",
1827
    "\n",
1828
    "    #------------------------------IMPUTE Testing Set------------------------------------ \n",
1829
    "\n",
1830
    "        # Use MICE to fill in each row's missing features\n",
1831
    "        X_test = pd.DataFrame(IterativeImputer(verbose=False, sample_posterior=True).fit_transform(X_test))\n",
1832
    "        X_test.columns = df_cols\n",
1833
    "\n",
1834
    "\n",
1835
    "    #------------------------------Standardize Testing Set------------------------------------\n",
1836
    "\n",
1837
    "        std_scale = preprocessing.StandardScaler().fit(X_train[cols_to_norm])\n",
1838
    "        X_train[cols_to_norm] = std_scale.transform(X_train[cols_to_norm])\n",
1839
    "        X_test[cols_to_norm] = std_scale.transform(X_test[cols_to_norm])\n",
1840
    "    #------------------------------------------------------------------------------------------\n",
1841
    "\n",
1842
    "     # Hyperparameters are optimized using hyperopt\n",
1843
    "\n",
1844
    "        #sm = SMOTE()\n",
1845
    "\n",
1846
    "        sm = SMOTENC(random_state=50, categorical_features=[1,2,3,22,23,24,25,26,27,28,29,30,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])        \n",
1847
    "        X_train_oversampled, y_train_oversampled = sm.fit_sample(X_train, y_train)\n",
1848
    "        print(sorted(Counter(y_train_oversampled).items()))\n",
1849
    "        model = XGBClassifier(max_depth=8, gamma=0.063, colsample_bytree=0.71) \n",
1850
    "        model.fit(X_train_oversampled, y_train_oversampled)  \n",
1851
    "        y_pred = model.predict(X_test.values)\n",
1852
    "        visualizer = ROCAUC(model, classes=classes)\n",
1853
    "        visualizer.fit(X_train_oversampled, y_train_oversampled)  # Fit the training data to the visualizer\n",
1854
    "        visualizer.score(X_test.values, y_test)  # Evaluate the model on the test data\n",
1855
    "        visualizer.poof(\"XB_SMOTENC_{}_{}.pdf\".format(i, fold), clear_figure=True) \n",
1856
    "        print(f'For fold {fold}:')\n",
1857
    "        print(f'Accuracy: {model.score(X_test.values, y_test)}')\n",
1858
    "        f1=f1_score(y_test, y_pred, average='micro')\n",
1859
    "        print(f'f-score: {f1}')\n",
1860
    "        print(classification_report_imbalanced(y_test, y_pred))\n",
1861
    "        K= classification_report_imbalanced(y_test, y_pred)\n",
1862
    "        df = pd.read_fwf(io.StringIO(K))\n",
1863
    "        df.loc[\"1\":\"1\",\"pre\":\"sup\"].to_csv(\"XGB-SMOTENC-D.csv\" , sep=',', encoding='utf-8', doublequote=False, index=False, mode=\"a\", header=False)\n",
1864
    "        df.loc[\"2\":\"2\",\"pre\":\"sup\"].to_csv(\"XGB-SMOTENC-H.csv\" , sep=',', encoding='utf-8', doublequote=False, index=False, mode=\"a\", header=False)\n",
1865
    "        df.loc[\"3\":\"3\",\"pre\":\"sup\"].to_csv(\"XGB-SMOTENC-N.csv\" , sep=',', encoding='utf-8', doublequote=False, index=False, mode=\"a\", header=False)\n",
1866
    "        df.loc[\"4\":\"4\",\"pre\":\"sup\"].to_csv(\"XGB-SMOTENC-R.csv\" , sep=',', encoding='utf-8', doublequote=False, index=False, mode=\"a\", header=False)\n",
1867
    "        df.iloc[6:7,:].to_csv(\"XGB-SMOTENC-avg.csv\" , sep=',', encoding='utf-8', doublequote=False, index=False, mode=\"a\", header=False)\n",
1868
    "\n",
1869
    "        #\n",
1870
    "\n",
1871
    "\n",
1872
    "    "
1873
   ]
1874
  },
1875
  {
1876
   "cell_type": "code",
1877
   "execution_count": null,
1878
   "metadata": {},
1879
   "outputs": [],
1880
   "source": []
1881
  },
1882
  {
1883
   "cell_type": "code",
1884
   "execution_count": null,
1885
   "metadata": {},
1886
   "outputs": [],
1887
   "source": []
1888
  }
1889
 ],
1890
 "metadata": {
1891
  "kernelspec": {
1892
   "display_name": "Python 3",
1893
   "language": "python",
1894
   "name": "python3"
1895
  },
1896
  "language_info": {
1897
   "codemirror_mode": {
1898
    "name": "ipython",
1899
    "version": 3
1900
   },
1901
   "file_extension": ".py",
1902
   "mimetype": "text/x-python",
1903
   "name": "python",
1904
   "nbconvert_exporter": "python",
1905
   "pygments_lexer": "ipython3",
1906
   "version": "3.8.3"
1907
  }
1908
 },
1909
 "nbformat": 4,
1910
 "nbformat_minor": 4
1911
}