{
  "id": 14975,
  "title": "A bit of Neuroscience: CSP, mu & beta suppression with mne-python",
  "url": "/competitions/grasp-and-lift-eeg-detection/discussion/14975",
  "author_name": "",
  "post_date": "2015-07-01T13:40:28.787Z",
  "votes": 16,
  "comment_count": 10,
  "views": 2475,
  "content": "<p>Hi,</p>\n<p>Here is a<a href=\"https://gist.github.com/alexandrebarachant/c929834f1a68c2728d35\"> gist</a> that shows spatial pattern, mu &amp; beta suppression using mne-python.</p>\n<p>During a hand movement, the mu (~10Hz) and beta (~24Hz) oscillations are suppressed over the contralateral motor cortex, i.e. we can observe a reduction of the signal power in the corresponding frequency band.</p>\n<p>I used <a href=\"https://github.com/mne-tools/mne-python\">MNE</a>&nbsp;to epoch signal corresponding to the hand movement, by assuming that the hand movement occur before the 'Replace' event.</p>\n<p>Using Common spatial patterns algorithm, i extract spatial filters that maximize the difference of variance during and after the movement, and then visualize the corresponding spectrum.&nbsp;</p>\n<p>the results (for subject 1)are the following :</p>\n<p><img src=\"https://storage.googleapis.com/kaggle-forum-message-attachments/83078/2666/CSP_pattern.png?sv=2012-02-12&se=2015-07-04T13:40:52Z&sr=b&sp=r&sig=u4IzQRxjk8y2%2FZEQQQLcN3EtxnS9QFba9wc3qvIl1ho%3D\" alt=\"patterns\" width=\"256\" height=\"251\"></p>\n<p><img src=\"https://storage.googleapis.com/kaggle-forum-message-attachments/83078/2667/spectrum.png?sv=2012-02-12&se=2015-07-04T13:40:41Z&sr=b&sp=r&sig=VbLarjTzDIn9moUkF70nvjy4SD%2BlMgIOhupQPx81cFw%3D\" alt=\"spectrum\" width=\"402\" height=\"271\"></p>\n<p>We can see the pattern corresponding to the left motor cortex (right hand), and the clear mu and beta suppression.</p>\n<p>Enjoy</p>",
  "messages": [
    {
      "id": "83078",
      "postDate": "07/01/2015 13:40:28",
      "content": "<p>Hi,</p>\n<p>Here is a<a href=\"https://gist.github.com/alexandrebarachant/c929834f1a68c2728d35\"> gist</a> that shows spatial pattern, mu &amp; beta suppression using mne-python.</p>\n<p>During a hand movement, the mu (~10Hz) and beta (~24Hz) oscillations are suppressed over the contralateral motor cortex, i.e. we can observe a reduction of the signal power in the corresponding frequency band.</p>\n<p>I used <a href=\"https://github.com/mne-tools/mne-python\">MNE</a>&nbsp;to epoch signal corresponding to the hand movement, by assuming that the hand movement occur before the 'Replace' event.</p>\n<p>Using Common spatial patterns algorithm, i extract spatial filters that maximize the difference of variance during and after the movement, and then visualize the corresponding spectrum.&nbsp;</p>\n<p>the results (for subject 1)are the following :</p>\n<p><img src=\"https://storage.googleapis.com/kaggle-forum-message-attachments/83078/2666/CSP_pattern.png?sv=2012-02-12&se=2015-07-04T13:40:52Z&sr=b&sp=r&sig=u4IzQRxjk8y2%2FZEQQQLcN3EtxnS9QFba9wc3qvIl1ho%3D\" alt=\"patterns\" width=\"256\" height=\"251\"></p>\n<p><img src=\"https://storage.googleapis.com/kaggle-forum-message-attachments/83078/2667/spectrum.png?sv=2012-02-12&se=2015-07-04T13:40:41Z&sr=b&sp=r&sig=VbLarjTzDIn9moUkF70nvjy4SD%2BlMgIOhupQPx81cFw%3D\" alt=\"spectrum\" width=\"402\" height=\"271\"></p>\n<p>We can see the pattern corresponding to the left motor cortex (right hand), and the clear mu and beta suppression.</p>\n<p>Enjoy</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "83080",
      "postDate": "07/01/2015 13:53:44",
      "content": "<p>Neat! You should get this running on Scripts (this kind of analysis is exactly what it's for) -&nbsp;https://www.kaggle.com/c/grasp-and-lift-eeg-detection/scripts</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "83082",
      "postDate": "07/01/2015 14:20:24",
      "content": "<p>This was my original intention, but i doubt mne-python is available on the script environment.</p>\n<p>Is there a way to add it ?</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "83084",
      "postDate": "07/01/2015 14:28:14",
      "content": "<p>Leaving a comment in&nbsp;https://www.kaggle.com/forums/f/15/kaggle-forum/t/13728/kaggle-scripts-product-feedback will generally do the trick, but I've already asked the team to look into adding it. I'll follow up here if/when it's there.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "83090",
      "postDate": "07/01/2015 15:19:52",
      "content": "<p>Great thank you !</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "83094",
      "postDate": "07/01/2015 15:58:53",
      "content": "<p>mne should now be installed and live. Have fun!</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "83123",
      "postDate": "07/01/2015 18:58:29",
      "content": "<p>Awesome, thanks for doing this so quickly.</p>\n<p>The script is live an running :)</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "83137",
      "postDate": "07/01/2015 20:26:25",
      "content": "<p>Hi,&nbsp;</p>\n<p>I updated the <a href=\"https://www.kaggle.com/alexandrebarachant/grasp-and-lift-eeg-detection/common-spatial-pattern-with-mne\">script</a>.</p>\n<p>It now return results for all the subjects, and also give AUC classification results for the simple classification task of During Vs After hand movement (not directly related to the task of this challenge, but give an insight of the subject performance).&nbsp;</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "83188",
      "postDate": "07/02/2015 08:12:22",
      "content": "<p>[quote=Alexandre Barachant;83078]</p>\n<p>[...] by assuming that the hand movement occur before the 'Replace' event. [...]</p>\n<p>[/quote]</p>\n<p>Just to clarify, this is how a grasp-and-lift trial proceeds (<strong>events in bold</strong>):</p>\n<ul>\n<li>Subject is sitting on a table with his/her hand in resting position</li>\n<li>An LED lights up cueing the subject to start the reaching (<strong>HandStart</strong>)</li>\n<li>The subject touches the object (<strong>FirstDigitTouch</strong>) and initiates the load phase</li>\n<li>The objects lifts off (<strong>LiftOff</strong>) and is held in place</li>\n<li>The the LED turns off and the subject replaces the object (<strong>Replace</strong>)</li>\n<li>The subject retracts his/her hand and puts it back into resting position (<strong>BothReleased</strong>)</li>\n</ul>\n\n<p>So there is actually hand movement before and after the replace event, as well as around most other events.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "83221",
      "postDate": "07/02/2015 13:15:31",
      "content": "<p>yes, you are right. Thanks for the clarification, events name are confusing.</p>\n<p>Anyway, i wanted to have two classes, one with hand movement for sure, and one with most of rest. the &quot;After&quot; class is epoched 0.5 second after the Replace event, and i assumed that it was enough time to retract your hand and be in resting position. I could have used BothRelease.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "85642",
      "postDate": "07/16/2015 05:35:18",
      "content": "<p>Hi Alexandre !!</p>\n\n<p>If I got it right I guess we are required to classify 6 classes :)?</p>\n\n<p>Thanks\nNavin</p>",
      "rawMarkdown": "Hi Alexandre !!\r\n\r\nIf I got it right I guess we are required to classify 6 classes :)?\r\n\r\nThanks\r\nNavin",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 83080,
      "author_name": "wcukierski",
      "author_url": "",
      "post_date": "07/01/2015 13:53:44",
      "content": "<p>Neat! You should get this running on Scripts (this kind of analysis is exactly what it's for) -&nbsp;https://www.kaggle.com/c/grasp-and-lift-eeg-detection/scripts</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 83082,
      "author_name": "alexandrebarachant",
      "author_url": "",
      "post_date": "07/01/2015 14:20:24",
      "content": "<p>This was my original intention, but i doubt mne-python is available on the script environment.</p>\n<p>Is there a way to add it ?</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 83084,
      "author_name": "wcukierski",
      "author_url": "",
      "post_date": "07/01/2015 14:28:14",
      "content": "<p>Leaving a comment in&nbsp;https://www.kaggle.com/forums/f/15/kaggle-forum/t/13728/kaggle-scripts-product-feedback will generally do the trick, but I've already asked the team to look into adding it. I'll follow up here if/when it's there.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 83090,
      "author_name": "alexandrebarachant",
      "author_url": "",
      "post_date": "07/01/2015 15:19:52",
      "content": "<p>Great thank you !</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 83094,
      "author_name": "wcukierski",
      "author_url": "",
      "post_date": "07/01/2015 15:58:53",
      "content": "<p>mne should now be installed and live. Have fun!</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 83123,
      "author_name": "alexandrebarachant",
      "author_url": "",
      "post_date": "07/01/2015 18:58:29",
      "content": "<p>Awesome, thanks for doing this so quickly.</p>\n<p>The script is live an running :)</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 83137,
      "author_name": "alexandrebarachant",
      "author_url": "",
      "post_date": "07/01/2015 20:26:25",
      "content": "<p>Hi,&nbsp;</p>\n<p>I updated the <a href=\"https://www.kaggle.com/alexandrebarachant/grasp-and-lift-eeg-detection/common-spatial-pattern-with-mne\">script</a>.</p>\n<p>It now return results for all the subjects, and also give AUC classification results for the simple classification task of During Vs After hand movement (not directly related to the task of this challenge, but give an insight of the subject performance).&nbsp;</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 83188,
      "author_name": "qwlouse",
      "author_url": "",
      "post_date": "07/02/2015 08:12:22",
      "content": "<p>[quote=Alexandre Barachant;83078]</p>\n<p>[...] by assuming that the hand movement occur before the 'Replace' event. [...]</p>\n<p>[/quote]</p>\n<p>Just to clarify, this is how a grasp-and-lift trial proceeds (<strong>events in bold</strong>):</p>\n<ul>\n<li>Subject is sitting on a table with his/her hand in resting position</li>\n<li>An LED lights up cueing the subject to start the reaching (<strong>HandStart</strong>)</li>\n<li>The subject touches the object (<strong>FirstDigitTouch</strong>) and initiates the load phase</li>\n<li>The objects lifts off (<strong>LiftOff</strong>) and is held in place</li>\n<li>The the LED turns off and the subject replaces the object (<strong>Replace</strong>)</li>\n<li>The subject retracts his/her hand and puts it back into resting position (<strong>BothReleased</strong>)</li>\n</ul>\n\n<p>So there is actually hand movement before and after the replace event, as well as around most other events.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 83221,
      "author_name": "alexandrebarachant",
      "author_url": "",
      "post_date": "07/02/2015 13:15:31",
      "content": "<p>yes, you are right. Thanks for the clarification, events name are confusing.</p>\n<p>Anyway, i wanted to have two classes, one with hand movement for sure, and one with most of rest. the &quot;After&quot; class is epoched 0.5 second after the Replace event, and i assumed that it was enough time to retract your hand and be in resting position. I could have used BothRelease.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 85642,
      "author_name": "navingupta",
      "author_url": "",
      "post_date": "07/16/2015 05:35:18",
      "content": "<p>Hi Alexandre !!</p>\n\n<p>If I got it right I guess we are required to classify 6 classes :)?</p>\n\n<p>Thanks\nNavin</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "83078": "",
    "83080": "",
    "83082": "",
    "83084": "",
    "83090": "",
    "83094": "",
    "83123": "",
    "83137": "",
    "83188": "",
    "83221": "",
    "85642": "Hi Alexandre !!\r\n\r\nIf I got it right I guess we are required to classify 6 classes :)?\r\n\r\nThanks\r\nNavin"
  },
  "source": "meta"
}