{
  "id": 479001,
  "title": "Converting non-competition EEG signals to 10-minute spectrograms",
  "url": "/competitions/hms-harmful-brain-activity-classification/discussion/479001",
  "author_name": "",
  "post_date": "2024-02-22T20:38:55.679778200Z",
  "votes": 26,
  "comment_count": 5,
  "views": 0,
  "content": "<p>I've found some EEG signals with labeled seizures online (hoping to release the processed data soon). I was able to resample the data to 200 Hz, then create a 10-minute spectrogram. Below is the code I used to create the spectrograms. When I select frequencies between 0.5 and 20 Hz, I get nearly perfect agreement with the frequencies in the competition spectrogram column names (LL_0.59, LL_0.78, LL_0.98, etc), giving dimensions 100x300 for each spectrogram. However, a few rounded frequencies do not align with column names, suggesting my parameters might be slightly different than those used to create competition spectrograms.</p>\n<p>While the slight difference in frequency is not a huge concern, I would like the 10-minute spectrograms to resemble the competition spectrograms as best as possible. Does anyone have a suggestion for modifying the code below for better agreement?</p>\n<pre><code> scipy.signal  spectrogram\n\nfrequencies, times, Sxx = spectrogram(x, fs=sr, window=, nperseg=, noverlap=, nfft=, detrend=, scaling=, mode=)\n</code></pre>\n<p>Competition spectrogram:</p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F3223907%2F4e408a0761be2a8fe510d77cb5e6bf2c%2FScreenshot%202024-02-22%20at%2012.40.41PM.png?generation=1708634495240640&amp;alt=media\"></p>\n<p>My spectrograms:</p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F3223907%2Fe26632f64b94aaf90d37ded40c11cd71%2FScreenshot%202024-02-22%20at%2012.40.32PM.png?generation=1708634519026709&amp;alt=media\"></p>",
  "messages": [
    {
      "id": "2664155",
      "postDate": "02/22/2024 20:38:55",
      "content": "<p>I've found some EEG signals with labeled seizures online (hoping to release the processed data soon). I was able to resample the data to 200 Hz, then create a 10-minute spectrogram. Below is the code I used to create the spectrograms. When I select frequencies between 0.5 and 20 Hz, I get nearly perfect agreement with the frequencies in the competition spectrogram column names (LL_0.59, LL_0.78, LL_0.98, etc), giving dimensions 100x300 for each spectrogram. However, a few rounded frequencies do not align with column names, suggesting my parameters might be slightly different than those used to create competition spectrograms.</p>\n<p>While the slight difference in frequency is not a huge concern, I would like the 10-minute spectrograms to resemble the competition spectrograms as best as possible. Does anyone have a suggestion for modifying the code below for better agreement?</p>\n<pre><code> scipy.signal  spectrogram\n\nfrequencies, times, Sxx = spectrogram(x, fs=sr, window=, nperseg=, noverlap=, nfft=, detrend=, scaling=, mode=)\n</code></pre>\n<p>Competition spectrogram:</p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F3223907%2F4e408a0761be2a8fe510d77cb5e6bf2c%2FScreenshot%202024-02-22%20at%2012.40.41PM.png?generation=1708634495240640&amp;alt=media\"></p>\n<p>My spectrograms:</p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F3223907%2Fe26632f64b94aaf90d37ded40c11cd71%2FScreenshot%202024-02-22%20at%2012.40.32PM.png?generation=1708634519026709&amp;alt=media\"></p>",
      "rawMarkdown": "I've found some EEG signals with labeled seizures online (hoping to release the processed data soon). I was able to resample the data to 200 Hz, then create a 10-minute spectrogram. Below is the code I used to create the spectrograms. When I select frequencies between 0.5 and 20 Hz, I get nearly perfect agreement with the frequencies in the competition spectrogram column names (LL_0.59, LL_0.78, LL_0.98, etc), giving dimensions 100x300 for each spectrogram. However, a few rounded frequencies do not align with column names, suggesting my parameters might be slightly different than those used to create competition spectrograms.\n\nWhile the slight difference in frequency is not a huge concern, I would like the 10-minute spectrograms to resemble the competition spectrograms as best as possible. Does anyone have a suggestion for modifying the code below for better agreement?\n\n\n```python\nfrom scipy.signal import spectrogram\n\nfrequencies, times, Sxx = spectrogram(x, fs=sr, window='hann', nperseg=400, noverlap=0, nfft=1024, detrend=False, scaling='density', mode='magnitude')\n```\nCompetition spectrogram:\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F3223907%2F4e408a0761be2a8fe510d77cb5e6bf2c%2FScreenshot%202024-02-22%20at%2012.40.41PM.png?generation=1708634495240640&alt=media)\n\nMy spectrograms:\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F3223907%2Fe26632f64b94aaf90d37ded40c11cd71%2FScreenshot%202024-02-22%20at%2012.40.32PM.png?generation=1708634519026709&alt=media)",
      "votes": null
    },
    {
      "id": "2664192",
      "postDate": "02/22/2024 21:10:37",
      "content": "<p>Your work is impressive! </p>\n<p>I'm particularly impressed by how similar your generated spectrums are to the competition's. I will take some time (if possible) to test your spectrums and see if they boost performance.</p>",
      "rawMarkdown": "Your work is impressive! \n\nI'm particularly impressed by how similar your generated spectrums are to the competition's. I will take some time (if possible) to test your spectrums and see if they boost performance.",
      "votes": null
    },
    {
      "id": "2664453",
      "postDate": "02/23/2024 03:00:54",
      "content": "<p>Nice job, they look similar. How do you create the LL montage? Do you create 4 spectrograms for the 4 differences then average those 4 spectrograms to make 1 spectrogram like my formula <a href=\"https://www.kaggle.com/competitions/hms-harmful-brain-activity-classification/discussion/469760\" target=\"_blank\">here</a></p>",
      "rawMarkdown": "Nice job, they look similar. How do you create the LL montage? Do you create 4 spectrograms for the 4 differences then average those 4 spectrograms to make 1 spectrogram like my formula [here][1]\n\n[1]: https://www.kaggle.com/competitions/hms-harmful-brain-activity-classification/discussion/469760",
      "votes": null
    },
    {
      "id": "2664518",
      "postDate": "02/23/2024 04:53:57",
      "content": "<p>Thanks! Yes, I modified your code to create the spectrograms. Thanks again for sharing your insights. I'll publish this dataset soon</p>",
      "rawMarkdown": "Thanks! Yes, I modified your code to create the spectrograms. Thanks again for sharing your insights. I'll publish this dataset soon",
      "votes": null
    },
    {
      "id": "2664916",
      "postDate": "02/23/2024 09:42:08",
      "content": "<p>Hey, a query, what do you mean by non competition EEG signals? Are you telling there is supplementary data available?</p>",
      "rawMarkdown": "Hey, a query, what do you mean by non competition EEG signals? Are you telling there is supplementary data available?",
      "votes": null
    },
    {
      "id": "2665218",
      "postDate": "02/23/2024 14:26:38",
      "content": "<p>You can find various EEG datasets online, but not all of them relate to harmful brain activity </p>",
      "rawMarkdown": "You can find various EEG datasets online, but not all of them relate to harmful brain activity",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 2664192,
      "author_name": "minhsienweng",
      "author_url": "",
      "post_date": "02/22/2024 21:10:37",
      "content": "<p>Your work is impressive! </p>\n<p>I'm particularly impressed by how similar your generated spectrums are to the competition's. I will take some time (if possible) to test your spectrums and see if they boost performance.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 2664453,
      "author_name": "cdeotte",
      "author_url": "",
      "post_date": "02/23/2024 03:00:54",
      "content": "<p>Nice job, they look similar. How do you create the LL montage? Do you create 4 spectrograms for the 4 differences then average those 4 spectrograms to make 1 spectrogram like my formula <a href=\"https://www.kaggle.com/competitions/hms-harmful-brain-activity-classification/discussion/469760\" target=\"_blank\">here</a></p>",
      "votes": null,
      "replies": [
        {
          "id": 2664518,
          "author_name": "seanbearden",
          "author_url": "",
          "post_date": "02/23/2024 04:53:57",
          "content": "<p>Thanks! Yes, I modified your code to create the spectrograms. Thanks again for sharing your insights. I'll publish this dataset soon</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 2664916,
      "author_name": "chaudharypriyanshu",
      "author_url": "",
      "post_date": "02/23/2024 09:42:08",
      "content": "<p>Hey, a query, what do you mean by non competition EEG signals? Are you telling there is supplementary data available?</p>",
      "votes": null,
      "replies": [
        {
          "id": 2665218,
          "author_name": "seanbearden",
          "author_url": "",
          "post_date": "02/23/2024 14:26:38",
          "content": "<p>You can find various EEG datasets online, but not all of them relate to harmful brain activity </p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "2664155": "I've found some EEG signals with labeled seizures online (hoping to release the processed data soon). I was able to resample the data to 200 Hz, then create a 10-minute spectrogram. Below is the code I used to create the spectrograms. When I select frequencies between 0.5 and 20 Hz, I get nearly perfect agreement with the frequencies in the competition spectrogram column names (LL_0.59, LL_0.78, LL_0.98, etc), giving dimensions 100x300 for each spectrogram. However, a few rounded frequencies do not align with column names, suggesting my parameters might be slightly different than those used to create competition spectrograms.\n\nWhile the slight difference in frequency is not a huge concern, I would like the 10-minute spectrograms to resemble the competition spectrograms as best as possible. Does anyone have a suggestion for modifying the code below for better agreement?\n\n\n```python\nfrom scipy.signal import spectrogram\n\nfrequencies, times, Sxx = spectrogram(x, fs=sr, window='hann', nperseg=400, noverlap=0, nfft=1024, detrend=False, scaling='density', mode='magnitude')\n```\nCompetition spectrogram:\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F3223907%2F4e408a0761be2a8fe510d77cb5e6bf2c%2FScreenshot%202024-02-22%20at%2012.40.41PM.png?generation=1708634495240640&alt=media)\n\nMy spectrograms:\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F3223907%2Fe26632f64b94aaf90d37ded40c11cd71%2FScreenshot%202024-02-22%20at%2012.40.32PM.png?generation=1708634519026709&alt=media)",
    "2664192": "Your work is impressive! \n\nI'm particularly impressed by how similar your generated spectrums are to the competition's. I will take some time (if possible) to test your spectrums and see if they boost performance.",
    "2664453": "Nice job, they look similar. How do you create the LL montage? Do you create 4 spectrograms for the 4 differences then average those 4 spectrograms to make 1 spectrogram like my formula [here][1]\n\n[1]: https://www.kaggle.com/competitions/hms-harmful-brain-activity-classification/discussion/469760",
    "2664518": "Thanks! Yes, I modified your code to create the spectrograms. Thanks again for sharing your insights. I'll publish this dataset soon",
    "2664916": "Hey, a query, what do you mean by non competition EEG signals? Are you telling there is supplementary data available?",
    "2665218": "You can find various EEG datasets online, but not all of them relate to harmful brain activity"
  },
  "source": "meta"
}