EEG Data Classification [DEMO #16]
CC Attribution 3.0 Unported:
You are free to use, adapt and copy, distribute and transmit the work or content in adapted or unchanged form for any legal purpose as long as the work is attributed to the author in the manner specified by the author or licensor.
Borgne, Marion Le
EEG data is classified by NuPIC based upon the thoughts of the subject.
 Music So my name is Margot and I made a classifier for motor imagery. So just if you're not familiar with what motor imagery is, it's the... so EG, we already talked about that picture, we call it Electrical Intellectual Understandable Group. It's... Ah! It's amazing. So I'm working on my free time with the Berkeley Community of Technology Group. We are getting this EG data from a board called OpenBCI, which is a very cheap medical grade, open source EG recording device and what we had at the recent hackathon was a quadcopter that was mind control with EG recording of motor imagery, which we usually say recording you when you're moving your left arm, your right arm or your left arm, and then if you just think it's about your brain, it actually makes the same pattern. So the idea is to have a system that will then recognize you just thinking about that, and that way you can potentially control things with your mind. So just to show you what we did with the basic machine learning classifier, it actually worked pretty well. I mean it's like 50% accuracy, but it was like a nice breakthrough with this open source device. So here's Thomas, because his little electrode is on his head. And that's pretty good because it's one second like your eyes can see one second latency, it's fine for the type of your feedback. So in the end the app worked pretty well. But we want to increase this accuracy 50% if we can get over that. You have potentially a lot of amazing applications. For example, for the disabled, like controlling wheelchairs with their mind is like really amazing. So I really wanted to try NuPic to see if they're going to get crash by this quadcopter. So the idea is to use NuPic to get hopefully a higher accuracy rate. How many things was he trying to classify? Just then just two? Three things. No movement, left arm and right arm, which is actually exactly what they're trying to classify as well. And I'm using the same dataset as a benchmark to compare it to this kind of more classical machine learning approach. And so we have eight e.g. channels, as you can imagine none of them are useful. And you have three phases, so no movement, left hand and right hand. Same thing right is four milliseconds. And so I guess I should show you the demo of how NuPic did. And so I will actually record that. I will explain a little bit how I messaged the data. Talking about the NuMeta people, I got a couple of insights about how I could do that. And the idea is to create one model per channel per phase. So that right movement. So three models per channel. And then we disable the learning at the end of each phase so that when we feed a new incoming e.g. data, we can see whether the anomaly rate is high or low and then we can feed the right model that gives the smallest anomaly rate, any average of this period. And so this is how I made prediction using NuPic, feeding e.g. data to the three labels per channel. No movement left, right, and seeing which one had the lowest average enemy score. So then I can first show you the prediction part because it helps having an idea how well it performs. So what we're going to see is one channel, data, stress loading because there is quite a lot of data. And NuPic has been trained already and I'm loading the model that has been saved. And in Indian, data is very spiky because it's very dense. And then for me, second is like pretty high sentiment. But in my opinion, it's doing quite a good job. But then the next part is actually amazing. And just before this demo, I got it working and I was so happy. Because then the classify part is really good because it's actually so far a hundred percent crazy. So in my mind, so I need to reevaluate that. I can show you that. And then really, like I'm feeding it 400 milliseconds of data. And then it's going to give me... It's saying, so I'm seeing eG data that's coming from one channel, channel zero. So let's classify this eG data. The guy is not moving. It's actually predicting that we tried the three models and the lowest enemy, like average enemy rate is actually in the movement. So that's cool. Then let's see the motor actually moving in your hands. And you see, like left hand is actually the lowest enemy score as well for the data incoming from when the patient is acting out. So so far, it hasn't failed to not predict well that thing. Even though it's quite spiky. So you need to use this. You can show you again, the more graphical. That was over 400 milliseconds of data? No, no, I trained it over. But those guys, I can't... Yeah, those little pieces. So you did one sample for each? So I did a hundred data points. You did a bunch of them? Yeah, I did a bunch of them. And so this is over, I think, 25,000 data points. So during the training phase, it's something like 25,000 data points per channel, per phase. And then after that, each time I get an incoming eG signal, I take just a little chunk of your 400 milliseconds and I feed it. And it's giving me this result. That's really cool. Yeah. That's it. We've been talking about doing classification using anomaly models like this for a long time. And I think this is the first time we've actually seen it work, right? Yeah, I'm only... From the community, I mean, yeah. So when you talk about, like, yes, this is going to be so great, because this is a game, right? But for actual application of this, I think we need to... And you think one channel is actually enough? No. I think if we actually combine one of them, I can actually reduce, not take, like, as much as 400 milliseconds. And I can... Potentially, I hope I can... I need to investigate that, but take a smaller amount of data and then combine kind of, like, all of my enemy scores. Stem zero is actually... It's like a useful one, but then my assumption is that if I combine all of them, it's going to be... You can probably process all of this data streaming and be able to classify in real time. You could calibrate, put the EEG on, calibrate... Yeah, exactly. So this is actually why there are, like, two phases. One training, where exactly like what you did, right? I trained it on a data set that is the training phase where we tell the guy, okay, move your left hand, move your right hand. If you need to, if you freeze the model, so that's the training part. And then after that, you just streaming in, maybe. What could actually be also a cool thing is to create some batches of, like, updated data. Like, you know, if we create, like, a post-streaming data set. Let's say the quadcopter, we have like a feedback system, it's indeed going left. Or indeed going right. Once the production, the classification is made and I'm happy with what I'm seeing, I could kind of label this predicted data as being valid and then put it back in a data set to continue training the model so that it reinforces itself over time. Awesome. Yeah, good job.
 Music  So my name is Margot and I made a classifier for motor imagery.  So just if you're not familiar with what motor imagery is,  it's the... so EG, we already talked about that picture,  we call it Electrical Intellectual Understandable Group.  It's...  Ah!  It's amazing.  So I'm working on my free time with the Berkeley Community of Technology Group.  We are getting this EG data from a board called OpenBCI,  which is a very cheap medical grade,  open source EG recording device and what we had at the recent hackathon  was a quadcopter that was mind control with EG recording of motor imagery,  which we usually say recording you when you're moving your left arm,  your right arm or your left arm,  and then if you just think it's about your brain, it actually makes the same pattern.  So the idea is to have a system that will then recognize you just thinking about that,  and that way you can potentially control things with your mind.  So just to show you what we did with the basic machine learning classifier,  it actually worked pretty well.  I mean it's like 50% accuracy, but it was like a nice breakthrough with this open source device.  So here's Thomas, because his little electrode is on his head.  And that's pretty good because it's one second like your eyes can see one second latency,  it's fine for the type of your feedback.  So in the end the app worked pretty well.  But we want to increase this accuracy 50% if we can get over that.  You have potentially a lot of amazing applications.  For example, for the disabled, like controlling wheelchairs with their mind is like really amazing.  So I really wanted to try NuPic to see if they're going to get crash by this quadcopter.  So the idea is to use NuPic to get hopefully a higher accuracy rate.  How many things was he trying to classify? Just then just two?  Three things. No movement, left arm and right arm,  which is actually exactly what they're trying to classify as well.  And I'm using the same dataset as a benchmark to compare it to this kind of more classical machine learning approach.  And so we have eight e.g. channels, as you can imagine none of them are useful.  And you have three phases, so no movement, left hand and right hand.  Same thing right is four milliseconds.  And so I guess I should show you the demo of how NuPic did.  And so I will actually record that.  I will explain a little bit how I messaged the data.  Talking about the NuMeta people, I got a couple of insights about how I could do that.  And the idea is to create one model per channel per phase.  So that right movement.  So three models per channel.  And then we disable the learning at the end of each phase so that when we feed a new incoming e.g. data,  we can see whether the anomaly rate is high or low and then we can feed the right model that gives the smallest anomaly rate,  any average of this period.  And so this is how I made prediction using NuPic, feeding e.g. data to the three labels per channel.  No movement left, right, and seeing which one had the lowest average enemy score.  So then I can first show you the prediction part because it helps having an idea how well it performs.  So what we're going to see is one channel, data, stress loading because there is quite a lot of data.  And NuPic has been trained already and I'm loading the model that has been saved.  And in Indian, data is very spiky because it's very dense.  And then for me, second is like pretty high sentiment.  But in my opinion, it's doing quite a good job.  But then the next part is actually amazing.  And just before this demo, I got it working and I was so happy.  Because then the classify part is really good because it's actually so far a hundred percent crazy.  So in my mind, so I need to reevaluate that.  I can show you that.  And then really, like I'm feeding it 400 milliseconds of data.  And then it's going to give me...  It's saying, so I'm seeing eG data that's coming from one channel, channel zero.  So let's classify this eG data.  The guy is not moving.  It's actually predicting that we tried the three models and the lowest enemy, like average enemy rate is actually in the movement.  So that's cool.  Then let's see the motor actually moving in your hands.  And you see, like left hand is actually the lowest enemy score as well for the data incoming from when the patient is acting out.  So so far, it hasn't failed to not predict well that thing.  Even though it's quite spiky.  So you need to use this.  You can show you again, the more graphical.  That was over 400 milliseconds of data?  No, no, I trained it over.  But those guys, I can't...  Yeah, those little pieces.  So you did one sample for each?  So I did a hundred data points.  You did a bunch of them?  Yeah, I did a bunch of them.  And so this is over, I think, 25,000 data points.  So during the training phase, it's something like 25,000 data points per channel, per phase.  And then after that, each time I get an incoming eG signal, I take just a little chunk of your 400 milliseconds and I feed it.  And it's giving me this result.  That's really cool.  Yeah.  That's it.  We've been talking about doing classification using anomaly models like this for a long time.  And I think this is the first time we've actually seen it work, right?  Yeah, I'm only...  From the community, I mean, yeah.  So when you talk about, like, yes, this is going to be so great, because this is a game, right?  But for actual application of this, I think we need to...  And you think one channel is actually enough?  No.  I think if we actually combine one of them, I can actually reduce, not take, like, as much as 400 milliseconds.  And I can...  Potentially, I hope I can...  I need to investigate that, but take a smaller amount of data and then combine kind of, like, all of my enemy scores.  Stem zero is actually...  It's like a useful one, but then my assumption is that if I combine all of them, it's going to be...  You can probably process all of this data streaming and be able to classify in real time.  You could calibrate, put the EEG on, calibrate...  Yeah, exactly.  So this is actually why there are, like, two phases.  One training, where exactly like what you did, right?  I trained it on a data set that is the training phase where we tell the guy, okay, move your left hand, move your right hand.  If you need to, if you freeze the model, so that's the training part.  And then after that, you just streaming in, maybe.  What could actually be also a cool thing is to create some batches of, like, updated data.  Like, you know, if we create, like, a post-streaming data set.  Let's say the quadcopter, we have like a feedback system, it's indeed going left.  Or indeed going right.  Once the production, the classification is made and I'm happy with what I'm seeing,  I could kind of label this predicted data as being valid and then put it back in a data set to continue training the model so that it reinforces itself over time.  Awesome.  Yeah, good job.
EEG_Data_Classification__DEMO__16___2014_Fall_NuPIC_Hackathon__0_7319.png EEG_Data_Classification__DEMO__16___2014_Fall_NuPIC_Hackathon__7320_10043.png EEG_Data_Classification__DEMO__16___2014_Fall_NuPIC_Hackathon__10044_11639.png EEG_Data_Classification__DEMO__16___2014_Fall_NuPIC_Hackathon__11640_13456.png