{
  "id": 468634,
  "title": "Faulty spectrogram and EEG/EKG data? (Part II)",
  "url": "/competitions/hms-harmful-brain-activity-classification/discussion/468634",
  "author_name": "",
  "post_date": "2024-01-17T11:41:51.347619100Z",
  "votes": 22,
  "comment_count": 4,
  "views": 0,
  "content": "<p>Hi <a href=\"https://www.kaggle.com/sohier\" target=\"_blank\">@sohier</a> ,</p>\n<p>In addition to the data issues I have raised in <a href=\"https://www.kaggle.com/competitions/hms-harmful-brain-activity-classification/discussion/467909\" target=\"_blank\">this previous post</a>, I would like to bring to your attention other potential issues with the data that I found while performing some basic EDA. You will be able to reproduce the issues I will raise by running <a href=\"https://www.kaggle.com/code/patrob/check-eeg-ekg-strange-values\" target=\"_blank\">this notebook</a>.</p>\n<p><strong>EEG 1457334423</strong></p>\n<p>I flagged this EEG file in my previous post as one that contained implausible values. In fact, all the EEG channels for this file are equal to 0.16, while the EKG data is all 0.0. Some explanation can be found when examining its accompanying spectrogram (shown below): the EEG starts at the 264th second of this spectrogram, which corresponds to value 132 on the scale of the spectrogram. That region is blank, while the left half of the spectrogram is much more informative.</p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F3537669%2F846dd3921d280d3713a5ea4e1711b948%2F1659812292-74-2494769356.png?generation=1705488172451061&amp;alt=media\"></p>\n<p>Question: was this choice of EEG window deliberate (and pointless, apart from testing for edge cases) or was it an accident? Should we just ignore this sample?</p>\n<p><strong>Very large EEG value ranges</strong></p>\n<p>After researching for the topic of this competition, I found that a typical adult human EEG signal is about 10 μV to 100 μV in amplitude (<a href=\"https://en.wikipedia.org/wiki/Electroencephalography\" target=\"_blank\">Wikipedia</a>); that seizures would vary in amplitude somewhere between 400 μV and 1000 μV (from looking at the EEG files); that certain human artifacts (eye movement, etc.) could display spikes up to 1000 μV (at least for jaw clenching, according to <a href=\"https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0290446\" target=\"_blank\">this paper</a>. Also, the Wikipedia page seems to suggest that other types of artefacts, like bad electrode connections on the scalp, could cause spikes much greater than 1000 μV in amplitude (as shown in the graph \"Common artifacts in human EEG\" in the section Normal Activity).</p>\n<p>However, I am a bit perplexed by the high number of EEG files which contain value ranges (max <em>minus</em> min) greater than 2000 μV (amplitude should be measured from 0, hence, the range I chose is ~2 * 1000 μV). In fact, the results of my notebook indicate that 5108 EEG files show value ranges greater than 2000 μV (29.89% of all EEG files). If I apply a 10000 μV (or 10 mV) threshold, there are still 1867 EEG files (10.93%) exceeding that threshold. The highest value range I found was for eeg_id 1969027192: 123393 μV or 0.1234 V (could almost qualify as a tiny battery).</p>\n<p>Questions: <br>\n1- Are the EEG files containing high value ranges due solely to the presence of external artifacts or due to errors in preparing the files for the competition?<br>\n2- I made the assumption that the values in the EEG files were expressed in μV. Is my assumption correct?</p>\n<p><strong>EKGs with standard deviation = 0</strong></p>\n<p>I also examined the EKG values contained in the EEG files. I found 78 files where all the EKG values were equal to 0 and, as a result, had a standard deviation equal to 0. Further, I found another 12 files where all the EKG values were equal to 9999, again leading to a standard deviation = 0.</p>\n<p>Question:<br>\nAre the EKG values for these files the result of a manipulation error or simply that there were no valid EKG values for these patient samples?</p>\n<p><strong>Very large EKG value ranges</strong></p>\n<p>Various references I looked at estimate the maximal normal EKG amplitude to be somewhere between 2.5 mV and 5 mV (2500 μV and 5000 μV). I calculated the EKG value range for all the EEG files and found several that were well in excess of these values. Specifically, if I use a 10000 μV benchmark for the EKG value range (max <em>minus</em> min), I found that there are 1600 EEG files that have EKG value ranges exceeding that benchmark. Further, there are 12 EEG files that exhibit EKG value ranges in excess of 1000000 μV (or 1 volt). The highest value range I found was for eeg_id 1076057868: 2451159 μV, or nearly 2.5 V, roughly the voltage of a watch battery.</p>\n<p>Questions: <br>\n1- Are the EEG files containing high EKG value ranges due solely to the presence of external artifacts or due to errors in preparing the files for the competition?<br>\n2- I made the assumption that the EKG values in the EEG files were expressed in μV. Is my assumption correct?</p>\n<p>All the potential issues I have reported here and in my previous post <strong>affect a total of 39073 samples in the dataset</strong>, or <strong>36.6%</strong>. If these are actual issues, I would suspect that the same issues would also affect the test dataset; that would mean that participants are currently building and testing models on bad data, to be evaluated on potentially and equally bad data. Once again, could you please clarify and let us know: 1- if this is something you should/can fix; 2- if yes, how long it would take for an update; 3- if not, how we should deal with this issue going forward (e.g. ignoring the faulty files?).</p>",
  "messages": [
    {
      "id": "2606011",
      "postDate": "01/17/2024 11:41:51",
      "content": "<p>Hi <a href=\"https://www.kaggle.com/sohier\" target=\"_blank\">@sohier</a> ,</p>\n<p>In addition to the data issues I have raised in <a href=\"https://www.kaggle.com/competitions/hms-harmful-brain-activity-classification/discussion/467909\" target=\"_blank\">this previous post</a>, I would like to bring to your attention other potential issues with the data that I found while performing some basic EDA. You will be able to reproduce the issues I will raise by running <a href=\"https://www.kaggle.com/code/patrob/check-eeg-ekg-strange-values\" target=\"_blank\">this notebook</a>.</p>\n<p><strong>EEG 1457334423</strong></p>\n<p>I flagged this EEG file in my previous post as one that contained implausible values. In fact, all the EEG channels for this file are equal to 0.16, while the EKG data is all 0.0. Some explanation can be found when examining its accompanying spectrogram (shown below): the EEG starts at the 264th second of this spectrogram, which corresponds to value 132 on the scale of the spectrogram. That region is blank, while the left half of the spectrogram is much more informative.</p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F3537669%2F846dd3921d280d3713a5ea4e1711b948%2F1659812292-74-2494769356.png?generation=1705488172451061&amp;alt=media\"></p>\n<p>Question: was this choice of EEG window deliberate (and pointless, apart from testing for edge cases) or was it an accident? Should we just ignore this sample?</p>\n<p><strong>Very large EEG value ranges</strong></p>\n<p>After researching for the topic of this competition, I found that a typical adult human EEG signal is about 10 μV to 100 μV in amplitude (<a href=\"https://en.wikipedia.org/wiki/Electroencephalography\" target=\"_blank\">Wikipedia</a>); that seizures would vary in amplitude somewhere between 400 μV and 1000 μV (from looking at the EEG files); that certain human artifacts (eye movement, etc.) could display spikes up to 1000 μV (at least for jaw clenching, according to <a href=\"https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0290446\" target=\"_blank\">this paper</a>. Also, the Wikipedia page seems to suggest that other types of artefacts, like bad electrode connections on the scalp, could cause spikes much greater than 1000 μV in amplitude (as shown in the graph \"Common artifacts in human EEG\" in the section Normal Activity).</p>\n<p>However, I am a bit perplexed by the high number of EEG files which contain value ranges (max <em>minus</em> min) greater than 2000 μV (amplitude should be measured from 0, hence, the range I chose is ~2 * 1000 μV). In fact, the results of my notebook indicate that 5108 EEG files show value ranges greater than 2000 μV (29.89% of all EEG files). If I apply a 10000 μV (or 10 mV) threshold, there are still 1867 EEG files (10.93%) exceeding that threshold. The highest value range I found was for eeg_id 1969027192: 123393 μV or 0.1234 V (could almost qualify as a tiny battery).</p>\n<p>Questions: <br>\n1- Are the EEG files containing high value ranges due solely to the presence of external artifacts or due to errors in preparing the files for the competition?<br>\n2- I made the assumption that the values in the EEG files were expressed in μV. Is my assumption correct?</p>\n<p><strong>EKGs with standard deviation = 0</strong></p>\n<p>I also examined the EKG values contained in the EEG files. I found 78 files where all the EKG values were equal to 0 and, as a result, had a standard deviation equal to 0. Further, I found another 12 files where all the EKG values were equal to 9999, again leading to a standard deviation = 0.</p>\n<p>Question:<br>\nAre the EKG values for these files the result of a manipulation error or simply that there were no valid EKG values for these patient samples?</p>\n<p><strong>Very large EKG value ranges</strong></p>\n<p>Various references I looked at estimate the maximal normal EKG amplitude to be somewhere between 2.5 mV and 5 mV (2500 μV and 5000 μV). I calculated the EKG value range for all the EEG files and found several that were well in excess of these values. Specifically, if I use a 10000 μV benchmark for the EKG value range (max <em>minus</em> min), I found that there are 1600 EEG files that have EKG value ranges exceeding that benchmark. Further, there are 12 EEG files that exhibit EKG value ranges in excess of 1000000 μV (or 1 volt). The highest value range I found was for eeg_id 1076057868: 2451159 μV, or nearly 2.5 V, roughly the voltage of a watch battery.</p>\n<p>Questions: <br>\n1- Are the EEG files containing high EKG value ranges due solely to the presence of external artifacts or due to errors in preparing the files for the competition?<br>\n2- I made the assumption that the EKG values in the EEG files were expressed in μV. Is my assumption correct?</p>\n<p>All the potential issues I have reported here and in my previous post <strong>affect a total of 39073 samples in the dataset</strong>, or <strong>36.6%</strong>. If these are actual issues, I would suspect that the same issues would also affect the test dataset; that would mean that participants are currently building and testing models on bad data, to be evaluated on potentially and equally bad data. Once again, could you please clarify and let us know: 1- if this is something you should/can fix; 2- if yes, how long it would take for an update; 3- if not, how we should deal with this issue going forward (e.g. ignoring the faulty files?).</p>",
      "rawMarkdown": "Hi @sohier ,\n\nIn addition to the data issues I have raised in [this previous post](https://www.kaggle.com/competitions/hms-harmful-brain-activity-classification/discussion/467909), I would like to bring to your attention other potential issues with the data that I found while performing some basic EDA. You will be able to reproduce the issues I will raise by running [this notebook](https://www.kaggle.com/code/patrob/check-eeg-ekg-strange-values).\n\n**EEG 1457334423**\n\nI flagged this EEG file in my previous post as one that contained implausible values. In fact, all the EEG channels for this file are equal to 0.16, while the EKG data is all 0.0. Some explanation can be found when examining its accompanying spectrogram (shown below): the EEG starts at the 264th second of this spectrogram, which corresponds to value 132 on the scale of the spectrogram. That region is blank, while the left half of the spectrogram is much more informative.\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F3537669%2F846dd3921d280d3713a5ea4e1711b948%2F1659812292-74-2494769356.png?generation=1705488172451061&alt=media)\n\nQuestion: was this choice of EEG window deliberate (and pointless, apart from testing for edge cases) or was it an accident? Should we just ignore this sample?\n\n**Very large EEG value ranges**\n\nAfter researching for the topic of this competition, I found that a typical adult human EEG signal is about 10 μV to 100 μV in amplitude ([Wikipedia](https://en.wikipedia.org/wiki/Electroencephalography)); that seizures would vary in amplitude somewhere between 400 μV and 1000 μV (from looking at the EEG files); that certain human artifacts (eye movement, etc.) could display spikes up to 1000 μV (at least for jaw clenching, according to [this paper](https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0290446). Also, the Wikipedia page seems to suggest that other types of artefacts, like bad electrode connections on the scalp, could cause spikes much greater than 1000 μV in amplitude (as shown in the graph \"Common artifacts in human EEG\" in the section Normal Activity).\n\nHowever, I am a bit perplexed by the high number of EEG files which contain value ranges (max *minus* min) greater than 2000 μV (amplitude should be measured from 0, hence, the range I chose is ~2 * 1000 μV). In fact, the results of my notebook indicate that 5108 EEG files show value ranges greater than 2000 μV (29.89% of all EEG files). If I apply a 10000 μV (or 10 mV) threshold, there are still 1867 EEG files (10.93%) exceeding that threshold. The highest value range I found was for eeg_id 1969027192: 123393 μV or 0.1234 V (could almost qualify as a tiny battery).\n\nQuestions: \n1- Are the EEG files containing high value ranges due solely to the presence of external artifacts or due to errors in preparing the files for the competition?\n2- I made the assumption that the values in the EEG files were expressed in μV. Is my assumption correct?\n\n**EKGs with standard deviation = 0**\n\nI also examined the EKG values contained in the EEG files. I found 78 files where all the EKG values were equal to 0 and, as a result, had a standard deviation equal to 0. Further, I found another 12 files where all the EKG values were equal to 9999, again leading to a standard deviation = 0.\n\nQuestion:\nAre the EKG values for these files the result of a manipulation error or simply that there were no valid EKG values for these patient samples?\n\n**Very large EKG value ranges**\n\nVarious references I looked at estimate the maximal normal EKG amplitude to be somewhere between 2.5 mV and 5 mV (2500 μV and 5000 μV). I calculated the EKG value range for all the EEG files and found several that were well in excess of these values. Specifically, if I use a 10000 μV benchmark for the EKG value range (max *minus* min), I found that there are 1600 EEG files that have EKG value ranges exceeding that benchmark. Further, there are 12 EEG files that exhibit EKG value ranges in excess of 1000000 μV (or 1 volt). The highest value range I found was for eeg_id 1076057868: 2451159 μV, or nearly 2.5 V, roughly the voltage of a watch battery.\n\nQuestions: \n1- Are the EEG files containing high EKG value ranges due solely to the presence of external artifacts or due to errors in preparing the files for the competition?\n2- I made the assumption that the EKG values in the EEG files were expressed in μV. Is my assumption correct?\n\nAll the potential issues I have reported here and in my previous post **affect a total of 39073 samples in the dataset**, or **36.6%**. If these are actual issues, I would suspect that the same issues would also affect the test dataset; that would mean that participants are currently building and testing models on bad data, to be evaluated on potentially and equally bad data. Once again, could you please clarify and let us know: 1- if this is something you should/can fix; 2- if yes, how long it would take for an update; 3- if not, how we should deal with this issue going forward (e.g. ignoring the faulty files?).",
      "votes": null
    },
    {
      "id": "2606371",
      "postDate": "01/17/2024 15:44:29",
      "content": "<p>I found that values are getting near 0 just before/after missing values so I tried both forward + backward fill and zero fill. They had similar results.</p>",
      "rawMarkdown": "I found that values are getting near 0 just before/after missing values so I tried both forward + backward fill and zero fill. They had similar results.",
      "votes": null
    },
    {
      "id": "2606960",
      "postDate": "01/18/2024 01:17:15",
      "content": "<p>Is that for EEG 1457334423/spectrogram 1659812292?</p>",
      "rawMarkdown": "Is that for EEG 1457334423/spectrogram 1659812292?",
      "votes": null
    },
    {
      "id": "2613399",
      "postDate": "01/22/2024 04:18:20",
      "content": "<p>Bump for <a href=\"https://www.kaggle.com/sohier\" target=\"_blank\">@sohier</a></p>",
      "rawMarkdown": "Bump for @sohier",
      "votes": null
    },
    {
      "id": "2615559",
      "postDate": "01/23/2024 07:09:53",
      "content": "<p>Good overview of the missing data. Great work </p>",
      "rawMarkdown": "Good overview of the missing data. Great work",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 2606371,
      "author_name": "gunesevitan",
      "author_url": "",
      "post_date": "01/17/2024 15:44:29",
      "content": "<p>I found that values are getting near 0 just before/after missing values so I tried both forward + backward fill and zero fill. They had similar results.</p>",
      "votes": null,
      "replies": [
        {
          "id": 2606960,
          "author_name": "patrob",
          "author_url": "",
          "post_date": "01/18/2024 01:17:15",
          "content": "<p>Is that for EEG 1457334423/spectrogram 1659812292?</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 2613399,
      "author_name": "patrob",
      "author_url": "",
      "post_date": "01/22/2024 04:18:20",
      "content": "<p>Bump for <a href=\"https://www.kaggle.com/sohier\" target=\"_blank\">@sohier</a></p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 2615559,
      "author_name": "minammashaobaji",
      "author_url": "",
      "post_date": "01/23/2024 07:09:53",
      "content": "<p>Good overview of the missing data. Great work </p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "2606011": "Hi @sohier ,\n\nIn addition to the data issues I have raised in [this previous post](https://www.kaggle.com/competitions/hms-harmful-brain-activity-classification/discussion/467909), I would like to bring to your attention other potential issues with the data that I found while performing some basic EDA. You will be able to reproduce the issues I will raise by running [this notebook](https://www.kaggle.com/code/patrob/check-eeg-ekg-strange-values).\n\n**EEG 1457334423**\n\nI flagged this EEG file in my previous post as one that contained implausible values. In fact, all the EEG channels for this file are equal to 0.16, while the EKG data is all 0.0. Some explanation can be found when examining its accompanying spectrogram (shown below): the EEG starts at the 264th second of this spectrogram, which corresponds to value 132 on the scale of the spectrogram. That region is blank, while the left half of the spectrogram is much more informative.\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F3537669%2F846dd3921d280d3713a5ea4e1711b948%2F1659812292-74-2494769356.png?generation=1705488172451061&alt=media)\n\nQuestion: was this choice of EEG window deliberate (and pointless, apart from testing for edge cases) or was it an accident? Should we just ignore this sample?\n\n**Very large EEG value ranges**\n\nAfter researching for the topic of this competition, I found that a typical adult human EEG signal is about 10 μV to 100 μV in amplitude ([Wikipedia](https://en.wikipedia.org/wiki/Electroencephalography)); that seizures would vary in amplitude somewhere between 400 μV and 1000 μV (from looking at the EEG files); that certain human artifacts (eye movement, etc.) could display spikes up to 1000 μV (at least for jaw clenching, according to [this paper](https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0290446). Also, the Wikipedia page seems to suggest that other types of artefacts, like bad electrode connections on the scalp, could cause spikes much greater than 1000 μV in amplitude (as shown in the graph \"Common artifacts in human EEG\" in the section Normal Activity).\n\nHowever, I am a bit perplexed by the high number of EEG files which contain value ranges (max *minus* min) greater than 2000 μV (amplitude should be measured from 0, hence, the range I chose is ~2 * 1000 μV). In fact, the results of my notebook indicate that 5108 EEG files show value ranges greater than 2000 μV (29.89% of all EEG files). If I apply a 10000 μV (or 10 mV) threshold, there are still 1867 EEG files (10.93%) exceeding that threshold. The highest value range I found was for eeg_id 1969027192: 123393 μV or 0.1234 V (could almost qualify as a tiny battery).\n\nQuestions: \n1- Are the EEG files containing high value ranges due solely to the presence of external artifacts or due to errors in preparing the files for the competition?\n2- I made the assumption that the values in the EEG files were expressed in μV. Is my assumption correct?\n\n**EKGs with standard deviation = 0**\n\nI also examined the EKG values contained in the EEG files. I found 78 files where all the EKG values were equal to 0 and, as a result, had a standard deviation equal to 0. Further, I found another 12 files where all the EKG values were equal to 9999, again leading to a standard deviation = 0.\n\nQuestion:\nAre the EKG values for these files the result of a manipulation error or simply that there were no valid EKG values for these patient samples?\n\n**Very large EKG value ranges**\n\nVarious references I looked at estimate the maximal normal EKG amplitude to be somewhere between 2.5 mV and 5 mV (2500 μV and 5000 μV). I calculated the EKG value range for all the EEG files and found several that were well in excess of these values. Specifically, if I use a 10000 μV benchmark for the EKG value range (max *minus* min), I found that there are 1600 EEG files that have EKG value ranges exceeding that benchmark. Further, there are 12 EEG files that exhibit EKG value ranges in excess of 1000000 μV (or 1 volt). The highest value range I found was for eeg_id 1076057868: 2451159 μV, or nearly 2.5 V, roughly the voltage of a watch battery.\n\nQuestions: \n1- Are the EEG files containing high EKG value ranges due solely to the presence of external artifacts or due to errors in preparing the files for the competition?\n2- I made the assumption that the EKG values in the EEG files were expressed in μV. Is my assumption correct?\n\nAll the potential issues I have reported here and in my previous post **affect a total of 39073 samples in the dataset**, or **36.6%**. If these are actual issues, I would suspect that the same issues would also affect the test dataset; that would mean that participants are currently building and testing models on bad data, to be evaluated on potentially and equally bad data. Once again, could you please clarify and let us know: 1- if this is something you should/can fix; 2- if yes, how long it would take for an update; 3- if not, how we should deal with this issue going forward (e.g. ignoring the faulty files?).",
    "2606371": "I found that values are getting near 0 just before/after missing values so I tried both forward + backward fill and zero fill. They had similar results.",
    "2606960": "Is that for EEG 1457334423/spectrogram 1659812292?",
    "2613399": "Bump for @sohier",
    "2615559": "Good overview of the missing data. Great work"
  },
  "source": "meta"
}