Learning can be painful
Well today was the final lab meeting of the term. While the weekly meetings will (probably) be continuing, it’s still a big deal and could (hopefully) mean the end of my six weeks or so of torment. Normally I give it a few days before I talk about just how badly the meeting went, but this time was different and I’m thankful for it. The difference? My main-PI was out for medical reasons, so we got to talk about the project a little more freely.
Ever get told to do something, have no idea how to do it, but somehow manage anyway? That’s basically where I’m at. The talk I’m giving (more here) is due soon and I’m frantically trying to figure out how to finish this. I’m flailing a bit, but ironically as I sat down to write this I realized what was going on with some of my calculations and it turns out I know what’s going on now. Like literally just as I started writing this paragraph of text (AHHH!!!!!). Funny how walking away from something can give you more insight than if you sat there forcing yourself to do the work (mental note for future me: take more breaks).
Today went something like this, my lab meeting started and I was informed that the PI (I call him my main-PI since I technically have two) wouldn’t be there. He’s super sharp and when he talks about something you can be sure he knows what he’s talking about and not making it up. I respect that and while I’m not sure that our personalities mesh as well as they could, I wish he had more time to teach because there’s so much he knows that I want to know. Because he wasn’t in, we had a chance to work through things without cutting to the answer.
The thing is this, if I tell you a^2 + b^2 = c^2 without giving you any context or explanation to how we came up with that, there’s a good chance you would be lost on why it works, how to use it properly, and when you cannot use it. I don’t blame you if you agree, I spend a significant part of my day explaining the how and why to things (like my “know your spinal cord” series, or the “in statistics” series). Sometimes having the answer isn’t enough, you don’t skip to the end of a book to see what happens, the point is the stuff in the middle. Well we met and over the course of a few hours (yes, that’s hours with an s), we basically ended up in the same place we started.
The root of all my trouble is there are packages to our software (EEGLAB in this case) that do things for us. It’s awesome, I can do all sorts of advanced stuff just by using the program others have written. However, that is exactly why it’s awful. It gives us the end without the context in between. I don’t know how it’s calculating certain things or doing certain steps. This would be fine if I were doing work for a class or I didn’t particularly care about the stuff I was doing, I could blindly get a solution and be done with it.
However, at this point in my education every bit of information I learn I’m trying to cram into my brainhole (an industry technical term I assure you). There’s nothing I’m doing that I want to do halfway, hence my extra work with the statistics course via this blog. More importantly, there are things I really want to be able to do with the data in the in between portions. Maybe I don’t want an average given back to me code, did you ever think of that?! Which means for the past few days I’ve been banging my head against the keyboard trying to make sense of this.
I may have sacrificed several energy drinks to the altar of my computer to attempt and get a solution, but to no avail. Well it turns out I’m an idiot. I know this about myself, it’s okay, I’ve accepted this. While my peers can just chug along to a solution I overthink things to the extreme. I must have had 40 windows of different bits of code open from this software package trying to make sense of what was doing and how it was doing it when the answer was staring me in the damn face. Hence, I’m an idiot.
Since being self-deprecating isn’t particularly useful and who knows someone who is using EEGLAB could come across this, I will be more than happy to explain. I’ve been working on clustering my IC’s. IC’s are independent components in data imagine your data are a cake batter. Well your cake batter isn’t one thing, there’s a bunch of things mixed together. Well the same thing with EEG data (brain data), you have several different areas of the brain activating over different periods causing mixed signals when we record from the scalp. Luckily with a bit of math we can unmix the cake batter. It’s not perfect mind you, but it gets the job done surprisingly well, especially when you remember that the data we are collecting is from the brain and we’re recording non-invasively. It’s freaking amazing, or at least I tend to think so.
Long story short there’s some math involved (isn’t there always) that was holding things up. EEGLAB clusters IC’s from multiple subjects. If every subject’s data was a cake batter, ICA grouped the eggs, the milk, the butter. But maybe one batter had chocolate and two had strawberry, well that’s why we cluster, to find common things in the data. The result is an estimate of the common activations in the brain, not only do we get back common IC’s, the cluster means they are grouped physically in space together. Below for example shows a clustering of IC’s that I came up with, the MRI scans you see are the stock ones the software uses, so it’s not exact, but nothing ever is.
That red dot, that’s the centroid and back to our cake batter analogy, if this cluster was the eggs cluster, that means that the estimated physical location of the eggs in the batter would be roughly that red dot. Like eggs, each of the blue dots (which are individual IC’s from multiple participants) are all slightly different (the values that make up the dots, not just the physical location), but we still call them eggs because they have similar properties and are physically grouped together. The mean of all this data is what EEGLAB readily gives me back. I can “see” the individual contributions if I want, but I had no idea where it stored the information above. I couldn’t figure out how things were calculated, basically I wanted to know how it was determining the mean and I wanted the individual components as well for other things I’m doing.
Wouldn’t you know it, the answer was looking right at me and I literally checked it as I wrote this post to make sure. Each blue dot gets calculated separately before it gets to this cluster step. There’s a whole process for that and I’ve actually covered that before (here) for those interested. My problem was I had no idea how to use that information to find the mean. It’s a little more complex than that, but we’ll leave it at that for the sake of brevity since this is getting long.
The answer was simple, it was basic matrix multiplication (like regular multiplication, but more matrix-y). So I entered a few numbers to check that I was on the right track and boom, correct answer. Basically EEGLAB creates a variable with all the subjects in it, along with the math used to calculate the IC’s. It’s all right there I just literally had to type in the right multiplication to get the answer. For anyone working with EEG the short version is I had my source data, but I wanted to work in IC space. I needed the IC activations over time to get that I just multiplied my sphering matrix by my IC weights then multiply all that by the sources, then I had my IC’s. It’s so simple I feel really bad that I had no idea what I was doing. So all I have to do is find the ICs that correspond to my cluster and suddenly I have the individual data I needed.
Not that the rest of the lab knew either, but it would’ve been sort of embarrassing if my main-PI came in and gave me the answer. So yeah, I overthink things. I’m used to it, but thankfully I have realizations like this. Sure it took three days and most of today to figure it out, but that’s one thing I can knock off my to-do list.
The point today is simple, learning can be painful.
But enough about us, what about you?