In [1]:
import json
import pandas as pd
import tensorflow as tf
import numpy as np
df = pd.read_csv("kaggle_data/eeg-data.csv")
In [2]:
df.head()
Out[2]:
Unnamed: 0
id
indra_time
browser_latency
reading_time
attention_esense
meditation_esense
eeg_power
raw_values
signal_quality
createdAt
updatedAt
label
0
3730
12
2015-05-09 23:13:42.281
1461
2015-05-09 16:13:40.954
0
0
[944412.0, 111373.0, 52404.0, 28390.0, 3237.0,...
[-203.0, -202.0, -196.0, -185.0, -163.0, -137....
200
2015-05-09 23:13:39.550
2015-05-09 23:13:39.549+00
unlabeled
1
3732
12
2015-05-09 23:13:43.186
1461
2015-05-09 16:13:41.964
0
0
[1793049.0, 89551.0, 3896.0, 21727.0, 9301.0, ...
[104.0, 134.0, 128.0, 121.0, 145.0, 151.0, 123...
200
2015-05-09 23:13:40.559
2015-05-09 23:13:40.559+00
unlabeled
2
3734
12
2015-05-09 23:13:44.392
1461
2015-05-09 16:13:42.950
0
0
[400192.0, 640624.0, 153087.0, 69733.0, 98854....
[2002.0, 2047.0, 2047.0, 2047.0, 2047.0, 2047....
200
2015-05-09 23:13:41.549
2015-05-09 23:13:41.549+00
unlabeled
3
3735
12
2015-05-09 23:13:45.297
1461
2015-05-09 16:13:43.935
0
0
[681192.0, 138630.0, 67891.0, 26459.0, 592240....
[1287.0, 1241.0, 1196.0, 1155.0, 1113.0, 1072....
200
2015-05-09 23:13:42.532
2015-05-09 23:13:42.532+00
unlabeled
4
3737
12
2015-05-09 23:13:46.201
1460
2015-05-09 16:13:44.936
0
0
[268406.0, 197772.0, 190654.0, 266433.0, 91683...
[1905.0, 1836.0, 1770.0, 1707.0, 1645.0, 1587....
200
2015-05-09 23:13:43.532
2015-05-09 23:13:43.532+00
unlabeled
In [3]:
df.loc[df.label=='math1']
Out[3]:
Unnamed: 0
id
indra_time
browser_latency
reading_time
attention_esense
meditation_esense
eeg_power
raw_values
signal_quality
createdAt
updatedAt
label
13803
571
1
2015-05-09 23:33:28.977
13403
2015-05-09 16:33:15.726
48
100
[6650.0, 22871.0, 45854.0, 191253.0, 15457.0, ...
[108.0, 114.0, 120.0, 123.0, 114.0, 104.0, 96....
0
2015-05-09 23:33:02.386
2015-05-09 23:33:02.386+00
math1
13804
23011
4
2015-05-09 23:33:28.985
7691
2015-05-09 19:33:21.374
17
100
[3131.0, 11610.0, 20863.0, 54613.0, 3711.0, 62...
[88.0, 88.0, 73.0, 74.0, 82.0, 70.0, 58.0, 60....
0
2015-05-09 23:33:13.736
2015-05-09 23:33:13.736+00
math1
13805
12667
2
2015-05-09 23:33:29.017
26
2015-05-09 16:33:29.147
40
48
[96747.0, 24552.0, 1629.0, 3301.0, 3926.0, 432...
[153.0, 129.0, 118.0, 113.0, 106.0, 108.0, 124...
0
2015-05-09 23:33:29.178
2015-05-09 23:33:29.178+00
math1
13806
6082
14
2015-05-09 23:33:29.052
726
2015-05-09 16:33:28.535
44
69
[20245.0, 7854.0, 4321.0, 13089.0, 9479.0, 434...
[49.0, 36.0, 28.0, 21.0, 19.0, 9.0, 0.0, 5.0, ...
0
2015-05-09 23:33:27.873
2015-05-09 23:33:27.873+00
math1
13807
3426
12
2015-05-09 23:33:29.109
1504
2015-05-09 16:33:27.868
66
87
[2740.0, 27325.0, 30234.0, 18751.0, 13404.0, 1...
[11.0, 27.0, 37.0, 17.0, 3.0, 10.0, 25.0, 34.0...
0
2015-05-09 23:33:26.417
2015-05-09 23:33:26.417+00
math1
13808
4894
13
2015-05-09 23:33:29.225
-293
2015-05-09 16:33:29.621
27
53
[2748564.0, 481537.0, 28312.0, 96849.0, 180628...
[92.0, 107.0, 149.0, 202.0, 228.0, 204.0, 149....
0
2015-05-09 23:33:29.979
2015-05-09 23:33:29.979+00
math1
13809
27666
8
2015-05-09 23:33:29.483
-40
2015-05-09 16:33:29.532
14
70
[786351.0, 226029.0, 41133.0, 14584.0, 24339.0...
[77.0, 66.0, 64.0, 65.0, 59.0, 59.0, 71.0, 103...
0
2015-05-09 23:33:29.638
2015-05-09 23:33:29.638+00
math1
13810
25824
6
2015-05-09 23:33:29.498
-1,561
2015-05-09 16:33:31.132
47
30
[82296.0, 306508.0, 31953.0, 12513.0, 25488.0,...
[-29.0, -42.0, -52.0, -51.0, -39.0, -24.0, -11...
0
2015-05-09 23:33:32.751
2015-05-09 23:33:32.751+00
math1
13811
1262
10
2015-05-09 23:33:29.522
-18
2015-05-09 16:33:29.636
37
70
[1196729.0, 72232.0, 18068.0, 12065.0, 6169.0,...
[1296.0, 1313.0, 1314.0, 1299.0, 1281.0, 1264....
51
2015-05-09 23:33:29.722
2015-05-09 23:33:29.722+00
math1
13812
2463
11
2015-05-09 23:33:29.599
-179
2015-05-09 16:33:29.976
41
44
[566294.0, 143887.0, 15984.0, 87967.0, 12868.0...
[-66.0, -43.0, -36.0, -28.0, -4.0, 9.0, 16.0, ...
0
2015-05-09 23:33:30.212
2015-05-09 23:33:30.212+00
math1
13813
29080
9
2015-05-09 23:33:29.679
10589
2015-05-09 16:33:19.184
21
91
[445763.0, 136488.0, 16102.0, 9134.0, 12185.0,...
[16.0, 20.0, 17.0, 21.0, 21.0, 26.0, 35.0, 44....
0
2015-05-09 23:33:08.765
2015-05-09 23:33:08.765+00
math1
13814
24387
5
2015-05-09 23:33:29.696
1021
2015-05-09 16:33:28.895
44
81
[12741.0, 7178.0, 10742.0, 18229.0, 3154.0, 98...
[171.0, 136.0, 109.0, 105.0, 92.0, 82.0, 72.0,...
0
2015-05-09 23:33:27.930
2015-05-09 23:33:27.93+00
math1
13815
26915
7
2015-05-09 23:33:29.701
13
2015-05-09 16:33:29.868
27
51
[100303.0, 40807.0, 22178.0, 22016.0, 9447.0, ...
[98.0, 86.0, 86.0, 93.0, 106.0, 114.0, 105.0, ...
0
2015-05-09 23:33:29.917
2015-05-09 23:33:29.917+00
math1
13816
21254
3
2015-05-09 23:33:29.732
14853
2015-05-09 16:33:14.873
63
63
[10586.0, 11799.0, 8730.0, 72495.0, 17319.0, 9...
[-8.0, -9.0, -1.0, 5.0, 11.0, 19.0, 11.0, 7.0,...
0
2015-05-09 23:33:00.130
2015-05-09 23:33:00.13+00
math1
13817
7337
15
2015-05-09 23:33:29.831
9268
2015-05-09 16:33:20.557
27
70
[71562.0, 109854.0, 292237.0, 31694.0, 22669.0...
[8.0, -5.0, 5.0, 23.0, 0.0, -41.0, -46.0, -23....
0
2015-05-09 23:33:11.350
2015-05-09 23:33:11.35+00
math1
13818
572
1
2015-05-09 23:33:29.889
13403
2015-05-09 16:33:16.744
50
93
[17269.0, 46755.0, 7453.0, 41606.0, 30618.0, 8...
[73.0, 69.0, 70.0, 87.0, 104.0, 107.0, 109.0, ...
0
2015-05-09 23:33:03.399
2015-05-09 23:33:03.399+00
math1
13819
23013
4
2015-05-09 23:33:29.898
7691
2015-05-09 19:33:22.333
24
100
[9018.0, 39612.0, 77045.0, 4782.0, 9079.0, 724...
[23.0, 16.0, 23.0, 29.0, 33.0, 27.0, 24.0, 19....
0
2015-05-09 23:33:14.700
2015-05-09 23:33:14.7+00
math1
13820
12668
2
2015-05-09 23:33:29.927
26
2015-05-09 16:33:30.164
30
53
[548827.0, 184431.0, 21349.0, 48059.0, 13182.0...
[68.0, 57.0, 43.0, 41.0, 40.0, 36.0, 39.0, 50....
0
2015-05-09 23:33:30.200
2015-05-09 23:33:30.2+00
math1
13821
6083
14
2015-05-09 23:33:29.958
726
2015-05-09 16:33:29.505
27
69
[532615.0, 39074.0, 17091.0, 7961.0, 7427.0, 3...
[-21.0, -34.0, -29.0, -12.0, 4.0, 23.0, 33.0, ...
0
2015-05-09 23:33:28.844
2015-05-09 23:33:28.844+00
math1
13822
4895
13
2015-05-09 23:33:30.133
-293
2015-05-09 16:33:30.593
43
50
[346371.0, 195046.0, 53390.0, 97709.0, 22227.0...
[-54.0, -78.0, -29.0, 49.0, 65.0, 19.0, -23.0,...
0
2015-05-09 23:33:30.954
2015-05-09 23:33:30.954+00
math1
13823
3427
12
2015-05-09 23:33:30.316
1504
2015-05-09 16:33:28.877
64
91
[24322.0, 12393.0, 18707.0, 18054.0, 6422.0, 1...
[-2.0, 23.0, 21.0, 16.0, 20.0, 25.0, 24.0, 17....
0
2015-05-09 23:33:27.425
2015-05-09 23:33:27.425+00
math1
13824
27667
8
2015-05-09 23:33:30.389
-40
2015-05-09 16:33:30.530
23
41
[182280.0, 64319.0, 8527.0, 3150.0, 17497.0, 4...
[12.0, -17.0, -13.0, -1.0, 0.0, -23.0, -49.0, ...
0
2015-05-09 23:33:30.635
2015-05-09 23:33:30.635+00
math1
13825
25825
6
2015-05-09 23:33:30.397
-1,561
2015-05-09 16:33:32.124
34
23
[56140.0, 131106.0, 22100.0, 3186.0, 18234.0, ...
[13.0, 8.0, 12.0, 7.0, 0.0, 2.0, 4.0, 6.0, -1....
0
2015-05-09 23:33:33.742
2015-05-09 23:33:33.742+00
math1
13826
1263
10
2015-05-09 23:33:30.444
-18
2015-05-09 16:33:30.652
37
70
[1038633.0, 24009.0, 8498.0, 11596.0, 5250.0, ...
[736.0, 822.0, 897.0, 919.0, 889.0, 882.0, 936...
26
2015-05-09 23:33:30.737
2015-05-09 23:33:30.737+00
math1
13827
2464
11
2015-05-09 23:33:30.498
-179
2015-05-09 16:33:30.946
24
41
[44631.0, 28182.0, 6531.0, 4433.0, 2829.0, 205...
[68.0, 39.0, 11.0, 4.0, 22.0, 59.0, 85.0, 73.0...
0
2015-05-09 23:33:31.184
2015-05-09 23:33:31.184+00
math1
13828
29081
9
2015-05-09 23:33:30.593
10589
2015-05-09 16:33:20.135
27
74
[346173.0, 21553.0, 7358.0, 2550.0, 2025.0, 29...
[-51.0, -35.0, -18.0, -17.0, -34.0, -57.0, -86...
0
2015-05-09 23:33:09.697
2015-05-09 23:33:09.697+00
math1
13829
24388
5
2015-05-09 23:33:30.604
1022
2015-05-09 16:33:29.877
54
74
[270590.0, 35407.0, 16473.0, 34913.0, 6196.0, ...
[90.0, 75.0, 60.0, 65.0, 82.0, 89.0, 75.0, 57....
0
2015-05-09 23:33:28.911
2015-05-09 23:33:28.911+00
math1
13830
26916
7
2015-05-09 23:33:30.613
13
2015-05-09 16:33:30.840
50
38
[55650.0, 28674.0, 5821.0, 13657.0, 11440.0, 5...
[-243.0, -244.0, -234.0, -234.0, -235.0, -243....
0
2015-05-09 23:33:30.889
2015-05-09 23:33:30.889+00
math1
13831
21255
3
2015-05-09 23:33:30.640
14853
2015-05-09 16:33:15.853
51
78
[20730.0, 26625.0, 5139.0, 109080.0, 26955.0, ...
[36.0, 48.0, 55.0, 58.0, 64.0, 68.0, 58.0, 55....
0
2015-05-09 23:33:01.284
2015-05-09 23:33:01.284+00
math1
13832
7339
15
2015-05-09 23:33:30.747
9268
2015-05-09 16:33:21.579
23
69
[66886.0, 19258.0, 34078.0, 8899.0, 4379.0, 22...
[-60.0, -66.0, -65.0, -56.0, -51.0, -50.0, -42...
0
2015-05-09 23:33:12.371
2015-05-09 23:33:12.371+00
math1
...
...
...
...
...
...
...
...
...
...
...
...
...
...
23354
14739
22
2015-05-09 23:44:26.864
7686
2015-05-09 19:44:19.174
37
94
[28655.0, 16334.0, 7645.0, 61328.0, 8595.0, 11...
[-18.0, -7.0, 11.0, 17.0, 13.0, 10.0, 5.0, 0.0...
0
2015-05-09 23:44:11.545
2015-05-09 23:44:11.545+00
math1
23355
14046
20
2015-05-09 23:44:27.092
1015
2015-05-09 16:44:26.098
84
64
[53270.0, 22247.0, 3402.0, 12503.0, 9856.0, 66...
[69.0, 35.0, 51.0, 105.0, 154.0, 172.0, 163.0,...
0
2015-05-09 23:44:25.143
2015-05-09 23:44:25.143+00
math1
23356
19801
29
2015-05-09 23:44:27.112
954520
2015-05-09 17:00:21.577
26
57
[455685.0, 63784.0, 3981.0, 7622.0, 4884.0, 60...
[53.0, 22.0, 33.0, 64.0, 70.0, 59.0, 50.0, 51....
0
2015-05-09 23:44:27.112
2015-05-09 23:44:27.112+00
math1
23357
20372
29
2015-05-09 23:44:27.112
954520
2015-05-09 17:00:21.577
26
57
[455685.0, 63784.0, 3981.0, 7622.0, 4884.0, 60...
[53.0, 22.0, 33.0, 64.0, 70.0, 59.0, 50.0, 51....
0
2015-05-09 23:44:27.112
2015-05-09 23:44:27.112+00
math1
23358
11431
19
2015-05-09 23:44:27.127
14879
2015-05-09 16:44:12.384
37
80
[464158.0, 72935.0, 12996.0, 12294.0, 3770.0, ...
[65.0, 57.0, 33.0, 23.0, 20.0, 2.0, 21.0, 42.0...
0
2015-05-09 23:43:57.687
2015-05-09 23:43:57.687+00
math1
23359
8718
16
2015-05-09 23:44:27.137
-52
2015-05-09 16:44:27.440
13
50
[58735.0, 16411.0, 1329.0, 7652.0, 591.0, 8002...
[43.0, 39.0, 37.0, 24.0, 8.0, 10.0, 25.0, 32.0...
0
2015-05-09 23:44:27.559
2015-05-09 23:44:27.559+00
math1
23360
15912
24
2015-05-09 23:44:27.172
-1,570
2015-05-09 16:44:28.814
57
44
[61005.0, 107502.0, 2903.0, 8912.0, 14029.0, 1...
[-210.0, -29.0, 20.0, -49.0, -166.0, -290.0, -...
0
2015-05-09 23:44:30.441
2015-05-09 23:44:30.441+00
math1
23361
15363
23
2015-05-09 23:44:27.181
1534
2015-05-09 16:44:25.702
61
66
[205199.0, 24555.0, 44424.0, 23740.0, 10878.0,...
[-4.0, 0.0, 7.0, 16.0, 5.0, 5.0, 28.0, 42.0, 4...
0
2015-05-09 23:44:24.230
2015-05-09 23:44:24.23+00
math1
23362
22351
30
2015-05-09 23:44:27.303
760
2015-05-09 16:44:26.589
53
48
[700874.0, 64196.0, 26197.0, 62197.0, 12148.0,...
[18.0, 17.0, 33.0, 60.0, 58.0, 34.0, 23.0, 43....
0
2015-05-09 23:44:25.884
2015-05-09 23:44:25.884+00
math1
23363
17781
26
2015-05-09 23:44:27.310
-1,167
2015-05-09 16:44:29.097
78
44
[32528.0, 27443.0, 6218.0, 8195.0, 16992.0, 68...
[70.0, 80.0, 89.0, 93.0, 84.0, 70.0, 71.0, 85....
0
2015-05-09 23:44:30.328
2015-05-09 23:44:30.328+00
math1
23364
18302
27
2015-05-09 23:44:27.452
-937
2015-05-09 16:44:28.431
75
26
[865839.0, 48548.0, 19106.0, 18469.0, 4770.0, ...
[57.0, 36.0, 27.0, 11.0, 5.0, 10.0, 17.0, 20.0...
0
2015-05-09 23:44:29.431
2015-05-09 23:44:29.431+00
math1
23365
9388
17
2015-05-09 23:44:27.518
47
2015-05-09 16:44:28.547
48
47
[24687.0, 26126.0, 8673.0, 6847.0, 17963.0, 58...
[11.0, 48.0, 76.0, 85.0, 85.0, 83.0, 98.0, 118...
0
2015-05-09 23:44:28.578
2015-05-09 23:44:28.578+00
math1
23366
9387
17
2015-05-09 23:44:27.518
47
2015-05-09 16:44:27.546
48
51
[31092.0, 4994.0, 1872.0, 9399.0, 5875.0, 6557...
[39.0, 38.0, 38.0, 50.0, 68.0, 60.0, 27.0, 19....
0
2015-05-09 23:44:27.572
2015-05-09 23:44:27.572+00
math1
23367
10875
18
2015-05-09 23:44:27.706
-985
2015-05-09 16:44:28.976
44
64
[1701233.0, 762368.0, 228436.0, 29008.0, 17542...
[87.0, 134.0, 170.0, 168.0, 170.0, 167.0, 178....
0
2015-05-09 23:44:30.029
2015-05-09 23:44:30.029+00
math1
23368
19452
28
2015-05-09 23:44:27.758
-327
2015-05-09 16:44:28.270
60
40
[1120375.0, 59023.0, 41160.0, 13340.0, 11043.0...
[2.0, 42.0, 61.0, 82.0, 106.0, 145.0, 146.0, 1...
0
2015-05-09 23:44:28.655
2015-05-09 23:44:28.655+00
math1
23369
14740
22
2015-05-09 23:44:27.774
7686
2015-05-09 19:44:20.207
47
94
[71181.0, 24360.0, 16518.0, 63820.0, 6579.0, 1...
[-23.0, -9.0, 12.0, 28.0, 32.0, 21.0, 26.0, 41...
0
2015-05-09 23:44:12.581
2015-05-09 23:44:12.581+00
math1
23370
14320
21
2015-05-09 23:44:27.821
-46
2015-05-09 16:44:27.953
16
61
[114452.0, 20224.0, 874.0, 3019.0, 1365.0, 106...
[26.0, 23.0, 12.0, 6.0, 6.0, 24.0, 43.0, 48.0,...
0
2015-05-09 23:44:28.056
2015-05-09 23:44:28.056+00
math1
23371
14047
20
2015-05-09 23:44:27.998
1015
2015-05-09 16:44:27.108
74
67
[422563.0, 89248.0, 57397.0, 18760.0, 11596.0,...
[-33.0, -40.0, -39.0, -28.0, -13.0, -2.0, -2.0...
0
2015-05-09 23:44:26.152
2015-05-09 23:44:26.152+00
math1
23372
17183
25
2015-05-09 23:44:28.058
-224
2015-05-09 16:44:28.360
26
53
[40705.0, 56998.0, 6331.0, 3652.0, 587.0, 535....
[42.0, 55.0, 68.0, 69.0, 67.0, 54.0, 42.0, 40....
0
2015-05-09 23:44:28.643
2015-05-09 23:44:28.643+00
math1
23373
15913
24
2015-05-09 23:44:28.073
-1,570
2015-05-09 16:44:29.825
57
43
[737460.0, 192229.0, 18332.0, 23809.0, 17179.0...
[135.0, 97.0, 52.0, 73.0, 74.0, 41.0, 72.0, 88...
0
2015-05-09 23:44:31.453
2015-05-09 23:44:31.453+00
math1
23374
15364
23
2015-05-09 23:44:28.086
1533
2015-05-09 16:44:26.679
56
69
[125266.0, 51332.0, 20802.0, 2295.0, 1710.0, 5...
[18.0, 11.0, 6.0, 7.0, 27.0, 53.0, 67.0, 69.0,...
0
2015-05-09 23:44:25.208
2015-05-09 23:44:25.208+00
math1
23375
20373
29
2015-05-09 23:44:28.105
954520
2015-05-09 17:00:22.574
34
51
[31876.0, 44577.0, 47398.0, 15314.0, 7329.0, 1...
[-7.0, 21.0, 40.0, 40.0, 43.0, 50.0, 54.0, 41....
0
2015-05-09 23:44:28.105
2015-05-09 23:44:28.105+00
math1
23376
19802
29
2015-05-09 23:44:28.105
954520
2015-05-09 17:00:22.574
34
51
[31876.0, 44577.0, 47398.0, 15314.0, 7329.0, 1...
[-7.0, 21.0, 40.0, 40.0, 43.0, 50.0, 54.0, 41....
0
2015-05-09 23:44:28.105
2015-05-09 23:44:28.105+00
math1
23377
22352
30
2015-05-09 23:44:28.209
760
2015-05-09 16:44:27.579
51
66
[38749.0, 15106.0, 16249.0, 28545.0, 9172.0, 1...
[-9.0, 17.0, 41.0, 48.0, 72.0, 67.0, 36.0, 37....
0
2015-05-09 23:44:26.875
2015-05-09 23:44:26.875+00
math1
23378
17782
26
2015-05-09 23:44:28.310
-1,167
2015-05-09 16:44:30.080
78
54
[48936.0, 8541.0, 2215.0, 10138.0, 4340.0, 866...
[74.0, 59.0, 49.0, 56.0, 76.0, 80.0, 61.0, 53....
0
2015-05-09 23:44:31.311
2015-05-09 23:44:31.311+00
math1
23379
11432
19
2015-05-09 23:44:28.317
14854
2015-05-09 16:44:13.652
26
96
[388286.0, 48645.0, 24581.0, 248017.0, 3569.0,...
[6.0, 19.0, 34.0, 54.0, 61.0, 39.0, 12.0, 21.0...
0
2015-05-09 23:43:59.039
2015-05-09 23:43:59.039+00
math1
23380
8719
16
2015-05-09 23:44:28.348
-52
2015-05-09 16:44:28.446
1
21
[17686.0, 34597.0, 789.0, 151.0, 488.0, 633.0,...
[104.0, 112.0, 123.0, 129.0, 125.0, 119.0, 102...
0
2015-05-09 23:44:28.564
2015-05-09 23:44:28.564+00
math1
23381
18303
27
2015-05-09 23:44:28.374
-927
2015-05-09 16:44:29.443
94
10
[361051.0, 35651.0, 8310.0, 5117.0, 7777.0, 57...
[50.0, 104.0, 155.0, 163.0, 120.0, 69.0, 41.0,...
0
2015-05-09 23:44:30.480
2015-05-09 23:44:30.48+00
math1
23382
14321
21
2015-05-09 23:44:28.733
-46
2015-05-09 16:44:28.934
20
38
[5359.0, 11957.0, 2218.0, 1422.0, 6276.0, 4521...
[43.0, 45.0, 42.0, 41.0, 50.0, 65.0, 61.0, 56....
0
2015-05-09 23:44:29.037
2015-05-09 23:44:29.037+00
math1
23383
14741
22
2015-05-09 23:44:28.753
7756
2015-05-09 19:44:21.179
57
84
[18438.0, 55297.0, 17881.0, 41933.0, 3631.0, 1...
[72.0, 60.0, 50.0, 37.0, 37.0, 51.0, 64.0, 73....
0
2015-05-09 23:44:13.548
2015-05-09 23:44:13.548+00
math1
72 rows × 13 columns
In [4]:
df.raw_values = df.raw_values.map(json.loads)
df.eeg_power = df.eeg_power.map(json.loads)
In [5]:
df.label.unique()
Out[5]:
array(['unlabeled', 'blinkInstruction', 'blink1', 'blink2', 'blink3',
'blink4', 'blink5', 'relaxInstruction', 'relax', 'mathInstruction',
'math1', 'math2', 'math3', 'math4', 'math5', 'math6', 'math7',
'math8', 'math9', 'math10', 'math11', 'math12', 'musicInstruction',
'music', 'videoInstruction', 'video-ver1',
'thinkOfItemsInstruction-ver1', 'thinkOfItems-ver1',
'colorInstruction1', 'colorInstruction2', 'readyRound1',
'colorRound1-1', 'colorRound1-2', 'colorRound1-3', 'colorRound1-4',
'colorRound1-5', 'colorRound1-6', 'readyRound2', 'colorRound2-1',
'colorRound2-2', 'colorRound2-3', 'colorRound2-4', 'colorRound2-5',
'colorRound2-6', 'readyRound3', 'colorRound3-1', 'colorRound3-2',
'colorRound3-3', 'colorRound3-4', 'colorRound3-5', 'colorRound3-6',
'readyRound4', 'colorRound4-1', 'colorRound4-2', 'colorRound4-3',
'colorRound4-4', 'colorRound4-5', 'colorRound4-6', 'readyRound5',
'colorRound5-1', 'colorRound5-2', 'colorRound5-3', 'colorRound5-4',
'colorRound5-5', 'colorRound5-6', 'video-ver2',
'thinkOfItemsInstruction-ver2', 'thinkOfItems-ver2'], dtype=object)
In [6]:
relaxed = df[df.label == 'relax']
focused = df[(df.label == 'math1') |
(df.label == 'math2') |
(df.label == 'math3') |
(df.label == 'math4') |
(df.label == 'math5') |
(df.label == 'math6') |
(df.label == 'math7') |
(df.label == 'math8') |
(df.label == 'math9') |
(df.label == 'math10') |
(df.label == 'math11') |
(df.label == 'math12')]
print(len(relaxed))
print(len(focused))
934
936
In [7]:
df_grouped = pd.concat([relaxed,focused])
len(df_grouped)
Out[7]:
1870
In [8]:
df_grouped[df_grouped['id']==24]
Out[8]:
Unnamed: 0
id
indra_time
browser_latency
reading_time
attention_esense
meditation_esense
eeg_power
raw_values
signal_quality
createdAt
updatedAt
label
22801
16566
24
2015-05-09 23:43:52.371
-1,571
2015-05-09 16:43:53.940
66
51
[128990.0, 10632.0, 4866.0, 1275.0, 2735.0, 71...
[29.0, 25.0, 55.0, 66.0, 18.0, -7.0, 24.0, 16....
0
2015-05-09 23:43:55.568
2015-05-09 23:43:55.568+00
relax
22814
16567
24
2015-05-09 23:43:53.272
-1,572
2015-05-09 16:43:54.905
77
35
[109639.0, 22225.0, 2367.0, 2229.0, 2908.0, 62...
[-30.0, 4.0, 90.0, 114.0, 60.0, 11.0, 4.0, 54....
0
2015-05-09 23:43:56.533
2015-05-09 23:43:56.533+00
relax
22828
16568
24
2015-05-09 23:43:54.170
-1,572
2015-05-09 16:43:55.914
48
47
[239978.0, 90433.0, 28660.0, 5076.0, 7314.0, 1...
[-360.0, -391.0, -422.0, -421.0, -390.0, -353....
0
2015-05-09 23:43:57.541
2015-05-09 23:43:57.541+00
relax
22844
16569
24
2015-05-09 23:43:55.073
-1,572
2015-05-09 16:43:56.898
50
50
[1542887.0, 46220.0, 13829.0, 23160.0, 10673.0...
[133.0, 107.0, 76.0, 98.0, 68.0, 69.0, 195.0, ...
0
2015-05-09 23:43:58.523
2015-05-09 23:43:58.523+00
relax
22864
16570
24
2015-05-09 23:43:56.273
-1,571
2015-05-09 16:43:57.905
64
43
[139942.0, 43078.0, 4189.0, 11875.0, 14078.0, ...
[123.0, 74.0, 40.0, 84.0, 84.0, 27.0, 28.0, 75...
0
2015-05-09 23:43:59.534
2015-05-09 23:43:59.534+00
relax
22875
16571
24
2015-05-09 23:43:57.173
-1,571
2015-05-09 16:43:58.899
61
54
[384736.0, 35298.0, 18890.0, 16778.0, 30669.0,...
[-42.0, -14.0, -17.0, -27.0, -86.0, -116.0, -1...
0
2015-05-09 23:44:00.525
2015-05-09 23:44:00.525+00
relax
22890
16572
24
2015-05-09 23:43:58.073
-1,571
2015-05-09 16:43:59.906
81
56
[108563.0, 44355.0, 19714.0, 2775.0, 6193.0, 6...
[25.0, 45.0, 32.0, 41.0, 41.0, 52.0, 64.0, 59....
0
2015-05-09 23:44:01.532
2015-05-09 23:44:01.532+00
relax
22912
16573
24
2015-05-09 23:43:59.273
-1,571
2015-05-09 16:44:00.891
81
63
[21447.0, 35430.0, 46456.0, 14270.0, 9174.0, 8...
[33.0, 69.0, 37.0, -14.0, -14.0, 39.0, 120.0, ...
0
2015-05-09 23:44:02.518
2015-05-09 23:44:02.518+00
relax
22924
16574
24
2015-05-09 23:44:00.172
-1,571
2015-05-09 16:44:01.898
87
69
[7613.0, 15930.0, 5178.0, 8712.0, 3263.0, 8210...
[5.0, 53.0, 81.0, 67.0, 50.0, 65.0, 87.0, 71.0...
0
2015-05-09 23:44:03.526
2015-05-09 23:44:03.526+00
relax
22936
16575
24
2015-05-09 23:44:01.071
-1,571
2015-05-09 16:44:02.914
93
64
[88781.0, 11124.0, 899.0, 4842.0, 3690.0, 5684...
[17.0, 27.0, 19.0, 2.0, 1.0, 16.0, 19.0, 25.0,...
0
2015-05-09 23:44:04.541
2015-05-09 23:44:04.541+00id
relax
22960
15887
24
2015-05-09 23:44:02.274
-1,570
2015-05-09 16:44:03.902
100
69
[17641.0, 9153.0, 3996.0, 15366.0, 9344.0, 127...
[90.0, 38.0, -18.0, -26.0, 4.0, 57.0, 122.0, 1...
0
2015-05-09 23:44:05.527
2015-05-09 23:44:05.527+00
relax
22973
15888
24
2015-05-09 23:44:03.174
-1,570
2015-05-09 16:44:04.877
100
54
[17941.0, 11009.0, 7222.0, 1628.0, 15526.0, 94...
[40.0, 25.0, -22.0, -40.0, 0.0, 36.0, 38.0, 22...
0
2015-05-09 23:44:06.509
2015-05-09 23:44:06.509+00
relax
22987
15889
24
2015-05-09 23:44:04.074
-1,570
2015-05-09 16:44:05.894
97
43
[348568.0, 104367.0, 3488.0, 12698.0, 3253.0, ...
[89.0, 76.0, 56.0, 67.0, 60.0, 42.0, 67.0, 84....
0
2015-05-09 23:44:07.519
2015-05-09 23:44:07.519+00
relax
23007
15890
24
2015-05-09 23:44:05.273
-1,571
2015-05-09 16:44:06.898
88
54
[56369.0, 26100.0, 18082.0, 23247.0, 14817.0, ...
[53.0, 57.0, 35.0, 25.0, 48.0, 50.0, 50.0, 45....
0
2015-05-09 23:44:08.524
2015-05-09 23:44:08.524+00
relax
23021
15891
24
2015-05-09 23:44:06.172
-1,571
2015-05-09 16:44:07.865
88
53
[15008.0, 9023.0, 13471.0, 6080.0, 16731.0, 12...
[4.0, 19.0, 34.0, 54.0, 52.0, 51.0, 56.0, 55.0...
0
2015-05-09 23:44:09.492
2015-05-09 23:44:09.492+00
relax
23033
15892
24
2015-05-09 23:44:07.073
-1,571
2015-05-09 16:44:08.866
75
60
[167622.0, 8329.0, 4518.0, 3009.0, 3211.0, 242...
[60.0, 90.0, 91.0, 74.0, 55.0, 60.0, 74.0, 65....
0
2015-05-09 23:44:10.492
2015-05-09 23:44:10.492+00
relax
23054
15893
24
2015-05-09 23:44:08.272
-1,571
2015-05-09 16:44:09.889
100
67
[8275.0, 19313.0, 6285.0, 6196.0, 4759.0, 1682...
[56.0, 52.0, 52.0, 60.0, 83.0, 88.0, 76.0, 61....
0
2015-05-09 23:44:11.517
2015-05-09 23:44:11.517+00
relax
23069
15894
24
2015-05-09 23:44:09.173
-1,571
2015-05-09 16:44:10.874
100
50
[30816.0, 31706.0, 3677.0, 2561.0, 4594.0, 118...
[9.0, 66.0, 109.0, 73.0, 43.0, 36.0, 37.0, 56....
0
2015-05-09 23:44:12.499
2015-05-09 23:44:12.499+00
relax
23084
15895
24
2015-05-09 23:44:10.072
-1,571
2015-05-09 16:44:11.886
100
48
[18394.0, 20509.0, 15741.0, 4225.0, 11895.0, 1...
[82.0, 85.0, 66.0, 38.0, 44.0, 51.0, 37.0, 20....
0
2015-05-09 23:44:13.512
2015-05-09 23:44:13.512+00
relax
23104
15896
24
2015-05-09 23:44:11.271
-1,571
2015-05-09 16:44:12.865
100
47
[7362.0, 7517.0, 3297.0, 7518.0, 8489.0, 7364....
[24.0, 43.0, 50.0, 33.0, 32.0, 38.0, 45.0, 57....
0
2015-05-09 23:44:14.492
2015-05-09 23:44:14.492+00
relax
23119
15897
24
2015-05-09 23:44:12.173
-1,571
2015-05-09 16:44:13.858
100
38
[7409.0, 18762.0, 2955.0, 2009.0, 4100.0, 1111...
[93.0, 68.0, 36.0, 34.0, 58.0, 96.0, 104.0, 10...
0
2015-05-09 23:44:15.484
2015-05-09 23:44:15.484+00
relax
23135
15898
24
2015-05-09 23:44:13.073
-1,571
2015-05-09 16:44:14.855
100
53
[5429.0, 9221.0, 15216.0, 7889.0, 20284.0, 831...
[25.0, 12.0, -8.0, -17.0, -28.0, -44.0, -61.0,...
0
2015-05-09 23:44:16.480
2015-05-09 23:44:16.48+00
relax
23153
15899
24
2015-05-09 23:44:14.273
-1,571
2015-05-09 16:44:15.858
100
53
[6991.0, 11155.0, 3990.0, 9619.0, 10667.0, 970...
[70.0, 55.0, 56.0, 74.0, 87.0, 88.0, 90.0, 74....
0
2015-05-09 23:44:17.484
2015-05-09 23:44:17.484+00
relax
23166
15900
24
2015-05-09 23:44:15.172
-1,571
2015-05-09 16:44:16.843
100
56
[6086.0, 7372.0, 4350.0, 6564.0, 1427.0, 5802....
[41.0, 42.0, 41.0, 52.0, 59.0, 67.0, 58.0, 27....
0
2015-05-09 23:44:18.469
2015-05-09 23:44:18.469+00
relax
23181
15901
24
2015-05-09 23:44:16.072
-1,571
2015-05-09 16:44:17.867
100
67
[2597.0, 18313.0, 8491.0, 5034.0, 3583.0, 7766...
[59.0, 65.0, 71.0, 72.0, 70.0, 45.0, 4.0, -2.0...
0
2015-05-09 23:44:19.493
2015-05-09 23:44:19.493+00
relax
23200
15902
24
2015-05-09 23:44:17.272
-1,571
2015-05-09 16:44:18.849
100
78
[13560.0, 11687.0, 1695.0, 33900.0, 7618.0, 44...
[-5.0, 3.0, 11.0, 11.0, 9.0, 13.0, 48.0, 53.0,...
0
2015-05-09 23:44:20.475
2015-05-09 23:44:20.475+00
relax
23215
15903
24
2015-05-09 23:44:18.172
-1,571
2015-05-09 16:44:19.852
100
78
[5503.0, 8043.0, 787.0, 8371.0, 3731.0, 10061....
[38.0, 12.0, 26.0, 59.0, 52.0, 28.0, 27.0, 37....
0
2015-05-09 23:44:21.485
2015-05-09 23:44:21.485+00
relax
23231
15904
24
2015-05-09 23:44:19.072
-1,571
2015-05-09 16:44:20.863
100
67
[32997.0, 19481.0, 3873.0, 4072.0, 4000.0, 835...
[73.0, 84.0, 105.0, 124.0, 124.0, 102.0, 92.0,...
0
2015-05-09 23:44:22.490
2015-05-09 23:44:22.49+00
relax
23249
15905
24
2015-05-09 23:44:20.269
-1,572
2015-05-09 16:44:21.840
97
77
[20410.0, 32394.0, 18716.0, 46295.0, 7875.0, 1...
[23.0, 27.0, 28.0, 28.0, 26.0, 28.0, 41.0, 33....
0
2015-05-09 23:44:23.467
2015-05-09 23:44:23.467+00
relax
23265
15906
24
2015-05-09 23:44:21.171
-1,572
2015-05-09 16:44:22.830
100
70
[19774.0, 12690.0, 6436.0, 16572.0, 6092.0, 71...
[40.0, 50.0, 57.0, 69.0, 60.0, 37.0, 32.0, 32....
0
2015-05-09 23:44:24.455
2015-05-09 23:44:24.455+00
relax
23360
15912
24
2015-05-09 23:44:27.172
-1,570
2015-05-09 16:44:28.814
57
44
[61005.0, 107502.0, 2903.0, 8912.0, 14029.0, 1...
[-210.0, -29.0, 20.0, -49.0, -166.0, -290.0, -...
0
2015-05-09 23:44:30.441
2015-05-09 23:44:30.441+00
math1
23373
15913
24
2015-05-09 23:44:28.073
-1,570
2015-05-09 16:44:29.825
57
43
[737460.0, 192229.0, 18332.0, 23809.0, 17179.0...
[135.0, 97.0, 52.0, 73.0, 74.0, 41.0, 72.0, 88...
0
2015-05-09 23:44:31.453
2015-05-09 23:44:31.453+00
math1
23388
15914
24
2015-05-09 23:44:28.971
-1,571
2015-05-09 16:44:30.806
54
44
[229465.0, 68060.0, 30899.0, 60300.0, 20505.0,...
[693.0, 640.0, 529.0, 420.0, 360.0, 329.0, 279...
0
2015-05-09 23:44:32.432
2015-05-09 23:44:32.432+00
math2
23407
15915
24
2015-05-09 23:44:30.171
-1,571
2015-05-09 16:44:31.826
41
37
[280099.0, 247861.0, 32425.0, 21326.0, 5166.0,...
[21.0, 43.0, 8.0, 20.0, -150.0, -284.0, 4.0, 3...
0
2015-05-09 23:44:33.453
2015-05-09 23:44:33.453+00
math2
23424
15916
24
2015-05-09 23:44:31.071
-1,571
2015-05-09 16:44:32.813
21
35
[2034739.0, 1113592.0, 49955.0, 22181.0, 16525...
[-18.0, 74.0, 165.0, 180.0, 155.0, 144.0, 131....
0
2015-05-09 23:44:34.439
2015-05-09 23:44:34.439+00
math2
23439
15917
24
2015-05-09 23:44:31.971
-1,572
2015-05-09 16:44:33.815
23
43
[2113864.0, 431079.0, 217636.0, 33111.0, 56240...
[-69.0, -26.0, 104.0, 208.0, 229.0, 109.0, -20...
0
2015-05-09 23:44:35.442
2015-05-09 23:44:35.442+00
math3
23459
15918
24
2015-05-09 23:44:33.168
-1,572
2015-05-09 16:44:34.817
13
38
[826980.0, 67461.0, 8683.0, 35699.0, 8919.0, 3...
[82.0, 172.0, 259.0, 104.0, -49.0, 8.0, 155.0,...
0
2015-05-09 23:44:36.444
2015-05-09 23:44:36.444+00
math3
23471
15919
24
2015-05-09 23:44:34.069
-1,572
2015-05-09 16:44:35.805
23
41
[1408778.0, 143589.0, 38677.0, 10215.0, 11899....
[-44.0, 2.0, 55.0, 98.0, 55.0, -54.0, -75.0, -...
0
2015-05-09 23:44:37.432
2015-05-09 23:44:37.432+00
math4
23487
15920
24
2015-05-09 23:44:34.971
-1,572
2015-05-09 16:44:36.811
29
53
[184247.0, 41558.0, 2773.0, 7438.0, 2766.0, 16...
[3.0, 76.0, 161.0, 182.0, 106.0, 28.0, 69.0, 1...
0
2015-05-09 23:44:38.442
2015-05-09 23:44:38.442+00
math4
23508
15921
24
2015-05-09 23:44:36.171
-1,572
2015-05-09 16:44:37.805
37
50
[1125277.0, 102510.0, 13189.0, 38344.0, 8150.0...
[48.0, 12.0, 36.0, 168.0, 342.0, 346.0, 203.0,...
0
2015-05-09 23:44:39.430
2015-05-09 23:44:39.43+00
math4
23520
15922
24
2015-05-09 23:44:37.070
-1,572
2015-05-09 16:44:38.797
37
50
[409542.0, 58224.0, 29197.0, 12524.0, 16050.0,...
[76.0, 68.0, 20.0, 21.0, 52.0, 58.0, 40.0, 16....
0
2015-05-09 23:44:40.425
2015-05-09 23:44:40.425+00
math5
23533
15923
24
2015-05-09 23:44:37.968
-1,573
2015-05-09 16:44:39.799
47
50
[823244.0, 505603.0, 85175.0, 94321.0, 118657....
[-206.0, 33.0, 74.0, 28.0, 172.0, 114.0, -162....
0
2015-05-09 23:44:41.426
2015-05-09 23:44:41.426+00
math5
23556
15924
24
2015-05-09 23:44:39.168
-1,573
2015-05-09 16:44:40.803
54
43
[81787.0, 44728.0, 2973.0, 2600.0, 1946.0, 384...
[-41.0, -41.0, 21.0, 96.0, 65.0, -3.0, 9.0, 54...
0
2015-05-09 23:44:42.475
2015-05-09 23:44:42.475+00
math6
23568
15925
24
2015-05-09 23:44:40.067
-1,573
2015-05-09 16:44:41.779
47
47
[399574.0, 196427.0, 68107.0, 47463.0, 5983.0,...
[20.0, 33.0, 52.0, 25.0, 9.0, 60.0, 92.0, 35.0...
0
2015-05-09 23:44:43.407
2015-05-09 23:44:43.407+00
math6
23580
15926
24
2015-05-09 23:44:40.979
-1,562
2015-05-09 16:44:42.796
66
44
[264439.0, 18964.0, 9903.0, 11383.0, 19027.0, ...
[152.0, 119.0, -73.0, -90.0, -12.0, 16.0, -18....
0
2015-05-09 23:44:44.425
2015-05-09 23:44:44.425+00
math6
23603
15927
24
2015-05-09 23:44:42.179
-1,562
2015-05-09 16:44:43.785
48
35
[310666.0, 159571.0, 11059.0, 4485.0, 7366.0, ...
[98.0, 36.0, -4.0, 4.0, 7.0, 42.0, 156.0, 200....
0
2015-05-09 23:44:45.415
2015-05-09 23:44:45.415+00
math7
23617
15928
24
2015-05-09 23:44:43.079
-1,562
2015-05-09 16:44:44.773
47
37
[726389.0, 151182.0, 16493.0, 2977.0, 4367.0, ...
[-99.0, -20.0, 61.0, 33.0, -50.0, -69.0, 0.0, ...
0
2015-05-09 23:44:46.400
2015-05-09 23:44:46.4+00
math7
23629
15929
24
2015-05-09 23:44:43.971
-1,571
2015-05-09 16:44:45.772
70
40
[4477.0, 7961.0, 22565.0, 6656.0, 9478.0, 2090...
[162.0, 113.0, 34.0, -9.0, 20.0, 13.0, -17.0, ...
0
2015-05-09 23:44:47.400
2015-05-09 23:44:47.4+00
math8
23651
15930
24
2015-05-09 23:44:45.171
-1,571
2015-05-09 16:44:46.789
61
37
[92687.0, 191257.0, 35431.0, 37686.0, 15875.0,...
[90.0, 65.0, 89.0, 41.0, -21.0, -8.0, -19.0, -...
0
2015-05-09 23:44:48.419
2015-05-09 23:44:48.419+00
math8
23665
15931
24
2015-05-09 23:44:46.071
-1,571
2015-05-09 16:44:47.764
88
50
[428567.0, 49294.0, 28324.0, 2592.0, 11523.0, ...
[88.0, 135.0, 74.0, 24.0, 54.0, 56.0, 43.0, 45...
0
2015-05-09 23:44:49.392
2015-05-09 23:44:49.392+00
math8
23678
15932
24
2015-05-09 23:44:46.968
-1,573
2015-05-09 16:44:48.770
96
53
[543001.0, 179467.0, 24984.0, 11285.0, 12763.0...
[26.0, 82.0, 124.0, 129.0, 86.0, 99.0, 140.0, ...
0
2015-05-09 23:44:50.398
2015-05-09 23:44:50.398+00
math9
23700
15933
24
2015-05-09 23:44:48.167
-1,573
2015-05-09 16:44:49.796
64
37
[1790735.0, 705365.0, 66222.0, 36059.0, 48343....
[35.0, -24.0, 2.0, 155.0, 192.0, 7.0, -161.0, ...
0
2015-05-09 23:44:51.426
2015-05-09 23:44:51.426+00
math9
23714
15934
24
2015-05-09 23:44:49.068
-1,573
2015-05-09 16:44:50.753
66
35
[1735139.0, 21651.0, 451.0, 7016.0, 1855.0, 26...
[-216.0, -281.0, -279.0, -233.0, -268.0, -294....
0
2015-05-09 23:44:52.384
2015-05-09 23:44:52.384+00
math10
23725
15935
24
2015-05-09 23:44:49.972
-1,571
2015-05-09 16:44:51.758
53
16
[1021345.0, 348521.0, 9838.0, 14193.0, 35935.0...
[48.0, 72.0, 102.0, 72.0, 24.0, -5.0, 0.0, 22....
0
2015-05-09 23:44:53.387
2015-05-09 23:44:53.387+00
math10
23749
15936
24
2015-05-09 23:44:51.170
-1,571
2015-05-09 16:44:52.778
53
35
[410614.0, 19552.0, 25209.0, 15697.0, 11749.0,...
[-29.0, 41.0, 20.0, -35.0, 26.0, 139.0, 98.0, ...
0
2015-05-09 23:44:54.410
2015-05-09 23:44:54.41+00
math10
23764
15937
24
2015-05-09 23:44:52.069
-1,571
2015-05-09 16:44:53.755
54
41
[128100.0, 19432.0, 4397.0, 2228.0, 1459.0, 66...
[90.0, 73.0, 119.0, 189.0, 86.0, -57.0, -94.0,...
0
2015-05-09 23:44:55.384
2015-05-09 23:44:55.384+00
math11
23777
15938
24
2015-05-09 23:44:52.970
-1,572
2015-05-09 16:44:54.767
51
38
[1455795.0, 379838.0, 72846.0, 14890.0, 46967....
[108.0, 120.0, 108.0, 115.0, 98.0, 61.0, 25.0,...
0
2015-05-09 23:44:56.395
2015-05-09 23:44:56.395+00
math11
23799
15939
24
2015-05-09 23:44:54.170
-1,572
2015-05-09 16:44:55.770
44
48
[1672904.0, 1330941.0, 99719.0, 114692.0, 2583...
[-57.0, -6.0, 23.0, 53.0, 56.0, 40.0, 5.0, -23...
0
2015-05-09 23:44:57.401
2015-05-09 23:44:57.401+00
math12
23813
15940
24
2015-05-09 23:44:55.068
-1,572
2015-05-09 16:44:56.740
38
44
[102367.0, 47288.0, 42012.0, 3256.0, 3681.0, 6...
[64.0, 70.0, 131.0, 164.0, 128.0, 34.0, 21.0, ...
0
2015-05-09 23:44:58.368
2015-05-09 23:44:58.368+00
math12
23828
15941
24
2015-05-09 23:44:55.969
-1,572
2015-05-09 16:44:57.759
40
50
[2159489.0, 136563.0, 55872.0, 9777.0, 11819.0...
[35.0, -28.0, 2.0, -3.0, -21.0, -12.0, 56.0, 5...
0
2015-05-09 23:44:59.426
2015-05-09 23:44:59.426+00
math12
In [9]:
df_clean = df_grouped[['id','eeg_power', 'raw_values', 'label']]
In [10]:
df_clean.loc[:,'label'][df_clean.label != 'relax'] = 'focus'
/Users/kitfarfan/anaconda/lib/python3.6/site-packages/ipykernel/__main__.py:1: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame
See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
if __name__ == '__main__':
/Users/kitfarfan/anaconda/lib/python3.6/site-packages/pandas/core/generic.py:4702: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame
See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
self._update_inplace(new_data)
/Users/kitfarfan/anaconda/lib/python3.6/site-packages/IPython/core/interactiveshell.py:2881: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame
See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
exec(code_obj, self.user_global_ns, self.user_ns)
In [11]:
df_clean
Out[11]:
id
eeg_power
raw_values
label
13274
7
[5044.0, 10156.0, 3281.0, 10403.0, 12393.0, 10...
[285.0, 241.0, 200.0, 161.0, 129.0, 90.0, 33.0...
relax
13275
11
[548188.0, 67192.0, 20298.0, 4142.0, 30576.0, ...
[-12.0, -60.0, -70.0, -74.0, -129.0, -183.0, -...
relax
13276
5
[449571.0, 83093.0, 15379.0, 34656.0, 6750.0, ...
[37.0, 43.0, 42.0, 25.0, 12.0, 25.0, 42.0, 48....
relax
13277
1
[85497.0, 20547.0, 2723.0, 3270.0, 2522.0, 220...
[17.0, 19.0, 23.0, 25.0, 27.0, 38.0, 51.0, 52....
relax
13278
13
[72768.0, 44080.0, 25974.0, 16079.0, 12995.0, ...
[99.0, 69.0, 9.0, -4.0, 16.0, 16.0, 17.0, 27.0...
relax
13279
14
[10171.0, 13086.0, 13814.0, 9290.0, 9794.0, 82...
[39.0, 26.0, 18.0, 25.0, 40.0, 49.0, 58.0, 49....
relax
13280
4
[486066.0, 154967.0, 11921.0, 16636.0, 13902.0...
[-3.0, -59.0, -28.0, 53.0, 105.0, 105.0, 98.0,...
relax
13281
6
[769537.0, 132633.0, 8882.0, 104962.0, 31441.0...
[2.0, -4.0, -9.0, -30.0, -58.0, -52.0, -12.0, ...
relax
13282
2
[67919.0, 13799.0, 27658.0, 18156.0, 19295.0, ...
[-59.0, -56.0, -58.0, -59.0, -54.0, -40.0, -26...
relax
13283
12
[1413027.0, 38537.0, 45687.0, 17712.0, 55097.0...
[66.0, 67.0, 67.0, 60.0, 66.0, 80.0, 89.0, 81....
relax
13284
10
[44561.0, 21042.0, 15023.0, 15768.0, 4615.0, 1...
[7.0, 17.0, 11.0, -7.0, -29.0, -21.0, 2.0, -14...
relax
13285
8
[1158761.0, 122862.0, 31168.0, 68083.0, 46057....
[448.0, 362.0, 278.0, 218.0, 171.0, 144.0, 140...
relax
13286
11
[533939.0, 129744.0, 5669.0, 16895.0, 12562.0,...
[-17.0, -9.0, -17.0, -6.0, 17.0, 39.0, 36.0, 3...
relax
13287
7
[362618.0, 6879.0, 3139.0, 7392.0, 1850.0, 226...
[28.0, 43.0, 39.0, 27.0, 24.0, 28.0, 42.0, 50....
relax
13288
9
[57823.0, 17587.0, 8450.0, 4158.0, 66483.0, 50...
[100.0, 77.0, 16.0, -38.0, -21.0, 0.0, -14.0, ...
relax
13289
15
[114842.0, 5492.0, 3220.0, 7979.0, 2550.0, 210...
[-20.0, -45.0, -37.0, -17.0, -27.0, -43.0, -26...
relax
13290
5
[256676.0, 13131.0, 5119.0, 4668.0, 3976.0, 29...
[64.0, 82.0, 83.0, 67.0, 57.0, 40.0, 4.0, -3.0...
relax
13291
1
[50036.0, 57439.0, 17659.0, 5816.0, 10021.0, 2...
[44.0, 45.0, 45.0, 51.0, 48.0, 45.0, 48.0, 42....
relax
13292
13
[524036.0, 651629.0, 78142.0, 53173.0, 16967.0...
[3.0, -19.0, -29.0, -19.0, 2.0, 0.0, -1.0, -18...
relax
13293
14
[36049.0, 45837.0, 9354.0, 4810.0, 2697.0, 503...
[-35.0, -40.0, -41.0, -18.0, 2.0, 13.0, 4.0, -...
relax
13294
3
[70518.0, 61188.0, 4704.0, 5631.0, 1817.0, 409...
[93.0, 93.0, 89.0, 89.0, 99.0, 101.0, 104.0, 1...
relax
13295
4
[2108037.0, 260431.0, 32049.0, 73947.0, 23506....
[-169.0, -168.0, -199.0, -202.0, -220.0, -283....
relax
13296
2
[44417.0, 46917.0, 11425.0, 2721.0, 15792.0, 4...
[97.0, 101.0, 118.0, 123.0, 100.0, 77.0, 73.0,...
relax
13297
12
[124076.0, 156117.0, 10525.0, 36482.0, 12262.0...
[8.0, 21.0, 24.0, 22.0, 23.0, 10.0, -11.0, -17...
relax
13298
8
[389639.0, 48498.0, 13741.0, 10362.0, 12736.0,...
[203.0, 204.0, 203.0, 177.0, 99.0, -29.0, -212...
relax
13299
6
[1937138.0, 315179.0, 127414.0, 23402.0, 15885...
[128.0, 116.0, 97.0, 96.0, 106.0, 115.0, 112.0...
relax
13300
11
[370551.0, 22017.0, 13429.0, 12547.0, 16785.0,...
[2.0, -24.0, -8.0, 17.0, -12.0, -45.0, -38.0, ...
relax
13301
9
[2066857.0, 591154.0, 276277.0, 123774.0, 2447...
[22.0, 12.0, 34.0, 87.0, 96.0, 39.0, -36.0, -7...
relax
13302
10
[28542.0, 35924.0, 4893.0, 12270.0, 2864.0, 17...
[37.0, 38.0, 36.0, 24.0, 20.0, 24.0, 27.0, 50....
relax
13303
15
[88317.0, 110556.0, 21737.0, 16414.0, 16647.0,...
[76.0, 129.0, 119.0, 52.0, -1.0, -3.0, 8.0, 22...
relax
...
...
...
...
...
23803
21
[5030.0, 16243.0, 5452.0, 5791.0, 6344.0, 3676...
[40.0, 27.0, 20.0, 12.0, 18.0, 24.0, 16.0, 3.0...
focus
23804
19
[76974.0, 41981.0, 23746.0, 5869.0, 8155.0, 38...
[53.0, 57.0, 65.0, 60.0, 45.0, 33.0, 20.0, 11....
focus
23805
18
[92799.0, 30460.0, 13784.0, 9121.0, 3902.0, 45...
[42.0, 39.0, 35.0, 34.0, 24.0, 3.0, -17.0, -39...
focus
23806
28
[107461.0, 28039.0, 3184.0, 826.0, 4778.0, 597...
[35.0, -4.0, -29.0, -34.0, -29.0, -38.0, -55.0...
focus
23807
20
[82318.0, 47196.0, 6056.0, 2574.0, 3760.0, 576...
[37.0, 42.0, 50.0, 57.0, 71.0, 73.0, 57.0, 43....
focus
23808
23
[5809.0, 30638.0, 2488.0, 17650.0, 3804.0, 585...
[76.0, 65.0, 45.0, 40.0, 58.0, 88.0, 85.0, 65....
focus
23809
16
[14314.0, 8892.0, 2854.0, 8803.0, 11757.0, 600...
[26.0, 43.0, 44.0, 32.0, 23.0, 32.0, 39.0, 51....
focus
23810
29
[10433.0, 2603.0, 9457.0, 22715.0, 8241.0, 701...
[49.0, 39.0, 35.0, 42.0, 49.0, 44.0, 38.0, 26....
focus
23811
29
[10433.0, 2603.0, 9457.0, 22715.0, 8241.0, 701...
[49.0, 39.0, 35.0, 42.0, 49.0, 44.0, 38.0, 26....
focus
23812
30
[231354.0, 9326.0, 2000.0, 3383.0, 3322.0, 642...
[50.0, 64.0, 87.0, 87.0, 64.0, 43.0, 45.0, 45....
focus
23813
24
[102367.0, 47288.0, 42012.0, 3256.0, 3681.0, 6...
[64.0, 70.0, 131.0, 164.0, 128.0, 34.0, 21.0, ...
focus
23814
25
[81708.0, 28490.0, 2684.0, 3564.0, 1764.0, 845...
[70.0, 70.0, 81.0, 98.0, 100.0, 93.0, 86.0, 87...
focus
23815
26
[154962.0, 7700.0, 7096.0, 8938.0, 17960.0, 12...
[56.0, 71.0, 71.0, 58.0, 42.0, 33.0, 38.0, 43....
focus
23816
27
[3530.0, 6675.0, 7446.0, 3403.0, 4497.0, 68995...
[89.0, 91.0, 55.0, -11.0, -41.0, -2.0, 43.0, 6...
focus
23817
17
[19831.0, 11994.0, 5268.0, 16162.0, 8029.0, 11...
[67.0, 75.0, 69.0, 66.0, 58.0, 58.0, 73.0, 80....
focus
23818
19
[502432.0, 77504.0, 8333.0, 42785.0, 13435.0, ...
[118.0, 105.0, 92.0, 92.0, 96.0, 84.0, 74.0, 7...
focus
23819
28
[91699.0, 18205.0, 6578.0, 3539.0, 2962.0, 563...
[-10.0, -24.0, -19.0, -33.0, -67.0, -75.0, -49...
focus
23820
22
[1278018.0, 141089.0, 50563.0, 91967.0, 16940....
[107.0, 150.0, 195.0, 181.0, 120.0, 102.0, 100...
focus
23821
21
[44078.0, 34738.0, 2600.0, 4490.0, 865.0, 2089...
[-18.0, -8.0, -8.0, -10.0, -21.0, -23.0, -17.0...
focus
23822
20
[5819.0, 14858.0, 4745.0, 2515.0, 4346.0, 5132...
[37.0, 50.0, 61.0, 67.0, 68.0, 59.0, 44.0, 36....
focus
23823
23
[128770.0, 28939.0, 3234.0, 6921.0, 2549.0, 49...
[-27.0, -29.0, -35.0, -39.0, -39.0, -28.0, -10...
focus
23824
18
[475078.0, 11709.0, 4597.0, 3541.0, 3291.0, 58...
[-138.0, -126.0, -120.0, -108.0, -83.0, -53.0,...
focus
23825
29
[2219.0, 21780.0, 5045.0, 10613.0, 4743.0, 298...
[19.0, 19.0, 32.0, 43.0, 44.0, 45.0, 66.0, 76....
focus
23826
29
[2219.0, 21780.0, 5045.0, 10613.0, 4743.0, 298...
[19.0, 19.0, 32.0, 43.0, 44.0, 45.0, 66.0, 76....
focus
23827
30
[11425.0, 17573.0, 3405.0, 2698.0, 16331.0, 94...
[83.0, 80.0, 72.0, 70.0, 81.0, 70.0, 54.0, 54....
focus
23828
24
[2159489.0, 136563.0, 55872.0, 9777.0, 11819.0...
[35.0, -28.0, 2.0, -3.0, -21.0, -12.0, 56.0, 5...
focus
23829
25
[29164.0, 13290.0, 11052.0, 6885.0, 3829.0, 48...
[28.0, 1.0, 5.0, 38.0, 60.0, 60.0, 55.0, 57.0,...
focus
23830
16
[35542.0, 32228.0, 1920.0, 2826.0, 3165.0, 162...
[106.0, 108.0, 91.0, 81.0, 72.0, 68.0, 67.0, 6...
focus
23831
27
[577033.0, 21286.0, 11050.0, 6076.0, 10917.0, ...
[48.0, 37.0, 18.0, -3.0, -14.0, -14.0, 22.0, 7...
focus
23832
26
[17292.0, 35218.0, 6800.0, 15515.0, 8642.0, 10...
[96.0, 75.0, 64.0, 64.0, 75.0, 84.0, 82.0, 76....
focus
1870 rows × 4 columns
In [12]:
df_one_subject = df_clean[df_clean['id']==1]
In [13]:
len(df_one_subject)
Out[13]:
60
In [14]:
X = df_one_subject.drop(['label','raw_values'],1)
y = df_one_subject['label']
In [15]:
len(X)
Out[15]:
60
Split each power reading into it's own column
In [16]:
eegpower_series = pd.Series(X['eeg_power'])
eeg_cols=pd.DataFrame(eegpower_series.tolist())
eeg_cols['id'] = X['id'].values
In [17]:
eeg_cols = eeg_cols.drop('id',1)
In [18]:
from sklearn.model_selection import train_test_split
X_train, X_test, y_train, y_test = train_test_split(eeg_cols,y,test_size=0.1)
In [19]:
X_train
Out[19]:
0
1
2
3
4
5
6
7
16
179968.0
17539.0
16643.0
31706.0
13303.0
6961.0
3359.0
2656.0
3
160552.0
44796.0
13555.0
21970.0
12998.0
4266.0
2635.0
1820.0
38
17637.0
8693.0
66763.0
146565.0
24592.0
6576.0
2300.0
2203.0
40
13230.0
8127.0
11132.0
122631.0
11565.0
4495.0
2669.0
641.0
41
3696.0
36922.0
27992.0
222616.0
16098.0
30599.0
2910.0
1014.0
26
21452.0
37577.0
26425.0
4587.0
18445.0
9730.0
1633.0
1410.0
23
190851.0
46447.0
7622.0
9326.0
11090.0
20169.0
3870.0
1336.0
21
396835.0
313031.0
12196.0
13806.0
6779.0
9723.0
2633.0
1156.0
2
155790.0
43496.0
14414.0
8105.0
8255.0
7485.0
2610.0
4343.0
13
634547.0
16889.0
3938.0
4585.0
3886.0
2120.0
1839.0
963.0
49
17688.0
20602.0
26737.0
80210.0
30690.0
7936.0
1684.0
1318.0
25
61867.0
50113.0
15249.0
23042.0
6096.0
15258.0
2528.0
908.0
34
11888.0
14622.0
7172.0
12690.0
10048.0
7316.0
2437.0
2741.0
33
4641.0
22297.0
12585.0
35891.0
3410.0
4374.0
2610.0
1504.0
5
654856.0
15593.0
29536.0
2195.0
9782.0
4251.0
3421.0
2631.0
55
11051.0
46277.0
129555.0
102689.0
5928.0
10895.0
5809.0
1634.0
20
500234.0
42568.0
12181.0
16434.0
16543.0
12541.0
2636.0
3930.0
24
808539.0
99887.0
6214.0
4678.0
13998.0
6691.0
1437.0
1956.0
39
13641.0
53578.0
23605.0
161039.0
29399.0
6569.0
3235.0
1564.0
10
1465193.0
110079.0
49257.0
58421.0
41243.0
16919.0
7661.0
9773.0
51
2890.0
10281.0
43907.0
64111.0
11092.0
6288.0
2173.0
825.0
27
174582.0
63327.0
14815.0
25082.0
14216.0
3306.0
1992.0
1136.0
56
33374.0
11831.0
3696.0
18759.0
8544.0
5122.0
4078.0
3548.0
22
226473.0
14523.0
1295.0
1744.0
3581.0
2690.0
523.0
576.0
30
6650.0
22871.0
45854.0
191253.0
15457.0
7563.0
3962.0
2285.0
35
15482.0
11558.0
32119.0
37042.0
25933.0
8644.0
1410.0
860.0
45
14033.0
36042.0
12625.0
47540.0
18539.0
12509.0
2390.0
1106.0
58
114362.0
16018.0
25348.0
38073.0
7682.0
6785.0
2074.0
936.0
59
22817.0
30823.0
1176.0
1976.0
1952.0
2064.0
500.0
371.0
36
7107.0
6816.0
1864.0
112342.0
10055.0
2803.0
2623.0
1126.0
29
265376.0
21289.0
6300.0
3168.0
1250.0
1834.0
3478.0
1605.0
54
6843.0
5721.0
17771.0
96605.0
27594.0
15218.0
1523.0
997.0
44
11462.0
27788.0
61575.0
119062.0
30606.0
12093.0
2294.0
1901.0
32
22435.0
22581.0
7030.0
22607.0
19750.0
8554.0
4882.0
3404.0
28
132429.0
24231.0
3596.0
6952.0
2979.0
2487.0
1446.0
1649.0
14
114939.0
144172.0
118364.0
20580.0
22534.0
9144.0
3439.0
3032.0
18
604844.0
45607.0
12693.0
4812.0
10111.0
5187.0
1286.0
756.0
42
50288.0
40566.0
38773.0
83377.0
44965.0
26306.0
1104.0
4133.0
53
143208.0
49443.0
30992.0
72803.0
26976.0
11386.0
3425.0
3422.0
46
7243.0
12484.0
47874.0
57394.0
46335.0
30032.0
1706.0
1913.0
12
118547.0
29438.0
2045.0
3430.0
1752.0
927.0
959.0
918.0
6
55626.0
8455.0
2310.0
17392.0
7531.0
8307.0
3635.0
1812.0
19
545004.0
48019.0
5844.0
5804.0
4166.0
3328.0
456.0
626.0
7
7146.0
51617.0
19665.0
9369.0
6162.0
7144.0
1961.0
1853.0
1
50036.0
57439.0
17659.0
5816.0
10021.0
2917.0
1030.0
1264.0
9
223971.0
105078.0
1440.0
21766.0
51282.0
10086.0
11648.0
4001.0
57
263169.0
31802.0
7123.0
7273.0
6518.0
3476.0
1490.0
3103.0
0
85497.0
20547.0
2723.0
3270.0
2522.0
2209.0
449.0
393.0
52
3530.0
7091.0
19734.0
80265.0
10657.0
12959.0
3318.0
1259.0
43
11510.0
12157.0
79163.0
188047.0
43863.0
5092.0
2374.0
2038.0
17
224428.0
74399.0
33591.0
8670.0
17483.0
2447.0
3131.0
932.0
8
34044.0
19587.0
3982.0
7801.0
6282.0
3979.0
4541.0
1298.0
48
18517.0
30522.0
13822.0
102068.0
21927.0
12384.0
2236.0
1417.0
47
34056.0
24142.0
61051.0
119314.0
12628.0
14679.0
1345.0
2666.0
In [20]:
from sklearn.model_selection import cross_val_score
from sklearn import svm
def cross_val_svm (X,y,n,kern='rbf'):
clf = svm.SVC(kernel=kern)
scores = cross_val_score(clf, X, y, cv=n)
return scores
In [21]:
cross_val_svm(X_train,y_train,4)
Out[21]:
array([ 0.5, 0.5, 0.5, 0.5])
In [22]:
from scipy import stats
from scipy.interpolate import interp1d
import itertools
def spectrum (vector):
#get power spectrum from array of raw EEG reading
fourier = np.fft.fft(vector)
pow_spec = np.abs(fourier)**2
pow_spec = pow_spec[:len(pow_spec)//2] #look this up j.i.c.
return pow_spec
In [23]:
def binned (pspectra, n):
#compress an array of power spectra into vectors of length n'''
l = len(pspectra)
array = np.zeros([l,n])
for i,ps in enumerate(pspectra):
x = np.arange(1,len(ps)+1)
f = interp1d(x,ps)#/np.sum(ps))
array[i] = f(np.arange(1, n+1))
index = np.argwhere(array[:,0]==-1)
array = np.delete(array,index,0)
return array
def feature_vector (readings, bins=100): # A function we apply to each group of power spectr
bins = binned(list(map(spectrum, readings)), bins)
return np.log10(np.mean(bins, 0))
def grouper(n, iterable, fillvalue=None):
#"grouper(3, 'ABCDEFG', 'x') --> ABC DEF Gxx"
args = [iter(iterable)] * n
return itertools.zip_longest(*args, fillvalue=fillvalue)
def vectors (df):
return [feature_vector(group) for group in list(grouper(3, df.raw_values.tolist()))[:-1]]
In [24]:
raw_reads = df_one_subject.raw_values[:3]
raw_reads
Out[24]:
13277 [17.0, 19.0, 23.0, 25.0, 27.0, 38.0, 51.0, 52....
13291 [44.0, 45.0, 45.0, 51.0, 48.0, 45.0, 48.0, 42....
13305 [-30.0, -33.0, -27.0, -29.0, -33.0, -33.0, -38...
Name: raw_values, dtype: object
In [25]:
df_one_subject
Out[25]:
id
eeg_power
raw_values
label
13277
1
[85497.0, 20547.0, 2723.0, 3270.0, 2522.0, 220...
[17.0, 19.0, 23.0, 25.0, 27.0, 38.0, 51.0, 52....
relax
13291
1
[50036.0, 57439.0, 17659.0, 5816.0, 10021.0, 2...
[44.0, 45.0, 45.0, 51.0, 48.0, 45.0, 48.0, 42....
relax
13305
1
[155790.0, 43496.0, 14414.0, 8105.0, 8255.0, 7...
[-30.0, -33.0, -27.0, -29.0, -33.0, -33.0, -38...
relax
13323
1
[160552.0, 44796.0, 13555.0, 21970.0, 12998.0,...
[57.0, 40.0, 3.0, -10.0, 16.0, 42.0, 65.0, 77....
relax
13338
1
[18471.0, 31938.0, 35127.0, 14536.0, 8849.0, 4...
[-1.0, 12.0, 19.0, 16.0, 5.0, 9.0, 32.0, 45.0,...
relax
13351
1
[654856.0, 15593.0, 29536.0, 2195.0, 9782.0, 4...
[29.0, 24.0, 20.0, 17.0, 12.0, 18.0, 28.0, 44....
relax
13368
1
[55626.0, 8455.0, 2310.0, 17392.0, 7531.0, 830...
[70.0, 102.0, 81.0, 45.0, 35.0, 40.0, 40.0, 37...
relax
13382
1
[7146.0, 51617.0, 19665.0, 9369.0, 6162.0, 714...
[7.0, 39.0, 49.0, 23.0, -2.0, -7.0, 16.0, 17.0...
relax
13396
1
[34044.0, 19587.0, 3982.0, 7801.0, 6282.0, 397...
[26.0, 44.0, 60.0, 75.0, 97.0, 102.0, 89.0, 73...
relax
13411
1
[223971.0, 105078.0, 1440.0, 21766.0, 51282.0,...
[121.0, 140.0, 128.0, 96.0, 102.0, 124.0, 120....
relax
13427
1
[1465193.0, 110079.0, 49257.0, 58421.0, 41243....
[241.0, 157.0, 118.0, 120.0, 114.0, 88.0, 57.0...
relax
13442
1
[192748.0, 153987.0, 18137.0, 17325.0, 7891.0,...
[481.0, 506.0, 505.0, 438.0, 374.0, 378.0, 408...
relax
13454
1
[118547.0, 29438.0, 2045.0, 3430.0, 1752.0, 92...
[35.0, 20.0, 26.0, 40.0, 50.0, 71.0, 52.0, 13....
relax
13470
1
[634547.0, 16889.0, 3938.0, 4585.0, 3886.0, 21...
[85.0, 88.0, 75.0, 56.0, 38.0, 35.0, 22.0, 13....
relax
13489
1
[114939.0, 144172.0, 118364.0, 20580.0, 22534....
[58.0, 49.0, 39.0, 36.0, 20.0, 3.0, -2.0, -4.0...
relax
13503
1
[646861.0, 59231.0, 76359.0, 27057.0, 22133.0,...
[48.0, 53.0, 71.0, 77.0, 80.0, 90.0, 89.0, 74....
relax
13519
1
[179968.0, 17539.0, 16643.0, 31706.0, 13303.0,...
[109.0, 107.0, 100.0, 91.0, 103.0, 108.0, 102....
relax
13533
1
[224428.0, 74399.0, 33591.0, 8670.0, 17483.0, ...
[-267.0, -249.0, -221.0, -197.0, -188.0, -187....
relax
13547
1
[604844.0, 45607.0, 12693.0, 4812.0, 10111.0, ...
[54.0, 72.0, 68.0, 52.0, 40.0, 33.0, 32.0, 39....
relax
13562
1
[545004.0, 48019.0, 5844.0, 5804.0, 4166.0, 33...
[2.0, 6.0, 4.0, -5.0, -11.0, -3.0, 2.0, -3.0, ...
relax
13577
1
[500234.0, 42568.0, 12181.0, 16434.0, 16543.0,...
[85.0, 80.0, 88.0, 113.0, 122.0, 119.0, 128.0,...
relax
13592
1
[396835.0, 313031.0, 12196.0, 13806.0, 6779.0,...
[54.0, 48.0, 56.0, 66.0, 68.0, 58.0, 41.0, 37....
relax
13606
1
[226473.0, 14523.0, 1295.0, 1744.0, 3581.0, 26...
[-68.0, -56.0, -52.0, -54.0, -46.0, -35.0, -20...
relax
13622
1
[190851.0, 46447.0, 7622.0, 9326.0, 11090.0, 2...
[35.0, 39.0, 56.0, 67.0, 70.0, 57.0, 51.0, 52....
relax
13636
1
[808539.0, 99887.0, 6214.0, 4678.0, 13998.0, 6...
[168.0, 161.0, 155.0, 149.0, 131.0, 121.0, 132...
relax
13651
1
[61867.0, 50113.0, 15249.0, 23042.0, 6096.0, 1...
[91.0, 100.0, 116.0, 134.0, 131.0, 128.0, 141....
relax
13664
1
[21452.0, 37577.0, 26425.0, 4587.0, 18445.0, 9...
[48.0, 70.0, 86.0, 88.0, 75.0, 81.0, 90.0, 99....
relax
13679
1
[174582.0, 63327.0, 14815.0, 25082.0, 14216.0,...
[17.0, 28.0, 44.0, 50.0, 50.0, 56.0, 59.0, 44....
relax
13693
1
[132429.0, 24231.0, 3596.0, 6952.0, 2979.0, 24...
[86.0, 96.0, 91.0, 66.0, 51.0, 48.0, 45.0, 65....
relax
13708
1
[265376.0, 21289.0, 6300.0, 3168.0, 1250.0, 18...
[22.0, 28.0, 55.0, 50.0, 49.0, 32.0, 41.0, 59....
relax
13803
1
[6650.0, 22871.0, 45854.0, 191253.0, 15457.0, ...
[108.0, 114.0, 120.0, 123.0, 114.0, 104.0, 96....
focus
13818
1
[17269.0, 46755.0, 7453.0, 41606.0, 30618.0, 8...
[73.0, 69.0, 70.0, 87.0, 104.0, 107.0, 109.0, ...
focus
13835
1
[22435.0, 22581.0, 7030.0, 22607.0, 19750.0, 8...
[54.0, 60.0, 67.0, 64.0, 57.0, 59.0, 70.0, 73....
focus
13848
1
[4641.0, 22297.0, 12585.0, 35891.0, 3410.0, 43...
[36.0, 24.0, 28.0, 43.0, 42.0, 36.0, 21.0, -4....
focus
13863
1
[11888.0, 14622.0, 7172.0, 12690.0, 10048.0, 7...
[53.0, 66.0, 56.0, 55.0, 64.0, 53.0, 43.0, 52....
focus
13881
1
[15482.0, 11558.0, 32119.0, 37042.0, 25933.0, ...
[52.0, 65.0, 57.0, 43.0, 40.0, 35.0, 26.0, 18....
focus
13894
1
[7107.0, 6816.0, 1864.0, 112342.0, 10055.0, 28...
[35.0, 27.0, 20.0, 9.0, 12.0, 21.0, 19.0, 11.0...
focus
13908
1
[20107.0, 72684.0, 25025.0, 113397.0, 28565.0,...
[28.0, 40.0, 53.0, 59.0, 54.0, 44.0, 35.0, 29....
focus
13922
1
[17637.0, 8693.0, 66763.0, 146565.0, 24592.0, ...
[23.0, 36.0, 36.0, 36.0, 54.0, 76.0, 89.0, 89....
focus
13939
1
[13641.0, 53578.0, 23605.0, 161039.0, 29399.0,...
[66.0, 58.0, 51.0, 37.0, 22.0, 22.0, 27.0, 28....
focus
13951
1
[13230.0, 8127.0, 11132.0, 122631.0, 11565.0, ...
[89.0, 85.0, 77.0, 66.0, 55.0, 59.0, 60.0, 50....
focus
13966
1
[3696.0, 36922.0, 27992.0, 222616.0, 16098.0, ...
[-3.0, 19.0, 35.0, 36.0, 26.0, 36.0, 60.0, 85....
focus
13982
1
[50288.0, 40566.0, 38773.0, 83377.0, 44965.0, ...
[86.0, 81.0, 76.0, 76.0, 82.0, 73.0, 64.0, 49....
focus
13998
1
[11510.0, 12157.0, 79163.0, 188047.0, 43863.0,...
[57.0, 29.0, 6.0, -6.0, -7.0, -7.0, -6.0, -2.0...
focus
14012
1
[11462.0, 27788.0, 61575.0, 119062.0, 30606.0,...
[23.0, 48.0, 64.0, 54.0, 36.0, 26.0, 26.0, 27....
focus
14027
1
[14033.0, 36042.0, 12625.0, 47540.0, 18539.0, ...
[96.0, 76.0, 65.0, 64.0, 68.0, 56.0, 37.0, 23....
focus
14046
1
[7243.0, 12484.0, 47874.0, 57394.0, 46335.0, 3...
[61.0, 65.0, 59.0, 40.0, 29.0, 28.0, 18.0, 4.0...
focus
14060
1
[34056.0, 24142.0, 61051.0, 119314.0, 12628.0,...
[12.0, 16.0, 20.0, 22.0, 22.0, 20.0, 10.0, 9.0...
focus
14074
1
[18517.0, 30522.0, 13822.0, 102068.0, 21927.0,...
[2.0, 0.0, -2.0, -5.0, -19.0, -29.0, -25.0, -2...
focus
14092
1
[17688.0, 20602.0, 26737.0, 80210.0, 30690.0, ...
[48.0, 48.0, 43.0, 35.0, 19.0, 10.0, 16.0, 19....
focus
14107
1
[20148.0, 7016.0, 23182.0, 19044.0, 19904.0, 1...
[1.0, 1.0, 1.0, 12.0, 27.0, 36.0, 33.0, 34.0, ...
focus
14120
1
[2890.0, 10281.0, 43907.0, 64111.0, 11092.0, 6...
[3.0, -2.0, -20.0, -22.0, -7.0, 2.0, -5.0, -4....
focus
14133
1
[3530.0, 7091.0, 19734.0, 80265.0, 10657.0, 12...
[123.0, 139.0, 147.0, 137.0, 128.0, 118.0, 113...
focus
14152
1
[143208.0, 49443.0, 30992.0, 72803.0, 26976.0,...
[24.0, 43.0, 54.0, 58.0, 69.0, 73.0, 75.0, 83....
focus
14167
1
[6843.0, 5721.0, 17771.0, 96605.0, 27594.0, 15...
[-2.0, 10.0, 24.0, 25.0, 16.0, 21.0, 36.0, 42....
focus
14180
1
[11051.0, 46277.0, 129555.0, 102689.0, 5928.0,...
[58.0, 61.0, 64.0, 56.0, 59.0, 69.0, 60.0, 44....
focus
14194
1
[33374.0, 11831.0, 3696.0, 18759.0, 8544.0, 51...
[75.0, 72.0, 72.0, 65.0, 36.0, 12.0, 17.0, 27....
focus
14212
1
[263169.0, 31802.0, 7123.0, 7273.0, 6518.0, 34...
[41.0, 66.0, 82.0, 76.0, 58.0, 48.0, 53.0, 64....
focus
14224
1
[114362.0, 16018.0, 25348.0, 38073.0, 7682.0, ...
[35.0, 40.0, 52.0, 54.0, 40.0, 26.0, 23.0, 19....
focus
14239
1
[22817.0, 30823.0, 1176.0, 1976.0, 1952.0, 206...
[67.0, 73.0, 80.0, 72.0, 60.0, 53.0, 49.0, 50....
focus
In [26]:
data = vectors(df_one_subject[df_one_subject.label=='relax'])
data
Out[26]:
[array([ 8.77729055, 7.53916731, 7.55516116, 7.23239068, 7.01675079,
7.37329741, 7.03001973, 7.04118134, 6.60948299, 6.54998945,
6.13324229, 6.86127811, 6.62450289, 6.14979144, 5.58525487,
6.53495161, 6.61413826, 6.61179276, 6.00491282, 6.20782837,
5.46890982, 6.21713411, 6.02017807, 5.84342326, 6.23202742,
5.62351302, 5.61358655, 5.58329695, 5.9686238 , 5.26907726,
5.85388527, 5.33256733, 5.51341758, 5.40240597, 5.6823978 ,
5.24600035, 5.13282385, 5.29766656, 5.64184582, 5.44532181,
5.72985655, 5.43247882, 5.88447448, 4.77956831, 4.98151157,
4.8418777 , 5.88474959, 5.56132346, 5.68649682, 5.1892886 ,
5.31020917, 5.53784948, 5.41569152, 5.59090476, 5.2850484 ,
5.44075421, 5.50147526, 5.65054295, 4.8943596 , 5.171161 ,
5.41186046, 4.75274427, 5.15179548, 5.55582247, 5.3432178 ,
5.14322297, 5.25719721, 5.36058606, 4.58318515, 4.95497379,
4.94332403, 5.74845211, 4.99083149, 5.39810641, 4.99157644,
4.99184022, 5.19685047, 5.65680856, 5.14686916, 5.49771041,
5.52462685, 5.22893641, 4.99108963, 5.19827394, 5.28487552,
5.41119073, 5.47403061, 5.49447132, 4.93094651, 5.14856736,
5.33046409, 5.43225809, 5.17883581, 5.30525338, 5.39283439,
5.35624957, 5.32143305, 4.94893191, 4.9499499 , 5.64184888]),
array([ 8.7582172 , 7.41295831, 8.0815321 , 8.24669962, 8.16507676,
7.87736147, 7.59291977, 7.276786 , 7.11219948, 7.26324018,
6.94159534, 6.55062712, 6.52972633, 6.20905265, 5.9049655 ,
5.89542253, 6.38330236, 6.51118021, 6.30947159, 5.79130268,
6.05023132, 6.1807213 , 5.21513812, 5.94299883, 6.06225927,
6.14739525, 5.7736573 , 4.8735165 , 5.76083854, 5.77829795,
6.04162716, 5.81348035, 6.09363616, 6.02422452, 5.88583608,
5.61577155, 5.37091087, 4.8813334 , 5.69918247, 5.42211604,
5.54896213, 5.14820072, 5.14196735, 5.66374848, 5.52765848,
5.90152675, 5.29794407, 5.20501136, 5.19151672, 5.47105142,
5.06673214, 5.49597491, 5.5046502 , 4.98480342, 4.77734405,
5.63767367, 5.26725383, 5.08148609, 5.28381506, 5.14758395,
5.30334766, 4.56921849, 5.23686353, 5.26620377, 4.92083002,
5.04173119, 5.56026994, 5.42875831, 5.26566092, 4.99530816,
5.57719104, 5.20625956, 4.75355916, 4.8951608 , 5.06508186,
4.93342994, 4.86418376, 5.28356216, 5.54571631, 5.04969189,
5.4760643 , 4.85851892, 4.9292622 , 4.76677661, 5.67251928,
5.57662006, 5.06862807, 5.42339787, 5.16380941, 5.59881585,
5.16376001, 5.22826182, 5.3538398 , 5.04866211, 4.62270143,
5.0603447 , 5.31775123, 4.75274821, 4.86483671, 5.04501608]),
array([ 8.68564511, 7.60504865, 8.3015393 , 8.39248325, 8.27989834,
8.03552052, 7.47173065, 7.31298801, 6.80888047, 5.70657997,
6.59990567, 6.61477767, 6.74644003, 6.42626172, 6.21939582,
6.91937598, 6.15776407, 6.4640387 , 6.61795951, 6.13734324,
6.15747131, 6.00424296, 5.79758661, 6.17789192, 5.76347061,
5.89165403, 6.21301046, 5.83459806, 5.7787102 , 6.30655636,
6.10532405, 6.1505389 , 6.05889298, 5.69196106, 5.93050538,
5.68658197, 5.57665875, 6.28612693, 5.39842142, 5.70806109,
5.76356777, 6.09134523, 5.61587139, 5.99702575, 5.51725048,
5.67854371, 5.85274666, 5.63200066, 5.90712081, 5.44737937,
5.60763374, 5.7415506 , 5.45207264, 5.75055026, 5.55299422,
4.99529065, 5.63031883, 5.54407325, 5.08566279, 4.28478794,
5.33851249, 5.31852007, 5.20921639, 5.22264455, 5.26146933,
5.20209761, 5.70968845, 5.59446474, 5.57693655, 5.56756773,
5.16538024, 5.50592145, 5.67644402, 5.21600223, 5.41508596,
5.51486957, 5.86104987, 5.39811948, 5.2317138 , 5.87948504,
5.86521864, 5.4022604 , 5.63633747, 5.53220516, 5.62282667,
5.44017909, 4.98787508, 5.27323019, 5.53260206, 5.31666066,
5.11920382, 5.48265016, 5.56616967, 5.78113175, 5.97750655,
5.62377872, 5.2238526 , 5.7353179 , 5.50697601, 5.78354354]),
array([ 9.05141202, 8.94555855, 8.44892486, 8.96335314, 8.48564924,
8.38173988, 8.05132837, 8.28900287, 7.4140005 , 7.63775872,
7.21779638, 7.25464563, 7.22043908, 6.82420014, 7.27359997,
6.48974046, 6.75450292, 6.99275193, 5.82202554, 6.75534176,
6.83539364, 6.70376365, 6.59098902, 6.19008745, 6.57225301,
6.84518889, 6.65671679, 6.82388175, 6.39673934, 6.61705566,
6.07395329, 6.36254871, 6.6789597 , 6.18151646, 6.58036749,
6.55339094, 6.36333847, 6.05222545, 6.53472755, 6.34938573,
6.63609121, 6.44202136, 6.77325938, 6.56942426, 5.93995875,
6.19075933, 6.45166144, 6.64523806, 6.40211927, 5.90444693,
6.26515918, 5.3574458 , 6.3468188 , 6.03371714, 6.09661988,
5.92846321, 5.98582571, 5.77118997, 5.98432434, 5.92539878,
5.7677451 , 5.68705944, 5.86843047, 5.77164181, 6.10086779,
6.0385531 , 5.90578701, 5.97275754, 6.11726551, 6.60281146,
6.18816833, 5.73226979, 6.40620992, 6.32596672, 5.96376388,
6.06021863, 5.87489086, 6.29288833, 6.07914896, 6.00875233,
6.7051946 , 6.72845555, 6.50995826, 6.43558452, 6.1954289 ,
5.9487365 , 6.37514574, 6.21861986, 6.1909836 , 6.28075305,
5.2664538 , 6.06031168, 6.00797488, 5.68542399, 5.81493978,
5.3521881 , 6.02493076, 5.97088128, 6.16196459, 6.2394677 ]),
array([ 8.77648631, 8.00635886, 8.36378237, 8.54666687, 8.34040903,
8.26705374, 8.00606447, 7.83474781, 7.4386987 , 7.26098245,
7.30765946, 6.91726779, 6.85144257, 6.81754139, 6.74591278,
6.53184259, 6.64655007, 6.79521257, 6.47032162, 6.6174725 ,
6.17790459, 6.54312161, 5.76455143, 6.07151116, 6.07451574,
5.80385593, 6.29105544, 6.16409293, 6.25696514, 6.11081978,
6.07014368, 6.14567067, 5.84494105, 5.90529283, 5.70010082,
5.77182658, 5.51175724, 5.92601737, 6.23931088, 6.02867051,
5.62138422, 5.802372 , 5.34567472, 5.99790931, 5.80400196,
5.61898018, 5.76731042, 5.81622633, 5.76141066, 5.82190058,
5.84426485, 6.12057764, 5.52730898, 5.74851699, 6.09821896,
5.31980538, 5.38022399, 5.62238535, 5.48087109, 5.05549646,
4.94924181, 5.13390718, 5.26445056, 5.54872634, 5.1808778 ,
5.35603874, 5.11412779, 5.69682889, 5.6606373 , 5.29467626,
5.25349871, 4.80685596, 5.82743093, 5.188895 , 5.7977313 ,
5.8722262 , 5.98811834, 5.68730847, 5.72973783, 5.77070721,
5.76100989, 5.86434533, 5.10443099, 5.79371894, 5.80632072,
5.66791697, 5.23031887, 5.761097 , 5.63404758, 5.50780189,
5.35568859, 5.24141864, 5.25874145, 5.54973709, 5.76987101,
5.50291565, 5.49693579, 5.62306465, 5.62675566, 5.06635289]),
array([ 8.6262415 , 8.51651213, 8.21152357, 8.22332959, 8.26822868,
8.25187061, 8.00137722, 7.69722046, 7.37391322, 6.89631976,
6.94570251, 6.83530627, 6.96811538, 7.08019528, 6.73012909,
6.59671941, 6.49069482, 6.7106358 , 6.23598438, 6.31259816,
6.51728642, 6.54634996, 6.36027077, 6.23209841, 6.21871668,
6.17209909, 5.82387995, 6.25597676, 6.00296661, 5.80876251,
6.23229651, 6.37799795, 5.91067282, 5.93220214, 6.19024152,
5.9948306 , 5.60802126, 6.25140155, 5.79409559, 5.84543778,
6.06682863, 5.83096976, 5.97948975, 5.91686346, 5.74092137,
5.53172682, 5.68172192, 5.89570326, 5.32342484, 5.91050642,
5.45945831, 5.72270664, 6.0733748 , 5.61944695, 5.52664345,
4.85499766, 5.85785759, 5.62599907, 5.00785451, 5.67251448,
5.14157406, 5.58144098, 5.47984873, 5.4135929 , 5.44616971,
5.35585763, 5.16591999, 5.94077793, 5.44701177, 5.56641204,
5.22906632, 5.69346242, 5.34936926, 5.57588353, 5.30177442,
5.41725484, 5.63987244, 5.27558844, 5.63365691, 5.81906631,
5.77687556, 5.87427758, 5.37995487, 5.21786829, 5.73175949,
5.58318938, 5.63554251, 5.54013015, 5.67266969, 5.66804359,
5.38627398, 5.22728798, 5.48517788, 5.44385149, 5.52084266,
5.60452694, 5.34956171, 4.89939875, 5.53647939, 5.27444715]),
array([ 8.84176007, 8.14783875, 8.54317022, 7.72356161, 8.26356409,
7.39168526, 7.41214984, 7.44410614, 7.00185636, 7.14348173,
6.74328611, 6.65440944, 6.72055747, 6.95654675, 6.38553148,
6.6207025 , 6.38052729, 6.47098102, 6.57687106, 6.33425068,
5.99067581, 6.6597171 , 5.62153943, 6.39312205, 5.95051156,
5.34127354, 6.06332085, 6.07036479, 6.17515767, 5.45550689,
6.04321772, 5.31691549, 5.53144644, 5.79706754, 5.75449413,
5.92328246, 5.71658622, 5.03516262, 5.6208281 , 5.64351452,
5.64368998, 5.27323656, 5.99210855, 5.67007911, 5.56352293,
4.61954442, 5.48242598, 5.33766519, 5.81969531, 5.55741754,
5.64317818, 5.23438997, 5.75031426, 5.31916565, 5.15228888,
5.24059841, 5.49714504, 4.9114962 , 5.23965836, 5.4867409 ,
4.57555637, 4.8695207 , 4.41531974, 5.14367087, 4.84618199,
4.91822775, 4.82563182, 5.28773019, 5.61009554, 5.47148717,
5.21867168, 5.45763953, 5.36580709, 5.16219021, 5.50660878,
5.59372276, 5.53125833, 5.07924796, 5.52201469, 5.62625327,
5.5724571 , 5.48414409, 5.20177056, 4.93960033, 5.23426943,
5.46792881, 5.17146134, 5.72701566, 5.55662742, 4.90033207,
5.87756781, 5.15369708, 5.31901192, 5.57963833, 5.17565792,
5.32094341, 5.29858482, 5.46547449, 4.92527515, 4.83963279]),
array([ 8.8639485 , 8.47043872, 8.33681165, 8.23859099, 7.93625261,
7.44019863, 7.19393941, 6.92017664, 6.79293201, 6.42693565,
6.50307325, 6.455406 , 6.58236979, 6.68111376, 6.52455601,
6.47699691, 6.58536004, 5.90419407, 6.07824498, 6.63995248,
6.37918687, 6.13967865, 6.16675861, 6.39798436, 6.05889728,
6.05302416, 5.82953496, 5.69640101, 5.79069233, 5.7288319 ,
5.39465367, 5.71922623, 5.99424034, 5.23055893, 5.82670873,
5.93190541, 5.65567052, 5.43684344, 5.95559609, 5.76986564,
5.53181671, 5.76896668, 5.14539337, 5.47841686, 5.03587165,
5.86860899, 5.59408396, 5.4352125 , 5.57216607, 5.27601512,
5.90406706, 5.75193803, 5.3529732 , 5.51485601, 5.43508179,
4.75086194, 5.35208713, 5.28310145, 5.5396005 , 4.87799402,
5.46492226, 5.7292197 , 5.39059136, 5.29517907, 4.77669922,
5.3726515 , 5.51470578, 5.43026983, 5.08192787, 5.43412349,
5.17206 , 5.54795355, 5.39831219, 5.53090669, 5.27846189,
5.18311973, 5.48496664, 5.5250425 , 5.32413477, 5.43637827,
5.66379904, 5.29451918, 5.28598578, 5.60533269, 5.63959237,
5.54733532, 4.87530876, 5.38866721, 5.56520469, 5.30006253,
5.17111505, 5.96156666, 5.1150509 , 5.46442812, 5.50797788,
5.02975801, 5.43659676, 5.37738768, 4.99573617, 5.18281632]),
array([ 8.79529801, 7.06491257, 6.63193728, 7.55151704, 7.17570578,
7.19930679, 6.53162363, 6.88424588, 6.81925426, 6.8964951 ,
6.56711843, 6.95341819, 6.3697946 , 6.63098229, 6.64630459,
6.43811801, 6.71660118, 6.57222474, 6.49026198, 6.17459529,
5.74087341, 5.49898258, 5.49454112, 6.52606606, 6.13388001,
5.87922071, 5.51921287, 5.62633738, 5.72420223, 5.53038579,
5.74042735, 5.537947 , 5.35793417, 5.69782853, 5.57587706,
5.62409472, 5.6440226 , 5.43737459, 5.54748507, 5.41291603,
5.45786305, 5.53233018, 5.2681823 , 5.44700077, 5.37306396,
5.39001208, 5.64075171, 5.15746967, 5.60509816, 5.40907882,
5.16086557, 5.39736789, 5.69903009, 5.47355679, 5.48885906,
5.2017077 , 5.33709314, 5.49462112, 5.71622427, 4.64321071,
5.34993222, 5.32981738, 4.6209735 , 5.09091389, 5.07464413,
5.52720744, 5.26449742, 5.09182856, 5.60088888, 5.46870054,
5.42913056, 5.37163468, 5.14447655, 5.16555851, 5.53969148,
5.45444783, 5.03391843, 5.55157717, 5.21029947, 5.14922541,
5.31344114, 4.72488579, 5.11873212, 5.26957608, 5.27765136,
5.54295481, 5.22621536, 5.00013657, 4.91013227, 4.98155534,
5.17852392, 5.24967004, 4.87978441, 5.12344098, 5.01615347,
5.15731538, 4.97000958, 5.26012782, 5.20166035, 4.3746689 ])]
In [27]:
data2 = vectors(df_one_subject[df_one_subject.label=='focus'])
data2
Out[27]:
[array([ 8.76608271, 6.69599274, 6.54991526, 6.54618049, 7.19442741,
6.78267125, 6.54205664, 6.5951935 , 6.58337182, 6.40486206,
7.2322399 , 7.12306477, 6.67227483, 5.78494164, 6.80088907,
6.65161882, 5.96271552, 6.73327785, 6.34245621, 6.13790564,
6.12782901, 6.36634545, 6.19294295, 6.39821999, 5.99844237,
5.61909601, 5.98321597, 5.88812339, 5.91791832, 5.77988968,
6.01255254, 6.05371442, 5.72779158, 5.73504236, 5.81643066,
5.44364226, 5.3274653 , 5.53806083, 5.35485763, 5.85886929,
5.92853325, 5.48250739, 5.58057303, 5.56673197, 5.44213032,
5.72627219, 5.87721948, 5.3866918 , 5.79798114, 5.15838678,
5.56081336, 5.53061396, 5.31727831, 5.74977726, 5.20628794,
4.97253073, 5.51429704, 5.4840289 , 4.95955857, 5.09956305,
5.315997 , 5.04251063, 4.82094407, 5.31705878, 5.42670883,
5.36630721, 5.3250837 , 4.92255337, 5.07314977, 4.61457284,
5.23458107, 5.28738505, 5.39650583, 5.2559555 , 5.21954074,
5.74823865, 5.17935811, 5.27421016, 5.11404647, 5.45833849,
5.1375945 , 5.05281717, 5.30609272, 5.09741117, 5.21680673,
4.88356172, 5.28100485, 4.87913498, 5.46341084, 4.20833881,
5.42937992, 5.34596377, 4.61566853, 5.22610971, 4.75568045,
4.76598919, 4.73066742, 5.13400058, 5.04425759, 5.08976976]),
array([ 8.76276351, 6.41151286, 6.37457205, 6.77001232, 6.47479346,
6.56848615, 6.63197684, 6.0581531 , 6.201565 , 6.78768576,
7.44231377, 6.8861695 , 6.55909226, 6.35215746, 5.78609615,
6.69874832, 6.68893522, 6.62151602, 5.97027773, 5.77357362,
6.3013594 , 6.4400708 , 6.29155489, 5.8324084 , 5.59362674,
5.71514 , 6.10563126, 5.55197509, 6.12118679, 5.55267608,
5.61959743, 5.90314222, 4.8061975 , 5.69128297, 5.52343788,
4.92568362, 5.71700305, 5.47406979, 5.35958245, 5.57265795,
5.1135989 , 4.95296055, 5.71837573, 5.59004944, 5.51455055,
4.79438724, 5.06652417, 5.87915303, 5.33957345, 5.28095772,
5.09492994, 5.43105642, 4.81336682, 5.21868014, 5.2855173 ,
5.58024774, 5.46155278, 5.26057529, 4.47692948, 5.76014681,
5.18465531, 5.14755302, 5.25429603, 5.12948451, 4.99264939,
5.27759892, 5.39761611, 5.1841766 , 4.7513902 , 5.05181952,
4.7404445 , 5.22267204, 4.94877395, 5.13621788, 5.02462284,
4.64356911, 5.02451249, 5.44167597, 5.59351601, 4.95570594,
4.81003627, 5.13106732, 4.81265875, 5.22101296, 4.7053511 ,
4.93546435, 5.04484895, 5.13190097, 5.14630676, 5.37452978,
4.89333896, 5.05280553, 5.06332567, 5.2455391 , 4.82958438,
4.52671782, 4.71709589, 5.1379888 , 4.91246803, 4.67460495]),
array([ 8.74618073, 6.57533921, 6.68978806, 6.7736048 , 7.02803725,
6.73483871, 7.12716666, 6.58172895, 7.29465708, 6.88250692,
7.85660791, 7.44460233, 7.01829645, 7.09796991, 6.78527361,
6.93739852, 6.58456376, 6.62969759, 5.90612908, 6.26773471,
6.4925076 , 6.07122375, 6.04263654, 6.27808327, 6.00168997,
5.67280487, 6.12543431, 5.29627225, 5.78574235, 5.78366068,
5.80583151, 5.96165102, 5.88543748, 5.87778653, 4.9194273 ,
5.63277795, 5.52397518, 4.74966245, 5.58112116, 5.15502953,
5.54194376, 5.83831709, 5.31513599, 5.54824663, 5.65156028,
4.98094289, 5.4121022 , 5.29988108, 5.50799741, 5.3100113 ,
5.2646275 , 4.86894924, 5.39611705, 5.09725974, 4.92431149,
5.70893733, 5.46365759, 5.14226639, 5.27223473, 5.49010019,
5.51070104, 5.32848406, 5.44885062, 5.16538765, 4.63842155,
5.28487435, 4.91134271, 4.87904233, 5.40876348, 5.34279559,
5.15212079, 4.84885944, 4.80234971, 5.11363229, 4.96738254,
5.31664114, 4.64852498, 4.66151569, 4.91977975, 5.11028357,
5.13411501, 4.92721385, 5.38008881, 4.77737328, 4.93603647,
5.11632102, 5.08397337, 5.20909534, 4.76228719, 4.92616189,
5.52607016, 4.97880964, 5.13339614, 4.03966808, 5.09521363,
5.12783029, 4.58864215, 4.56992133, 5.06950122, 5.05517614]),
array([ 8.75474896, 6.37069175, 7.04053056, 6.80115999, 6.83574928,
6.13900755, 6.96545519, 7.00818223, 6.93637364, 7.11898512,
7.8642536 , 6.60710155, 6.92780163, 6.44919914, 6.75113319,
7.01847842, 6.30637817, 6.66109896, 6.7959449 , 6.85145332,
6.50660338, 6.52619329, 6.53122466, 5.49485428, 6.10804447,
5.81188359, 6.19026552, 5.9575791 , 6.18661995, 5.65850532,
5.74665023, 5.68778347, 5.51678114, 5.90873845, 5.31131654,
5.93088309, 5.58674459, 5.52038497, 5.26803745, 5.80880887,
5.55015881, 5.59019281, 5.94231787, 5.37725491, 5.47207077,
5.39605577, 4.80122281, 5.65713986, 5.44980934, 5.24415336,
5.34409979, 5.48707331, 5.51139192, 5.24552878, 5.2522822 ,
5.21212734, 5.57939081, 5.22580504, 5.39918249, 4.94005939,
5.23256711, 5.31910649, 5.13463748, 5.21223202, 5.44004158,
5.36864321, 4.7648804 , 5.13273461, 5.23642828, 5.08866629,
5.20784433, 5.48019773, 5.39063563, 4.48751817, 5.35914335,
5.460994 , 4.92681532, 5.27811085, 5.52168515, 5.59843428,
5.01129908, 5.15548589, 4.77205487, 5.05348884, 4.7045386 ,
5.42405053, 5.17588835, 5.07982313, 4.81708823, 5.16806026,
5.57891438, 5.22294779, 4.90921835, 5.04811906, 4.93760889,
4.8964315 , 4.92715555, 4.63643433, 4.98842018, 5.11151053]),
array([ 8.76269988, 6.41819033, 6.63563527, 6.70769642, 7.06850407,
6.06180467, 6.83028713, 6.87264837, 6.63141283, 7.41807556,
7.64819182, 7.7518224 , 6.55001658, 6.60123159, 7.02853616,
6.96218084, 6.81285124, 6.48910528, 6.61785434, 5.87452658,
6.4667716 , 6.28612485, 6.37629402, 6.00383676, 6.17845189,
5.88890738, 5.8439997 , 6.25334665, 5.9404739 , 5.6754163 ,
5.92076309, 5.78401949, 5.53766864, 6.00672448, 5.49871724,
5.93777915, 5.68213313, 4.98040312, 5.66020546, 5.55645156,
5.7431456 , 5.36220667, 5.71681621, 5.12392301, 5.53811093,
5.5125446 , 5.37463576, 5.66907548, 5.04645724, 5.36728859,
5.63822958, 5.51645823, 5.68347517, 5.29661927, 5.27627955,
5.30643814, 5.31363837, 5.29374165, 5.16183989, 5.14458525,
4.52534147, 5.36410238, 5.2773369 , 5.05498054, 4.67258523,
5.35298388, 5.05819295, 5.15824448, 4.99989946, 5.38246569,
5.30631608, 5.27669887, 4.94266959, 5.04003708, 5.2219746 ,
4.8407306 , 5.1977825 , 3.86129818, 5.26534921, 5.21972408,
5.23264908, 4.80355136, 4.7218031 , 5.24527817, 5.13115355,
4.85787933, 5.47608107, 4.58378796, 5.03509148, 5.06071891,
5.13757465, 5.19935179, 5.2958719 , 4.68692323, 4.93748713,
5.15367344, 4.90606984, 5.06906895, 5.08527029, 5.22618967]),
array([ 8.77506728, 6.56957015, 6.53074988, 7.00995775, 6.18722445,
6.33057212, 7.05952903, 6.30532999, 6.71434724, 7.32164433,
7.49518379, 7.46248877, 6.90915416, 6.86067546, 6.68035548,
6.73664812, 7.06623623, 6.27504579, 6.73201846, 6.51082662,
6.17308037, 6.40682705, 6.18885919, 5.9822802 , 6.43139892,
6.0160854 , 5.44718783, 5.32332359, 5.90468909, 5.89055546,
5.45739769, 5.43964564, 5.43977363, 5.48580744, 5.73097013,
5.73165052, 5.5886293 , 5.86056902, 5.13604598, 4.4566457 ,
5.79992427, 5.20692129, 5.72577739, 5.30226752, 5.64741536,
5.70827181, 4.21989525, 5.36187591, 5.66393796, 5.35400048,
5.67715601, 5.58171308, 5.18387446, 4.86685425, 5.75769643,
5.51700252, 5.37834497, 5.26022895, 5.51076015, 4.92906236,
5.49015889, 5.19956248, 5.26598399, 5.03274452, 5.26794553,
4.92192095, 5.36600158, 5.02376381, 5.37884127, 5.0576217 ,
4.39579085, 5.20372809, 4.60293021, 5.55635626, 5.07963022,
4.95119674, 4.84575349, 5.52725328, 5.11311934, 5.4527648 ,
5.00375829, 4.93271247, 5.00017581, 5.02268766, 4.77609698,
5.02558581, 4.81564537, 4.99870463, 5.08489579, 4.94557269,
4.63101847, 5.02885385, 4.76049613, 4.69335961, 5.0208357 ,
4.87271818, 4.27481932, 4.95638323, 4.85780282, 4.44319464]),
array([ 8.74325977, 6.38225817, 6.65577873, 6.62764982, 6.30911208,
6.60292335, 6.64562686, 6.53652674, 6.36637729, 7.20516829,
7.41279083, 6.76709708, 6.55568718, 6.38854185, 6.79071543,
6.27496737, 6.86949588, 6.39055474, 6.30563637, 6.44396712,
6.14622917, 6.11349165, 5.99517803, 5.38833768, 5.42950808,
5.93125154, 5.74625117, 5.42970118, 5.84759953, 5.43815649,
5.79400013, 5.60417701, 5.35907767, 5.89765845, 5.57664234,
5.19563667, 5.73965683, 4.89176597, 5.50147965, 5.39237647,
5.09803707, 5.24778193, 5.47361502, 5.16541556, 5.53163292,
5.24508433, 5.4671989 , 5.21953878, 5.40066903, 5.37646548,
5.57002829, 5.44835877, 4.88778096, 5.33432039, 4.99916843,
4.47704337, 5.09294965, 5.41521868, 5.01580173, 4.77951348,
4.73653327, 4.70049846, 5.25319587, 5.39541791, 5.29334584,
4.92603859, 5.20195267, 4.63681071, 5.0461266 , 5.35785417,
5.01823263, 5.10906547, 5.58967156, 5.4357359 , 5.116324 ,
5.03413779, 5.25253902, 5.02089389, 5.46639537, 5.20028715,
4.8635923 , 5.18094943, 5.24216123, 4.62484191, 4.23284273,
4.97513258, 5.35879934, 4.69364248, 5.00189318, 4.71466987,
4.96252472, 5.01834507, 4.78117942, 4.82160338, 5.23240004,
4.90744463, 4.81107822, 4.79760039, 4.91004451, 4.51460989]),
array([ 8.75591496, 5.68482416, 6.44468105, 6.58048896, 6.26562197,
6.60988691, 6.86855774, 6.81367573, 7.12997439, 6.94836025,
7.58445113, 7.58756177, 7.15108699, 7.10653992, 6.77385493,
6.7987589 , 6.52650029, 6.19986638, 6.20393127, 6.73001562,
6.13799207, 6.50213213, 6.22177926, 6.40474713, 6.34467686,
6.39361466, 5.87272479, 5.92100072, 5.63346141, 5.73544355,
6.01719393, 5.44866615, 5.58134473, 5.27278996, 5.36542045,
5.54274277, 5.07978885, 5.88707203, 5.46560194, 5.86555496,
5.80963083, 5.55120229, 5.42011861, 5.5521898 , 5.33776113,
5.36036428, 5.9343602 , 5.55026378, 5.57186853, 5.49778058,
5.4588266 , 5.3841046 , 4.79921173, 5.30786994, 5.00701812,
4.88686652, 5.32984512, 4.85703639, 4.96508281, 4.93581729,
5.153719 , 5.10404214, 5.17667414, 4.1346597 , 5.0904641 ,
5.08548409, 5.25713554, 5.26653964, 5.5954977 , 4.53925698,
5.12259759, 5.30277772, 5.62904638, 5.26796815, 5.51079823,
5.31784371, 5.61902265, 5.18316632, 5.09514201, 5.08308181,
5.41118521, 5.17781639, 5.21859303, 5.40212128, 5.1918933 ,
5.00333228, 5.07468778, 5.36547082, 5.02046698, 4.91504166,
5.08522929, 4.95450093, 4.90559073, 4.66887472, 4.52987586,
5.30643651, 4.67920048, 4.99643795, 4.26879157, 4.75820288]),
array([ 8.78674115, 7.70781788, 7.54131002, 6.7554134 , 6.89580617,
7.10199932, 6.44973087, 6.31056496, 6.47256083, 7.35803019,
6.91488953, 7.00590596, 7.30208265, 6.3823095 , 6.4626195 ,
6.04891251, 6.26317442, 6.24937128, 6.40193069, 6.27767554,
5.86800967, 6.1616843 , 6.19188059, 5.9920363 , 5.51394762,
5.81211859, 5.91306728, 5.80263949, 6.09488828, 5.45541224,
5.77717071, 6.0895968 , 5.72692615, 5.57966391, 6.05732253,
5.75575102, 5.53489331, 5.30160154, 5.95440568, 5.5363637 ,
5.36361467, 5.84474495, 5.54931086, 5.50569728, 5.82627948,
5.68373304, 5.50509802, 5.83664125, 5.31204364, 5.80183221,
5.6849423 , 5.73321499, 5.60036794, 5.39248557, 5.05395251,
5.03092153, 5.47813595, 4.77765083, 5.1011052 , 5.4218709 ,
5.06681292, 4.70341897, 5.54731981, 5.3996193 , 4.50266686,
5.23340889, 5.03415429, 5.19981653, 5.23285506, 4.98924867,
5.19344637, 5.08733599, 5.17590166, 5.48171562, 5.15384121,
5.22651062, 5.09924108, 5.58509287, 5.15560203, 5.39291255,
4.97564911, 5.01738545, 5.48841463, 5.52939649, 5.03065449,
5.28593349, 4.57823462, 4.78396919, 5.272547 , 5.51727343,
4.27852523, 5.20749801, 5.19827478, 4.91189984, 5.17814801,
4.5451393 , 4.88475112, 5.1236551 , 4.59673595, 5.00523073])]
In [28]:
def vectors_labels (list1, list2):
def label (l):
return lambda x: l
X = list1 + list2
y = list(map(label(0), list1)) + list(map(label(1), list2))
return X, y
In [29]:
X,y =vectors_labels(data,data2)
In [30]:
y
Out[30]:
[0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1]
In [31]:
X_train, X_test, y_train, y_test = train_test_split(X,y,test_size=0.1)
In [32]:
np.mean(cross_val_svm(X_train,y_train,7))
Out[32]:
0.9285714285714286
In [35]:
from sklearn import preprocessing
X_train = preprocessing.scale(X_train)
cross_val_svm(X_train,y_train,7).mean()
Out[35]:
0.8571428571428571
In [37]:
data = vectors(df_clean[df_clean.label=='focus'])
data2 = vectors(df_clean[df_clean.label=='focus'])
X,y = vectors_labels(data,data2)
X_train, X_test, y_train, y_test = train_test_split(X,y,test_size=0.2)
np.mean(cross_val_svm(X_train,y_train,5))
Out[37]:
0.46462626262626261
In [41]:
X_train = preprocessing.scale(X_train)
In [43]:
cross_val_svm(X_train,y_train,5).mean()
Out[43]:
0.25541414141414143
In [47]:
from sklearn.ensemble import RandomForestClassifier
rf= RandomForestClassifier(n_estimators = 200,max_depth = 10)
data = vectors(df_clean[df_clean.label=='focus'])
data2 = vectors(df_clean[df_clean.label=='focus'])
X,y = vectors_labels(data,data2)
X_train, X_test, y_train, y_test = train_test_split(X,y,test_size=0.2)
np.mean(cross_val_score(rf,X_train,y_train))
Out[47]:
0.1891489747777173
In [48]:
def subject_scores (subject,kern):
f = focused[focused['id']==subject]
r = relaxed[relaxed['id']==subject]
X,y = vectors_labels(vectors(f),vectors(r))
X=preprocessing.scale(X)
return cross_val_svm(X,y,7,kern).mean()
In [49]:
for s in range(1,31):
print("Subject ",s, " score is:", subject_scores(s,'linear'))
Subject 1 score is: 1.0
Subject 2 score is: 0.892857142857
Subject 3 score is: 1.0
Subject 4 score is: 0.928571428571
Subject 5 score is: 0.928571428571
Subject 6 score is: 0.535714285714
Subject 7 score is: 0.738095238095
Subject 8 score is: 0.607142857143
Subject 9 score is: 0.607142857143
Subject 10 score is: 0.571428571429
Subject 11 score is: 0.821428571429
Subject 12 score is: 0.857142857143
Subject 13 score is: 0.964285714286
Subject 14 score is: 0.892857142857
Subject 15 score is: 0.607142857143
Subject 16 score is: 0.964285714286
Subject 17 score is: 0.666666666667
Subject 18 score is: 0.642857142857
Subject 19 score is: 0.964285714286
Subject 20 score is: 0.571428571429
Subject 21 score is: 0.857142857143
Subject 22 score is: 0.392857142857
Subject 23 score is: 0.464285714286
Subject 24 score is: 0.964285714286
Subject 25 score is: 0.642857142857
Subject 26 score is: 0.714285714286
Subject 27 score is: 0.857142857143
Subject 28 score is: 0.607142857143
Subject 29 score is: 0.869047619048
Subject 30 score is: 0.630952380952
In [50]:
import matplotlib.pyplot as plt
In [57]:
scores = []
for s in range(1,31):
scores.append(subject_scores(s,'linear'))
import matplotlib.pyplot as plt
%matplotlib inline
plt.plot(scores)
print("Average score is: ", np.mean(scores))
print("Standard deviation is: ", np.std(scores))
Average score is: 0.75873015873
Standard deviation is: 0.174231205516
In [58]:
scores = []
for s in range(1,31):
scores.append(subject_scores(s,'rbf'))
import matplotlib.pyplot as plt
%matplotlib inline
plt.plot(scores)
print("Average score is: ", np.mean(scores))
print("Standard deviation is: ", np.std(scores))
Average score is: 0.781746031746
Standard deviation is: 0.158839248228
In [59]:
scores = []
for s in range(1,31):
scores.append(subject_scores(s,'poly'))
import matplotlib.pyplot as plt
%matplotlib inline
plt.plot(scores)
print("Average score is: ", np.mean(scores))
print("Standard deviation is: ", np.std(scores))
Average score is: 0.589682539683
Standard deviation is: 0.133797849196
In [60]:
scores = []
for s in range(1,31):
scores.append(subject_scores(s,'sigmoid'))
import matplotlib.pyplot as plt
%matplotlib inline
plt.plot(scores)
print("Average score is: ", np.mean(scores))
print("Standard deviation is: ", np.std(scores))
Average score is: 0.771428571429
Standard deviation is: 0.157196960383
Content source: jdpigeon/neurodoro
Similar notebooks: