{
  "id": 492220,
  "title": "Some notes on frequency pairs and EEG features from bipolar montages .  70th  Place Gaurav and Med part",
  "url": "/competitions/hms-harmful-brain-activity-classification/discussion/492220",
  "author_name": "Gaurav Rawat",
  "post_date": "2024-04-09T01:18:06.987000",
  "votes": 6,
  "comment_count": 0,
  "views": 0,
  "content": "<p>These notes I made for the comp discuss the extraction of frequency band-based features from EEG data and different feature pairs based on different parts of the brain. The document also suggests creating a wavenet model to utilize these features and concatenate them in different layers. We tried tow approaches the first one as per the paper did not work but the second one which was similar to Chris but added more features to divide the EEG by portions of brain in a wavenet and/or chrononet blocks which were then eventually  concatenated .</p>\n<ol>\n<li><strong>Frequency Band based features extraction == DIDNT WORK ==</strong></li>\n</ol>\n<p><a href=\"https://ieeexplore.ieee.org/stamp/stamp.jsp?arnumber=8910555\" target=\"_blank\">https://ieeexplore.ieee.org/stamp/stamp.jsp?arnumber=8910555</a></p>\n<p><strong>Code reference</strong> : <a href=\"https://github.com/AITRICS/EEG_real_time_seizure_detection/blob/251f104588b0861595a8b3059b92aaf45a7da1e2/builder/data/feature_extraction.py#L173\" target=\"_blank\">https://github.com/AITRICS/EEG_real_time_seizure_detection/blob/251f104588b0861595a8b3059b92aaf45a7da1e2/builder/data/feature_extraction.py#L173</a> </p>\n<p><strong>PSD FEATURE 2 ~ feature geneartor</strong></p>\n<p><a href=\"https://github.com/AITRICS/EEG_real_time_seizure_detection/blob/251f104588b0861595a8b3059b92aaf45a7da1e2/builder/models/feature_extractor/psd_feature.py\" target=\"_blank\">https://github.com/AITRICS/EEG_real_time_seizure_detection/blob/251f104588b0861595a8b3059b92aaf45a7da1e2/builder/models/feature_extractor/psd_feature.py</a></p>\n<pre><code>\n                psd1 = self.psd(amp,,)\n                psd2 = self.psd(amp,,)\n                psd3 = self.psd(amp,,)\n                psd4 = self.psd(amp,,)\n                psd5 = self.psd(amp,,)\n                psd6 = self.psd(amp,,)\n                psd7 = self.psd(amp,,)\n\n                psds = torch.stack((psd1, psd2, psd3, psd4, psd5, psd6, psd7))\n                psd_sample.append(psds)\n\n            psds_batch.append(torch.stack(psd_sample))\n\n         torch.stack(psds_batch)\n</code></pre>\n<p>We used<br>\nFFT to transform these sliced data segments into the frequency domain in addition to the time domain and categorized them into eight frequency bands, namely 0.1–4, 4–8,<br>\n8–12, 12–30, 30–50, 50–70, 70–100, and 100–180 Hz.</p>\n<p><strong>Notebooks</strong></p>\n<p>Preprocessing : <a href=\"https://www.kaggle.com/code/gauravbrills/hms-eeg-data-processed-path-multi-band-simple?scriptVersionId=168920925\" target=\"_blank\">https://www.kaggle.com/code/gauravbrills/hms-eeg-data-processed-path-multi-band-simple?scriptVersionId=168920925</a></p>\n<p>Train:<a href=\"https://www.kaggle.com/code/gauravbrills/hms-resnet1d-gru-train-multi-band/notebook?scriptVersionId=168931251\" target=\"_blank\">https://www.kaggle.com/code/gauravbrills/hms-resnet1d-gru-train-multi-band/notebook?scriptVersionId=168931251</a></p>\n<p>Infer: </p>\n<p>Fold 0 : 0.8 so far was not that great so we skipped this appraoch</p>\n<hr>\n<p>2 . <strong>Different feature pairs based on part of brain == WORKED 😃==</strong></p>\n<p><strong>data processed</strong> : <a href=\"https://www.kaggle.com/code/medali1992/hms-eeg-data-processed-path?scriptVersionId=168592399\" target=\"_blank\">https://www.kaggle.com/code/medali1992/hms-eeg-data-processed-path?scriptVersionId=168592399</a></p>\n<p><strong>dataset</strong>: <a href=\"https://www.kaggle.com/datasets/pcjimmmy/hms-eeg-preprocessed-path-v3\" target=\"_blank\">https://www.kaggle.com/datasets/pcjimmmy/hms-eeg-preprocessed-path-v3</a></p>\n<p><strong>dataset all 4 Penta tail</strong> : <a href=\"https://www.kaggle.com/datasets/pcjimmmy/hms-eeg-data-processed-path-v-7-03262024-dataset\" target=\"_blank\">https://www.kaggle.com/datasets/pcjimmmy/hms-eeg-data-processed-path-v-7-03262024-dataset</a> </p>\n<p><strong>&gt;</strong> <a href=\"https://www.kaggle.com/code/medali1992/hms-eeg-data-processed-path\" target=\"_blank\">https://www.kaggle.com/code/medali1992/hms-eeg-data-processed-path</a> </p>\n<p><strong>Train</strong> : <a href=\"https://www.kaggle.com/code/gauravbrills/hms-wavenet-gru-train-v3-diff-feats?scriptVersionId=168621267\" target=\"_blank\">https://www.kaggle.com/code/gauravbrills/hms-wavenet-gru-train-v3-diff-feats?scriptVersionId=168621267</a> </p>\n<p><strong>Train PentaTail :</strong> <a href=\"https://www.kaggle.com/code/gauravbrills/hms-wave-gru-train-penta-tail/edit\" target=\"_blank\">https://www.kaggle.com/code/gauravbrills/hms-wave-gru-train-penta-tail/edit</a></p>\n<p><strong>Infer Stage 2 :</strong><a href=\"https://www.kaggle.com/code/gauravbrills/eeg-wave-gru-strat-folds?scriptVersionId=168858167\" target=\"_blank\">https://www.kaggle.com/code/gauravbrills/eeg-wave-gru-strat-folds?scriptVersionId=168858167</a></p>\n<p><strong>Infer Stage 1 :</strong><a href=\"https://www.kaggle.com/code/gauravbrills/eeg-wave-gru-strat-folds?scriptVersionId=168871190\" target=\"_blank\">https://www.kaggle.com/code/gauravbrills/eeg-wave-gru-strat-folds?scriptVersionId=168871190</a></p>\n<p>stage  1 overall  CV 0.6074094803600332    </p>\n<ul>\n<li>LB stage 2 overall   </li>\n<li>STAGE 2 CV  0.6932664658512089<br>\nLB : -.4-<br>\nPenta Tail : </li>\n<li>Stage  1 CV : 0.6006901876404124 </li>\n<li>LB Stage 2 overall CC 0.6696101739331131***</li>\n<li>Private STAGE 2 : 0.40</li>\n</ul>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F768166%2F619e36cee4a9568fc2cbce6219508372%2FUntitled.png?generation=1712625379808593&amp;alt=media\"></p>\n<pre><code>Pairs=[ (, ), (, ), (, ), (, ),(, ),(, ),\n(, ),(, ),(, ),(, ),(, ),(, ),\n(, ),(, ),(, ),(, ),(, ),(, ),\n(, ),(, ),]\n</code></pre>\n<p><strong>We developer WaveNet and chrononet models that utilizes the features below and concatenates t them at different layers/parts.</strong></p>\n<pre><code>Left part:\n(, ),\n(, ),\n(, ),\n(, ),\n(, ),\n(, ),\n(, ),\n(, ),\n(, ),\nRight part:\n(, ),\n(, ),\n(, ),\n(, ),\n(, ),\n(, ),\n(, ),\n(, ),\n(, ),\n\nFront part:\n(, ),\n(, ),\n(, ),\n(, ),\n\nBack part:\n(, ),\n(, ),\n(, ),\n(, ),\n\nCentral part:\n(, ),\n(, ),\n(, ),\n(, ),\n(, ),\n</code></pre>\n<p>Wavebet blocks layout</p>\n<pre><code> ():\n        \n        x1 = self.model(x[:, :, self.index_dict[(, )]:self.index_dict[(, )]+])\n        x2 = self.model(x[:, :, self.index_dict[(, )]:self.index_dict[(, )]+])\n        x3 = self.model(x[:, :, self.index_dict[(, )]:self.index_dict[(, )]+])\n        x4 = self.model(x[:, :, self.index_dict[(, )]:self.index_dict[(, )]+]) \n        x6 = self.model(x[:, :, self.index_dict[(, )]:self.index_dict[(, )]+])\n        x7 = self.model(x[:, :, self.index_dict[(, )]:self.index_dict[(, )]+]) \n        x9 = self.model(x[:, :, self.index_dict[(, )]:self.index_dict[(, )]+])\n        z1 = torch.mean(torch.stack([x1, x2, x3, x4, x6, x7,   x9]), dim=)\n\n        \n        x1 = self.model(x[:, :, self.index_dict[(, )]:self.index_dict[(, )]+])\n        x2 = self.model(x[:, :, self.index_dict[(, )]:self.index_dict[(, )]+])\n        x3 = self.model(x[:, :, self.index_dict[(, )]:self.index_dict[(, )]+])\n        x4 = self.model(x[:, :, self.index_dict[(, )]:self.index_dict[(, )]+])\n        x5 = self.model(x[:, :, self.index_dict[(, )]:self.index_dict[(, )]+])\n        x6 = self.model(x[:, :, self.index_dict[(, )]:self.index_dict[(, )]+])\n        x7 = self.model(x[:, :, self.index_dict[(, )]:self.index_dict[(, )]+]) \n        x9 = self.model(x[:, :, self.index_dict[(, )]:self.index_dict[(, )]+])\n        z2 = torch.mean(torch.stack([x1, x2, x3, x4, x5, x6, x7,   x9]), dim=)\n\n        \n        x1 = self.model(x[:, :, self.index_dict[(, )]:self.index_dict[(, )]+])\n        x2 = self.model(x[:, :, self.index_dict[(, )]:self.index_dict[(, )]+])\n        x3 = self.model(x[:, :, self.index_dict[(, )]:self.index_dict[(, )]+])\n        x4 = self.model(x[:, :, self.index_dict[(, )]:self.index_dict[(, )]+])\n        z3 = torch.mean(torch.stack([x1, x2, x3, x4]), dim=)\n\n        \n        x1 = self.model(x[:, :, self.index_dict[(, )]:self.index_dict[(, )]+])\n        x2 = self.model(x[:, :, self.index_dict[(, )]:self.index_dict[(, )]+])\n        x3 = self.model(x[:, :, self.index_dict[(, )]:self.index_dict[(, )]+])\n        x4 = self.model(x[:, :, self.index_dict[(, )]:self.index_dict[(, )]+])\n        z4 = torch.mean(torch.stack([x1, x2, x3, x4]), dim=)\n\n        y = torch.cat([z1, z2, z3, z4], dim=) \n</code></pre>\n<p>Chrononet has a similar feature layout just the head is like </p>\n<pre><code> (nn.Module):\n     ():\n        ().__init__()\n        self.inception_block1=InceptionBlock(channel) \n        self.inception_block2=InceptionBlock() \n        self.inception_block3=InceptionBlock() \n        self.gru1 = nn.GRU(input_size = , hidden_size = , batch_first = , bidirectional=) \n        self.gru2 = nn.GRU(input_size = *, hidden_size = , batch_first = , bidirectional=) \n        self.gru3 = nn.GRU(input_size = *, hidden_size = , batch_first = , bidirectional=) \n        self.gru4 = nn.GRU(input_size = *, hidden_size = , batch_first = , bidirectional=) \n        self.relu = nn.ReLU() \n        self.gru_linear=nn.Linear(in_features = , out_features = ) \n        self.flatten = nn.Flatten() \n        self.seqpool = SeqPool()\n        self.fc1 = nn.Linear(,) \n\n     (): \n        x = x.permute(, , )\n        x=self.inception_block1(x) \n        x=self.inception_block2(x) \n        x=self.inception_block3(x) \n        x=x.permute(,,) \n        gru_out1,_=self.gru1(x) \n        gru_out2,_=self.gru2(gru_out1) \n        gru_out=torch.cat((gru_out1, gru_out2), dim = ) \n        gru_out3,_=self.gru3(gru_out)  \n        gru_out = torch.cat((gru_out1, gru_out2, gru_out3), dim = ) \n        gru_out4,_=self.gru4(gru_out) \n        seqpool = self.seqpool(gru_out4)\n\n         seqpool \n</code></pre>\n<p>Features depicted as they are placed as electrodes in the human brain .</p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F768166%2F36024ed86af07b43ed27c1daecbb31b0%2Fbrain%20feats.png?generation=1712625439133816&amp;alt=media\"> </p>",
  "messages": [
    {
      "id": 2742583,
      "postDate": "2024-04-09T01:18:06.987Z",
      "content": "<p>These notes I made for the comp discuss the extraction of frequency band-based features from EEG data and different feature pairs based on different parts of the brain. The document also suggests creating a wavenet model to utilize these features and concatenate them in different layers. We tried tow approaches the first one as per the paper did not work but the second one which was similar to Chris but added more features to divide the EEG by portions of brain in a wavenet and/or chrononet blocks which were then eventually  concatenated .</p>\n<ol>\n<li><strong>Frequency Band based features extraction == DIDNT WORK ==</strong></li>\n</ol>\n<p><a href=\"https://ieeexplore.ieee.org/stamp/stamp.jsp?arnumber=8910555\" target=\"_blank\">https://ieeexplore.ieee.org/stamp/stamp.jsp?arnumber=8910555</a></p>\n<p><strong>Code reference</strong> : <a href=\"https://github.com/AITRICS/EEG_real_time_seizure_detection/blob/251f104588b0861595a8b3059b92aaf45a7da1e2/builder/data/feature_extraction.py#L173\" target=\"_blank\">https://github.com/AITRICS/EEG_real_time_seizure_detection/blob/251f104588b0861595a8b3059b92aaf45a7da1e2/builder/data/feature_extraction.py#L173</a> </p>\n<p><strong>PSD FEATURE 2 ~ feature geneartor</strong></p>\n<p><a href=\"https://github.com/AITRICS/EEG_real_time_seizure_detection/blob/251f104588b0861595a8b3059b92aaf45a7da1e2/builder/models/feature_extractor/psd_feature.py\" target=\"_blank\">https://github.com/AITRICS/EEG_real_time_seizure_detection/blob/251f104588b0861595a8b3059b92aaf45a7da1e2/builder/models/feature_extractor/psd_feature.py</a></p>\n<pre><code>\n                psd1 = self.psd(amp,,)\n                psd2 = self.psd(amp,,)\n                psd3 = self.psd(amp,,)\n                psd4 = self.psd(amp,,)\n                psd5 = self.psd(amp,,)\n                psd6 = self.psd(amp,,)\n                psd7 = self.psd(amp,,)\n\n                psds = torch.stack((psd1, psd2, psd3, psd4, psd5, psd6, psd7))\n                psd_sample.append(psds)\n\n            psds_batch.append(torch.stack(psd_sample))\n\n         torch.stack(psds_batch)\n</code></pre>\n<p>We used<br>\nFFT to transform these sliced data segments into the frequency domain in addition to the time domain and categorized them into eight frequency bands, namely 0.1–4, 4–8,<br>\n8–12, 12–30, 30–50, 50–70, 70–100, and 100–180 Hz.</p>\n<p><strong>Notebooks</strong></p>\n<p>Preprocessing : <a href=\"https://www.kaggle.com/code/gauravbrills/hms-eeg-data-processed-path-multi-band-simple?scriptVersionId=168920925\" target=\"_blank\">https://www.kaggle.com/code/gauravbrills/hms-eeg-data-processed-path-multi-band-simple?scriptVersionId=168920925</a></p>\n<p>Train:<a href=\"https://www.kaggle.com/code/gauravbrills/hms-resnet1d-gru-train-multi-band/notebook?scriptVersionId=168931251\" target=\"_blank\">https://www.kaggle.com/code/gauravbrills/hms-resnet1d-gru-train-multi-band/notebook?scriptVersionId=168931251</a></p>\n<p>Infer: </p>\n<p>Fold 0 : 0.8 so far was not that great so we skipped this appraoch</p>\n<hr>\n<p>2 . <strong>Different feature pairs based on part of brain == WORKED 😃==</strong></p>\n<p><strong>data processed</strong> : <a href=\"https://www.kaggle.com/code/medali1992/hms-eeg-data-processed-path?scriptVersionId=168592399\" target=\"_blank\">https://www.kaggle.com/code/medali1992/hms-eeg-data-processed-path?scriptVersionId=168592399</a></p>\n<p><strong>dataset</strong>: <a href=\"https://www.kaggle.com/datasets/pcjimmmy/hms-eeg-preprocessed-path-v3\" target=\"_blank\">https://www.kaggle.com/datasets/pcjimmmy/hms-eeg-preprocessed-path-v3</a></p>\n<p><strong>dataset all 4 Penta tail</strong> : <a href=\"https://www.kaggle.com/datasets/pcjimmmy/hms-eeg-data-processed-path-v-7-03262024-dataset\" target=\"_blank\">https://www.kaggle.com/datasets/pcjimmmy/hms-eeg-data-processed-path-v-7-03262024-dataset</a> </p>\n<p><strong>&gt;</strong> <a href=\"https://www.kaggle.com/code/medali1992/hms-eeg-data-processed-path\" target=\"_blank\">https://www.kaggle.com/code/medali1992/hms-eeg-data-processed-path</a> </p>\n<p><strong>Train</strong> : <a href=\"https://www.kaggle.com/code/gauravbrills/hms-wavenet-gru-train-v3-diff-feats?scriptVersionId=168621267\" target=\"_blank\">https://www.kaggle.com/code/gauravbrills/hms-wavenet-gru-train-v3-diff-feats?scriptVersionId=168621267</a> </p>\n<p><strong>Train PentaTail :</strong> <a href=\"https://www.kaggle.com/code/gauravbrills/hms-wave-gru-train-penta-tail/edit\" target=\"_blank\">https://www.kaggle.com/code/gauravbrills/hms-wave-gru-train-penta-tail/edit</a></p>\n<p><strong>Infer Stage 2 :</strong><a href=\"https://www.kaggle.com/code/gauravbrills/eeg-wave-gru-strat-folds?scriptVersionId=168858167\" target=\"_blank\">https://www.kaggle.com/code/gauravbrills/eeg-wave-gru-strat-folds?scriptVersionId=168858167</a></p>\n<p><strong>Infer Stage 1 :</strong><a href=\"https://www.kaggle.com/code/gauravbrills/eeg-wave-gru-strat-folds?scriptVersionId=168871190\" target=\"_blank\">https://www.kaggle.com/code/gauravbrills/eeg-wave-gru-strat-folds?scriptVersionId=168871190</a></p>\n<p>stage  1 overall  CV 0.6074094803600332    </p>\n<ul>\n<li>LB stage 2 overall   </li>\n<li>STAGE 2 CV  0.6932664658512089<br>\nLB : -.4-<br>\nPenta Tail : </li>\n<li>Stage  1 CV : 0.6006901876404124 </li>\n<li>LB Stage 2 overall CC 0.6696101739331131***</li>\n<li>Private STAGE 2 : 0.40</li>\n</ul>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F768166%2F619e36cee4a9568fc2cbce6219508372%2FUntitled.png?generation=1712625379808593&amp;alt=media\"></p>\n<pre><code>Pairs=[ (, ), (, ), (, ), (, ),(, ),(, ),\n(, ),(, ),(, ),(, ),(, ),(, ),\n(, ),(, ),(, ),(, ),(, ),(, ),\n(, ),(, ),]\n</code></pre>\n<p><strong>We developer WaveNet and chrononet models that utilizes the features below and concatenates t them at different layers/parts.</strong></p>\n<pre><code>Left part:\n(, ),\n(, ),\n(, ),\n(, ),\n(, ),\n(, ),\n(, ),\n(, ),\n(, ),\nRight part:\n(, ),\n(, ),\n(, ),\n(, ),\n(, ),\n(, ),\n(, ),\n(, ),\n(, ),\n\nFront part:\n(, ),\n(, ),\n(, ),\n(, ),\n\nBack part:\n(, ),\n(, ),\n(, ),\n(, ),\n\nCentral part:\n(, ),\n(, ),\n(, ),\n(, ),\n(, ),\n</code></pre>\n<p>Wavebet blocks layout</p>\n<pre><code> ():\n        \n        x1 = self.model(x[:, :, self.index_dict[(, )]:self.index_dict[(, )]+])\n        x2 = self.model(x[:, :, self.index_dict[(, )]:self.index_dict[(, )]+])\n        x3 = self.model(x[:, :, self.index_dict[(, )]:self.index_dict[(, )]+])\n        x4 = self.model(x[:, :, self.index_dict[(, )]:self.index_dict[(, )]+]) \n        x6 = self.model(x[:, :, self.index_dict[(, )]:self.index_dict[(, )]+])\n        x7 = self.model(x[:, :, self.index_dict[(, )]:self.index_dict[(, )]+]) \n        x9 = self.model(x[:, :, self.index_dict[(, )]:self.index_dict[(, )]+])\n        z1 = torch.mean(torch.stack([x1, x2, x3, x4, x6, x7,   x9]), dim=)\n\n        \n        x1 = self.model(x[:, :, self.index_dict[(, )]:self.index_dict[(, )]+])\n        x2 = self.model(x[:, :, self.index_dict[(, )]:self.index_dict[(, )]+])\n        x3 = self.model(x[:, :, self.index_dict[(, )]:self.index_dict[(, )]+])\n        x4 = self.model(x[:, :, self.index_dict[(, )]:self.index_dict[(, )]+])\n        x5 = self.model(x[:, :, self.index_dict[(, )]:self.index_dict[(, )]+])\n        x6 = self.model(x[:, :, self.index_dict[(, )]:self.index_dict[(, )]+])\n        x7 = self.model(x[:, :, self.index_dict[(, )]:self.index_dict[(, )]+]) \n        x9 = self.model(x[:, :, self.index_dict[(, )]:self.index_dict[(, )]+])\n        z2 = torch.mean(torch.stack([x1, x2, x3, x4, x5, x6, x7,   x9]), dim=)\n\n        \n        x1 = self.model(x[:, :, self.index_dict[(, )]:self.index_dict[(, )]+])\n        x2 = self.model(x[:, :, self.index_dict[(, )]:self.index_dict[(, )]+])\n        x3 = self.model(x[:, :, self.index_dict[(, )]:self.index_dict[(, )]+])\n        x4 = self.model(x[:, :, self.index_dict[(, )]:self.index_dict[(, )]+])\n        z3 = torch.mean(torch.stack([x1, x2, x3, x4]), dim=)\n\n        \n        x1 = self.model(x[:, :, self.index_dict[(, )]:self.index_dict[(, )]+])\n        x2 = self.model(x[:, :, self.index_dict[(, )]:self.index_dict[(, )]+])\n        x3 = self.model(x[:, :, self.index_dict[(, )]:self.index_dict[(, )]+])\n        x4 = self.model(x[:, :, self.index_dict[(, )]:self.index_dict[(, )]+])\n        z4 = torch.mean(torch.stack([x1, x2, x3, x4]), dim=)\n\n        y = torch.cat([z1, z2, z3, z4], dim=) \n</code></pre>\n<p>Chrononet has a similar feature layout just the head is like </p>\n<pre><code> (nn.Module):\n     ():\n        ().__init__()\n        self.inception_block1=InceptionBlock(channel) \n        self.inception_block2=InceptionBlock() \n        self.inception_block3=InceptionBlock() \n        self.gru1 = nn.GRU(input_size = , hidden_size = , batch_first = , bidirectional=) \n        self.gru2 = nn.GRU(input_size = *, hidden_size = , batch_first = , bidirectional=) \n        self.gru3 = nn.GRU(input_size = *, hidden_size = , batch_first = , bidirectional=) \n        self.gru4 = nn.GRU(input_size = *, hidden_size = , batch_first = , bidirectional=) \n        self.relu = nn.ReLU() \n        self.gru_linear=nn.Linear(in_features = , out_features = ) \n        self.flatten = nn.Flatten() \n        self.seqpool = SeqPool()\n        self.fc1 = nn.Linear(,) \n\n     (): \n        x = x.permute(, , )\n        x=self.inception_block1(x) \n        x=self.inception_block2(x) \n        x=self.inception_block3(x) \n        x=x.permute(,,) \n        gru_out1,_=self.gru1(x) \n        gru_out2,_=self.gru2(gru_out1) \n        gru_out=torch.cat((gru_out1, gru_out2), dim = ) \n        gru_out3,_=self.gru3(gru_out)  \n        gru_out = torch.cat((gru_out1, gru_out2, gru_out3), dim = ) \n        gru_out4,_=self.gru4(gru_out) \n        seqpool = self.seqpool(gru_out4)\n\n         seqpool \n</code></pre>\n<p>Features depicted as they are placed as electrodes in the human brain .</p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F768166%2F36024ed86af07b43ed27c1daecbb31b0%2Fbrain%20feats.png?generation=1712625439133816&amp;alt=media\"> </p>",
      "rawMarkdown": "These notes I made for the comp discuss the extraction of frequency band-based features from EEG data and different feature pairs based on different parts of the brain. The document also suggests creating a wavenet model to utilize these features and concatenate them in different layers. We tried tow approaches the first one as per the paper did not work but the second one which was similar to Chris but added more features to divide the EEG by portions of brain in a wavenet and/or chrononet blocks which were then eventually  concatenated .\n\n\n1. **Frequency Band based features extraction == DIDNT WORK ==**\n\nhttps://ieeexplore.ieee.org/stamp/stamp.jsp?arnumber=8910555\n\n**Code reference** : https://github.com/AITRICS/EEG_real_time_seizure_detection/blob/251f104588b0861595a8b3059b92aaf45a7da1e2/builder/data/feature_extraction.py#L173 \n\n**PSD FEATURE 2 ~ feature geneartor**\n\nhttps://github.com/AITRICS/EEG_real_time_seizure_detection/blob/251f104588b0861595a8b3059b92aaf45a7da1e2/builder/models/feature_extractor/psd_feature.py\n\n```python\n# https://ieeexplore.ieee.org/stamp/stamp.jsp?arnumber=8910555\n                psd1 = self.psd(amp,0,4)\n                psd2 = self.psd(amp,4,8)\n                psd3 = self.psd(amp,8,12)\n                psd4 = self.psd(amp,12,30)\n                psd5 = self.psd(amp,30,50)\n                psd6 = self.psd(amp,50,70)\n                psd7 = self.psd(amp,70,100)\n                \n                psds = torch.stack((psd1, psd2, psd3, psd4, psd5, psd6, psd7))\n                psd_sample.append(psds)\n\n            psds_batch.append(torch.stack(psd_sample))\n\n        return torch.stack(psds_batch)\n```\n\nWe used\nFFT to transform these sliced data segments into the frequency domain in addition to the time domain and categorized them into eight frequency bands, namely 0.1–4, 4–8,\n8–12, 12–30, 30–50, 50–70, 70–100, and 100–180 Hz.\n\n**Notebooks**\n\nPreprocessing : https://www.kaggle.com/code/gauravbrills/hms-eeg-data-processed-path-multi-band-simple?scriptVersionId=168920925\n\nTrain:https://www.kaggle.com/code/gauravbrills/hms-resnet1d-gru-train-multi-band/notebook?scriptVersionId=168931251\n\nInfer: \n\nFold 0 : 0.8 so far was not that great so we skipped this appraoch\n\n---\n\n2 . **Different feature pairs based on part of brain == WORKED 😃==**\n\n**data processed** : https://www.kaggle.com/code/medali1992/hms-eeg-data-processed-path?scriptVersionId=168592399\n\n**dataset**: https://www.kaggle.com/datasets/pcjimmmy/hms-eeg-preprocessed-path-v3\n\n**dataset all 4 Penta tail** : https://www.kaggle.com/datasets/pcjimmmy/hms-eeg-data-processed-path-v-7-03262024-dataset \n\n**>** https://www.kaggle.com/code/medali1992/hms-eeg-data-processed-path \n\n**Train** : https://www.kaggle.com/code/gauravbrills/hms-wavenet-gru-train-v3-diff-feats?scriptVersionId=168621267 \n\n**Train PentaTail :** https://www.kaggle.com/code/gauravbrills/hms-wave-gru-train-penta-tail/edit\n\n**Infer Stage 2 :**https://www.kaggle.com/code/gauravbrills/eeg-wave-gru-strat-folds?scriptVersionId=168858167\n\n**Infer Stage 1 :**https://www.kaggle.com/code/gauravbrills/eeg-wave-gru-strat-folds?scriptVersionId=168871190\n\nstage  1 overall  CV 0.6074094803600332    \n- LB stage 2 overall   \n- STAGE 2 CV  0.6932664658512089\nLB : -.4-\nPenta Tail : \n- Stage  1 CV : 0.6006901876404124 \n- LB Stage 2 overall CC 0.6696101739331131***\n- Private STAGE 2 : 0.40\n  \n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F768166%2F619e36cee4a9568fc2cbce6219508372%2FUntitled.png?generation=1712625379808593&alt=media)\n```python\nPairs=[ ('Fp1', 'F7'), ('Fp2', 'F8'), ('F7', 'T3'), ('F8', 'T4'),('T3', 'T5'),('T4', 'T6'),\n('T5', 'O1'),('T6', 'O2'),('T3', 'C3'),('C4', 'T4'),('C3', 'Cz'),('Cz', 'C4'),\n('Fp1', 'F3'),('Fp2', 'F4'),('F3', 'C3'),('F4', 'C4'),('C3', 'P3'),('C4', 'P4'),\n('P3', 'O1'),('P4', 'O2'),]\n```\n\n**We developer WaveNet and chrononet models that utilizes the features below and concatenates t them at different layers/parts.**\n\n```python\nLeft part:\n('Fp1', 'F7'),\n('F7', 'T3'),\n('T3', 'T5'),\n('T5', 'O1'),\n('T3', 'C3'),\n('Fp1', 'F3'),\n('F3', 'C3'),\n('C3', 'P3'),\n('P3', 'O1'),\nRight part:\n('Fp2', 'F8'),\n('F8', 'T4'),\n('T4', 'T6'),\n('T6', 'O2'),\n('C4', 'T4'),\n('Fp2', 'F4'),\n('F4', 'C4'),\n('C4', 'P4'),\n('P4', 'O2'),\n\nFront part:\n('Fp1', 'F7'),\n('Fp2', 'F8'),\n('Fp1', 'F3'),\n('Fp2', 'F4'),\n\nBack part:\n('T5', 'O1'),\n('T6', 'O2'),\n('P3', 'O1'),\n('P4', 'O2'),\n\nCentral part:\n('T3', 'C3'),\n('C3', 'Cz'),\n('Cz', 'C4'),\n('C3', 'P3'),\n('C4', 'P4'),\n```\nWavebet blocks layout\n```python\ndef extract_features(self, x):\n        # Left part\n        x1 = self.model(x[:, :, self.index_dict[('Fp1', 'F7')]:self.index_dict[('Fp1', 'F7')]+1])\n        x2 = self.model(x[:, :, self.index_dict[('F7', 'T3')]:self.index_dict[('F7', 'T3')]+1])\n        x3 = self.model(x[:, :, self.index_dict[('T3', 'T5')]:self.index_dict[('T3', 'T5')]+1])\n        x4 = self.model(x[:, :, self.index_dict[('T5', 'O1')]:self.index_dict[('T5', 'O1')]+1]) \n        x6 = self.model(x[:, :, self.index_dict[('Fp1', 'F3')]:self.index_dict[('Fp1', 'F3')]+1])\n        x7 = self.model(x[:, :, self.index_dict[('F3', 'C3')]:self.index_dict[('F3', 'C3')]+1]) \n        x9 = self.model(x[:, :, self.index_dict[('P3', 'O1')]:self.index_dict[('P3', 'O1')]+1])\n        z1 = torch.mean(torch.stack([x1, x2, x3, x4, x6, x7,   x9]), dim=0)\n\n        # Right part\n        x1 = self.model(x[:, :, self.index_dict[('Fp2', 'F8')]:self.index_dict[('Fp2', 'F8')]+1])\n        x2 = self.model(x[:, :, self.index_dict[('F8', 'T4')]:self.index_dict[('F8', 'T4')]+1])\n        x3 = self.model(x[:, :, self.index_dict[('T4', 'T6')]:self.index_dict[('T4', 'T6')]+1])\n        x4 = self.model(x[:, :, self.index_dict[('T6', 'O2')]:self.index_dict[('T6', 'O2')]+1])\n        x5 = self.model(x[:, :, self.index_dict[('C4', 'T4')]:self.index_dict[('C4', 'T4')]+1])\n        x6 = self.model(x[:, :, self.index_dict[('Fp2', 'F4')]:self.index_dict[('Fp2', 'F4')]+1])\n        x7 = self.model(x[:, :, self.index_dict[('F4', 'C4')]:self.index_dict[('F4', 'C4')]+1]) \n        x9 = self.model(x[:, :, self.index_dict[('P4', 'O2')]:self.index_dict[('P4', 'O2')]+1])\n        z2 = torch.mean(torch.stack([x1, x2, x3, x4, x5, x6, x7,   x9]), dim=0)\n\n        # Front part\n        x1 = self.model(x[:, :, self.index_dict[('Fp1', 'F7')]:self.index_dict[('Fp1', 'F7')]+1])\n        x2 = self.model(x[:, :, self.index_dict[('Fp2', 'F8')]:self.index_dict[('Fp2', 'F8')]+1])\n        x3 = self.model(x[:, :, self.index_dict[('Fp1', 'F3')]:self.index_dict[('Fp1', 'F3')]+1])\n        x4 = self.model(x[:, :, self.index_dict[('Fp2', 'F4')]:self.index_dict[('Fp2', 'F4')]+1])\n        z3 = torch.mean(torch.stack([x1, x2, x3, x4]), dim=0)\n\n        # Back part\n        x1 = self.model(x[:, :, self.index_dict[('T5', 'O1')]:self.index_dict[('T5', 'O1')]+1])\n        x2 = self.model(x[:, :, self.index_dict[('T6', 'O2')]:self.index_dict[('T6', 'O2')]+1])\n        x3 = self.model(x[:, :, self.index_dict[('P3', 'O1')]:self.index_dict[('P3', 'O1')]+1])\n        x4 = self.model(x[:, :, self.index_dict[('P4', 'O2')]:self.index_dict[('P4', 'O2')]+1])\n        z4 = torch.mean(torch.stack([x1, x2, x3, x4]), dim=0)\n\n        y = torch.cat([z1, z2, z3, z4], dim=1) \n\n``` \n\nChrononet has a similar feature layout just the head is like \n\n```python\nclass ChronoNet(nn.Module):\n    def __init__(self, channel):\n        super().__init__()\n        self.inception_block1=InceptionBlock(channel) # 1st Inception Block\n        self.inception_block2=InceptionBlock(96) # 2nd Inception Block\n        self.inception_block3=InceptionBlock(96) # 3rd Inception Block\n        self.gru1 = nn.GRU(input_size = 96, hidden_size = 32, batch_first = True, bidirectional=True) # 1st GRU layer\n        self.gru2 = nn.GRU(input_size = 32*2, hidden_size = 32, batch_first = True, bidirectional=True) # 2nd GRU layer\n        self.gru3 = nn.GRU(input_size = 64*2, hidden_size = 32, batch_first = True, bidirectional=True) # 3rd GRU layer\n        self.gru4 = nn.GRU(input_size = 96*2, hidden_size = 32, batch_first = True, bidirectional=True) # 4th GRU layer\n        self.relu = nn.ReLU() # ReLU Activation Function\n        self.gru_linear=nn.Linear(in_features = 1250, out_features = 1) # Linear Layer for the 4th GRU\n        self.flatten = nn.Flatten() # Flattening Layer\n        self.seqpool = SeqPool(64)\n        self.fc1 = nn.Linear(32,6) # Fully Connected Layer / Output Layer.\n\n    def forward(self,x): # Defining the feed forward function\n        x = x.permute(0, 2, 1)\n        x=self.inception_block1(x) # Fed to Inception Block 1\n        x=self.inception_block2(x) # Fed to Inception Block 2\n        x=self.inception_block3(x) # Fed to Inception Block 3\n        x=x.permute(0,2,1) # Permuted for GRU layers\n        gru_out1,_=self.gru1(x) # Fed into GRU layer 1\n        gru_out2,_=self.gru2(gru_out1) # Fed into GRU layer 2\n        gru_out=torch.cat((gru_out1, gru_out2), dim = 2) # Concatenated, defining the skip connection\n        gru_out3,_=self.gru3(gru_out)  # Fed into GRU layer 3\n        gru_out = torch.cat((gru_out1, gru_out2, gru_out3), dim = 2) #C Concatenated, defining the next 2 skip connections\n        gru_out4,_=self.gru4(gru_out) # Fed into the 4th GRU Layer\n        seqpool = self.seqpool(gru_out4)\n        \n        return seqpool # Output\n```\n\n\nFeatures depicted as they are placed as electrodes in the human brain .\n\n ![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F768166%2F36024ed86af07b43ed27c1daecbb31b0%2Fbrain%20feats.png?generation=1712625439133816&alt=media) ",
      "votes": 6
    }
  ],
  "comments": [],
  "raw_markdown_by_id": {
    "2742583": "These notes I made for the comp discuss the extraction of frequency band-based features from EEG data and different feature pairs based on different parts of the brain. The document also suggests creating a wavenet model to utilize these features and concatenate them in different layers. We tried tow approaches the first one as per the paper did not work but the second one which was similar to Chris but added more features to divide the EEG by portions of brain in a wavenet and/or chrononet blocks which were then eventually  concatenated .\n\n\n1. **Frequency Band based features extraction == DIDNT WORK ==**\n\nhttps://ieeexplore.ieee.org/stamp/stamp.jsp?arnumber=8910555\n\n**Code reference** : https://github.com/AITRICS/EEG_real_time_seizure_detection/blob/251f104588b0861595a8b3059b92aaf45a7da1e2/builder/data/feature_extraction.py#L173 \n\n**PSD FEATURE 2 ~ feature geneartor**\n\nhttps://github.com/AITRICS/EEG_real_time_seizure_detection/blob/251f104588b0861595a8b3059b92aaf45a7da1e2/builder/models/feature_extractor/psd_feature.py\n\n```python\n# https://ieeexplore.ieee.org/stamp/stamp.jsp?arnumber=8910555\n                psd1 = self.psd(amp,0,4)\n                psd2 = self.psd(amp,4,8)\n                psd3 = self.psd(amp,8,12)\n                psd4 = self.psd(amp,12,30)\n                psd5 = self.psd(amp,30,50)\n                psd6 = self.psd(amp,50,70)\n                psd7 = self.psd(amp,70,100)\n                \n                psds = torch.stack((psd1, psd2, psd3, psd4, psd5, psd6, psd7))\n                psd_sample.append(psds)\n\n            psds_batch.append(torch.stack(psd_sample))\n\n        return torch.stack(psds_batch)\n```\n\nWe used\nFFT to transform these sliced data segments into the frequency domain in addition to the time domain and categorized them into eight frequency bands, namely 0.1–4, 4–8,\n8–12, 12–30, 30–50, 50–70, 70–100, and 100–180 Hz.\n\n**Notebooks**\n\nPreprocessing : https://www.kaggle.com/code/gauravbrills/hms-eeg-data-processed-path-multi-band-simple?scriptVersionId=168920925\n\nTrain:https://www.kaggle.com/code/gauravbrills/hms-resnet1d-gru-train-multi-band/notebook?scriptVersionId=168931251\n\nInfer: \n\nFold 0 : 0.8 so far was not that great so we skipped this appraoch\n\n---\n\n2 . **Different feature pairs based on part of brain == WORKED 😃==**\n\n**data processed** : https://www.kaggle.com/code/medali1992/hms-eeg-data-processed-path?scriptVersionId=168592399\n\n**dataset**: https://www.kaggle.com/datasets/pcjimmmy/hms-eeg-preprocessed-path-v3\n\n**dataset all 4 Penta tail** : https://www.kaggle.com/datasets/pcjimmmy/hms-eeg-data-processed-path-v-7-03262024-dataset \n\n**>** https://www.kaggle.com/code/medali1992/hms-eeg-data-processed-path \n\n**Train** : https://www.kaggle.com/code/gauravbrills/hms-wavenet-gru-train-v3-diff-feats?scriptVersionId=168621267 \n\n**Train PentaTail :** https://www.kaggle.com/code/gauravbrills/hms-wave-gru-train-penta-tail/edit\n\n**Infer Stage 2 :**https://www.kaggle.com/code/gauravbrills/eeg-wave-gru-strat-folds?scriptVersionId=168858167\n\n**Infer Stage 1 :**https://www.kaggle.com/code/gauravbrills/eeg-wave-gru-strat-folds?scriptVersionId=168871190\n\nstage  1 overall  CV 0.6074094803600332    \n- LB stage 2 overall   \n- STAGE 2 CV  0.6932664658512089\nLB : -.4-\nPenta Tail : \n- Stage  1 CV : 0.6006901876404124 \n- LB Stage 2 overall CC 0.6696101739331131***\n- Private STAGE 2 : 0.40\n  \n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F768166%2F619e36cee4a9568fc2cbce6219508372%2FUntitled.png?generation=1712625379808593&alt=media)\n```python\nPairs=[ ('Fp1', 'F7'), ('Fp2', 'F8'), ('F7', 'T3'), ('F8', 'T4'),('T3', 'T5'),('T4', 'T6'),\n('T5', 'O1'),('T6', 'O2'),('T3', 'C3'),('C4', 'T4'),('C3', 'Cz'),('Cz', 'C4'),\n('Fp1', 'F3'),('Fp2', 'F4'),('F3', 'C3'),('F4', 'C4'),('C3', 'P3'),('C4', 'P4'),\n('P3', 'O1'),('P4', 'O2'),]\n```\n\n**We developer WaveNet and chrononet models that utilizes the features below and concatenates t them at different layers/parts.**\n\n```python\nLeft part:\n('Fp1', 'F7'),\n('F7', 'T3'),\n('T3', 'T5'),\n('T5', 'O1'),\n('T3', 'C3'),\n('Fp1', 'F3'),\n('F3', 'C3'),\n('C3', 'P3'),\n('P3', 'O1'),\nRight part:\n('Fp2', 'F8'),\n('F8', 'T4'),\n('T4', 'T6'),\n('T6', 'O2'),\n('C4', 'T4'),\n('Fp2', 'F4'),\n('F4', 'C4'),\n('C4', 'P4'),\n('P4', 'O2'),\n\nFront part:\n('Fp1', 'F7'),\n('Fp2', 'F8'),\n('Fp1', 'F3'),\n('Fp2', 'F4'),\n\nBack part:\n('T5', 'O1'),\n('T6', 'O2'),\n('P3', 'O1'),\n('P4', 'O2'),\n\nCentral part:\n('T3', 'C3'),\n('C3', 'Cz'),\n('Cz', 'C4'),\n('C3', 'P3'),\n('C4', 'P4'),\n```\nWavebet blocks layout\n```python\ndef extract_features(self, x):\n        # Left part\n        x1 = self.model(x[:, :, self.index_dict[('Fp1', 'F7')]:self.index_dict[('Fp1', 'F7')]+1])\n        x2 = self.model(x[:, :, self.index_dict[('F7', 'T3')]:self.index_dict[('F7', 'T3')]+1])\n        x3 = self.model(x[:, :, self.index_dict[('T3', 'T5')]:self.index_dict[('T3', 'T5')]+1])\n        x4 = self.model(x[:, :, self.index_dict[('T5', 'O1')]:self.index_dict[('T5', 'O1')]+1]) \n        x6 = self.model(x[:, :, self.index_dict[('Fp1', 'F3')]:self.index_dict[('Fp1', 'F3')]+1])\n        x7 = self.model(x[:, :, self.index_dict[('F3', 'C3')]:self.index_dict[('F3', 'C3')]+1]) \n        x9 = self.model(x[:, :, self.index_dict[('P3', 'O1')]:self.index_dict[('P3', 'O1')]+1])\n        z1 = torch.mean(torch.stack([x1, x2, x3, x4, x6, x7,   x9]), dim=0)\n\n        # Right part\n        x1 = self.model(x[:, :, self.index_dict[('Fp2', 'F8')]:self.index_dict[('Fp2', 'F8')]+1])\n        x2 = self.model(x[:, :, self.index_dict[('F8', 'T4')]:self.index_dict[('F8', 'T4')]+1])\n        x3 = self.model(x[:, :, self.index_dict[('T4', 'T6')]:self.index_dict[('T4', 'T6')]+1])\n        x4 = self.model(x[:, :, self.index_dict[('T6', 'O2')]:self.index_dict[('T6', 'O2')]+1])\n        x5 = self.model(x[:, :, self.index_dict[('C4', 'T4')]:self.index_dict[('C4', 'T4')]+1])\n        x6 = self.model(x[:, :, self.index_dict[('Fp2', 'F4')]:self.index_dict[('Fp2', 'F4')]+1])\n        x7 = self.model(x[:, :, self.index_dict[('F4', 'C4')]:self.index_dict[('F4', 'C4')]+1]) \n        x9 = self.model(x[:, :, self.index_dict[('P4', 'O2')]:self.index_dict[('P4', 'O2')]+1])\n        z2 = torch.mean(torch.stack([x1, x2, x3, x4, x5, x6, x7,   x9]), dim=0)\n\n        # Front part\n        x1 = self.model(x[:, :, self.index_dict[('Fp1', 'F7')]:self.index_dict[('Fp1', 'F7')]+1])\n        x2 = self.model(x[:, :, self.index_dict[('Fp2', 'F8')]:self.index_dict[('Fp2', 'F8')]+1])\n        x3 = self.model(x[:, :, self.index_dict[('Fp1', 'F3')]:self.index_dict[('Fp1', 'F3')]+1])\n        x4 = self.model(x[:, :, self.index_dict[('Fp2', 'F4')]:self.index_dict[('Fp2', 'F4')]+1])\n        z3 = torch.mean(torch.stack([x1, x2, x3, x4]), dim=0)\n\n        # Back part\n        x1 = self.model(x[:, :, self.index_dict[('T5', 'O1')]:self.index_dict[('T5', 'O1')]+1])\n        x2 = self.model(x[:, :, self.index_dict[('T6', 'O2')]:self.index_dict[('T6', 'O2')]+1])\n        x3 = self.model(x[:, :, self.index_dict[('P3', 'O1')]:self.index_dict[('P3', 'O1')]+1])\n        x4 = self.model(x[:, :, self.index_dict[('P4', 'O2')]:self.index_dict[('P4', 'O2')]+1])\n        z4 = torch.mean(torch.stack([x1, x2, x3, x4]), dim=0)\n\n        y = torch.cat([z1, z2, z3, z4], dim=1) \n\n``` \n\nChrononet has a similar feature layout just the head is like \n\n```python\nclass ChronoNet(nn.Module):\n    def __init__(self, channel):\n        super().__init__()\n        self.inception_block1=InceptionBlock(channel) # 1st Inception Block\n        self.inception_block2=InceptionBlock(96) # 2nd Inception Block\n        self.inception_block3=InceptionBlock(96) # 3rd Inception Block\n        self.gru1 = nn.GRU(input_size = 96, hidden_size = 32, batch_first = True, bidirectional=True) # 1st GRU layer\n        self.gru2 = nn.GRU(input_size = 32*2, hidden_size = 32, batch_first = True, bidirectional=True) # 2nd GRU layer\n        self.gru3 = nn.GRU(input_size = 64*2, hidden_size = 32, batch_first = True, bidirectional=True) # 3rd GRU layer\n        self.gru4 = nn.GRU(input_size = 96*2, hidden_size = 32, batch_first = True, bidirectional=True) # 4th GRU layer\n        self.relu = nn.ReLU() # ReLU Activation Function\n        self.gru_linear=nn.Linear(in_features = 1250, out_features = 1) # Linear Layer for the 4th GRU\n        self.flatten = nn.Flatten() # Flattening Layer\n        self.seqpool = SeqPool(64)\n        self.fc1 = nn.Linear(32,6) # Fully Connected Layer / Output Layer.\n\n    def forward(self,x): # Defining the feed forward function\n        x = x.permute(0, 2, 1)\n        x=self.inception_block1(x) # Fed to Inception Block 1\n        x=self.inception_block2(x) # Fed to Inception Block 2\n        x=self.inception_block3(x) # Fed to Inception Block 3\n        x=x.permute(0,2,1) # Permuted for GRU layers\n        gru_out1,_=self.gru1(x) # Fed into GRU layer 1\n        gru_out2,_=self.gru2(gru_out1) # Fed into GRU layer 2\n        gru_out=torch.cat((gru_out1, gru_out2), dim = 2) # Concatenated, defining the skip connection\n        gru_out3,_=self.gru3(gru_out)  # Fed into GRU layer 3\n        gru_out = torch.cat((gru_out1, gru_out2, gru_out3), dim = 2) #C Concatenated, defining the next 2 skip connections\n        gru_out4,_=self.gru4(gru_out) # Fed into the 4th GRU Layer\n        seqpool = self.seqpool(gru_out4)\n        \n        return seqpool # Output\n```\n\n\nFeatures depicted as they are placed as electrodes in the human brain .\n\n ![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F768166%2F36024ed86af07b43ed27c1daecbb31b0%2Fbrain%20feats.png?generation=1712625439133816&alt=media) "
  }
}