Independent Component Analysis (ICA) | EEG Analysis Example Code

  Рет қаралды 42,164

Shaw Talebi

Shaw Talebi

Күн бұрын

Пікірлер: 112
@hanstschohl
@hanstschohl 2 жыл бұрын
Ive had a class on Neurotech and they did not explain any of this but expected me to write a program using ICA feature selection. I found nothing usefull until this video. thank you so much
@ShawhinTalebi
@ShawhinTalebi 2 жыл бұрын
I was in a similar situation. That’s a big reason for this video. Glad it was helpful!
@golnazbaghdadi4617
@golnazbaghdadi4617 3 ай бұрын
The best explanation of ICA that I have ever seen, thanks!
@rlee1257
@rlee1257 3 жыл бұрын
Very clear, thanks! The examples with the mic and blinks were a great inclusion imo. They made ICA much easier to understand while also displaying the practical application in a fun way :)
@ShawhinTalebi
@ShawhinTalebi 3 жыл бұрын
Glad it was helpful!
@thevitorialima
@thevitorialima 2 ай бұрын
Amazing explanation man, I always end up looking your videos for technical but clean explanations!!
@ShawhinTalebi
@ShawhinTalebi 2 ай бұрын
Thanks Vitoria :)
@NonstopElectroshock
@NonstopElectroshock 2 жыл бұрын
Amazing explenation! Thank you so much! You saved my butt for my exam tomorrow
@ShawhinTalebi
@ShawhinTalebi 2 жыл бұрын
Glad I could help!
@renanbarella7556
@renanbarella7556 2 жыл бұрын
Gotcha! it was an amazing explanation about ICA! Thank you very much for that Shawhin! 🙃
@ShawhinTalebi
@ShawhinTalebi 2 жыл бұрын
Thanks, glad it made sense 😁
@raven5847
@raven5847 2 жыл бұрын
Love it! It was well explained and the example part makes the concept clearer. Thank you : )
@ShawhinTalebi
@ShawhinTalebi 2 жыл бұрын
So glad it was helpful!
@mahdieshraghi
@mahdieshraghi 3 жыл бұрын
Thank you from Iran 🇮🇷
@ShawhinTalebi
@ShawhinTalebi 3 жыл бұрын
Happy to share!
@neurodiscussionswithpegah
@neurodiscussionswithpegah 3 жыл бұрын
Great explanation! Thank you Shawhin!
@ShawhinTalebi
@ShawhinTalebi 3 жыл бұрын
Glad it was helpful!
@peteremmanuel8557
@peteremmanuel8557 6 ай бұрын
Beautiful explanation Shaw... Thanks
@barmawn
@barmawn Жыл бұрын
Thank you for your useful contents shawhin🙏🏻
@ShawhinTalebi
@ShawhinTalebi Жыл бұрын
My pleasure!
@karenfu4242
@karenfu4242 Жыл бұрын
good examples and codes for beginner like me to learn the concept of ICA!
@ShawhinTalebi
@ShawhinTalebi Жыл бұрын
Glad it was helpful!
@woodworkingaspirations1720
@woodworkingaspirations1720 14 күн бұрын
Back to watch again
@martonmunding8645
@martonmunding8645 3 жыл бұрын
Great explanation, thank you! I was looking for some material to help me with an EEG blink removal problem, so it's the perfect find!
@ShawhinTalebi
@ShawhinTalebi 3 жыл бұрын
Thank you for your comment. That is great to hear. Happy to help!
@ifycadeau
@ifycadeau 3 жыл бұрын
woohoo! been waiting for this one
@ShawhinTalebi
@ShawhinTalebi 3 жыл бұрын
Happy to oblige
@kaldirYT
@kaldirYT 3 жыл бұрын
My birthday is now complete
@chiragpalan9780
@chiragpalan9780 2 жыл бұрын
thanks for explanation, but may I ask why we want independent components to be non-gaussian?
@ShawhinTalebi
@ShawhinTalebi 2 жыл бұрын
Hi Chirag, that's a good question. I go into a bit more detail in the blog: towardsdatascience.com/independent-component-analysis-ica-a3eba0ccec35. Briefly, however, ICA combines the non-Gaussianity of independent components assumption, with the central limit theorem to connect the measured signals (e.g. x1 and x2) to the unmeasured independent components (e.g. s1 and s2). Hope that helps! Please feel free to share any follow-up questions, I find them very helpful. Shaw
@dragoncurveenthusiast
@dragoncurveenthusiast Жыл бұрын
This was super useful! Thank you!
@ShawhinTalebi
@ShawhinTalebi Жыл бұрын
Glad it was helpful!
@Jamboreeni
@Jamboreeni 3 жыл бұрын
Great vid man!
@ShawhinTalebi
@ShawhinTalebi 3 жыл бұрын
Thanks Abhay! Glad it was helpful
@parinazamini2072
@parinazamini2072 3 жыл бұрын
Thank you so much , this video is really helpful 🌷🌷
@ShawhinTalebi
@ShawhinTalebi 3 жыл бұрын
Glad it was helpful! Thanks for watching
@muzammiliqbal4620
@muzammiliqbal4620 3 жыл бұрын
Thank you. Very informative session.
@ShawhinTalebi
@ShawhinTalebi 3 жыл бұрын
Thank you, happy to help!
@aminsinichi
@aminsinichi 3 жыл бұрын
Great job!
@ShawhinTalebi
@ShawhinTalebi 3 жыл бұрын
Thanks for the visit!
@MrSreior
@MrSreior 2 жыл бұрын
Thank you so mucj
@ShawhinTalebi
@ShawhinTalebi 2 жыл бұрын
Glad it was helpful!
@Hhushrk12
@Hhushrk12 2 жыл бұрын
Hi, what PCA data specifically did you put into ICA? Did you take the variable loadings of each of the 21 PCs? Was that your data frame? I am trying to do this for financial data, would be awesome if you took the output of your PCA video and ran ICA on top of that
@ShawhinTalebi
@ShawhinTalebi 2 жыл бұрын
Hey, thanks for the question! The transformed EEG signals (i.e. 21 principal components) are what are fed into the ICA function. The data structure is an array where rows correspond to time points and columns to each of the principal components. That sounds like a cool idea! It should be simple to implement. If you are using sklearn, you can use a X_pca = pca.fit_transform(X) to get the transformed data, then a X_ica = ica.fit_transform(X_pca) to apply ICA to the principal components. PCA: scikit-learn.org/stable/modules/generated/sklearn.decomposition.PCA.html#sklearn.decomposition.PCA ICA: scikit-learn.org/stable/modules/generated/sklearn.decomposition.FastICA.html Hope that helps!
@QifanWang
@QifanWang 5 ай бұрын
THX! Very clear! Could you explain SCA vs PCA? Shared component analysis or Shared variance component analysis?
@ShawhinTalebi
@ShawhinTalebi 5 ай бұрын
Great suggestion! I haven't used SCA before, but I just downloaded the paper :)
@saadawan477
@saadawan477 2 жыл бұрын
Hi, Shawhin can you please tell me that how I can made heuristic guess in case of grayscale imges? let say i get PCA_data i.e 10 Principal Components now then how many Independent Components i need, in order to construct gray level co occurance Matrix? while i am doing MR Brain images segmentation and classification in matlab. Thanking you in anticipation.
@ShawhinTalebi
@ShawhinTalebi 2 жыл бұрын
Hi Saad, thanks for the question. That sounds like an interesting project! A simple thing is to just use the explained variance from PCA (say >0.95) to determine the number of components, then keep the same component count for ICA. I'm sure there are more sophisticated tricks you can do based on the ultimate goal for the project. Hope that's helpful!
@saadawan477
@saadawan477 2 жыл бұрын
@@ShawhinTalebi Thanks for your reply. yeah i got it, i did it in the same way i.e No. of PCs= No. of ICs. Yes, it is helpful!
@alexeigilev8577
@alexeigilev8577 3 жыл бұрын
Is it possible (or does it make any sense) to apply ICA to participants ratings (behavioural data) on many variables?
@ShawhinTalebi
@ShawhinTalebi 3 жыл бұрын
Thanks for the question! Typically ICA requires time series data. If these ratings are indexed by time, ICA should work. Hope that helps!
@woodworkingaspirations1720
@woodworkingaspirations1720 11 ай бұрын
Well explained
@ShawhinTalebi
@ShawhinTalebi 11 ай бұрын
Thanks, glad it was clear!
@reza.partovi
@reza.partovi 2 жыл бұрын
It was a great video. To restore back the data, shouldn't we add the mean also? After doing the inverse pca tranformation.
@ShawhinTalebi
@ShawhinTalebi 2 жыл бұрын
Hi Reza, thanks for your comment! Yes that is a good point. In general, we also need to invert the normalization step (hidden in MATLAB's pca function) to get back to our original units. For EEG data, we may not care about this step since we are interested in signal oscillations (i.e. brain waves) rather than absolute voltage values. Thanks again, Shaw
@reza.partovi
@reza.partovi 2 жыл бұрын
Thank you Shaw
@manden_fruta
@manden_fruta Жыл бұрын
Hi Shawhin, thank you for the clear explanation about ICA I tried your code without any modifications and every time I ran the script, the results are different. Like everytime the resulting signal without blink is different in shape and amplitude, is that normal? Also, when I plot the original data (64 channels) vs the resulting data_noblink, each channel is not consistent regarding its positions (like data from channel 1 (Data(:,1)) is now in Data(:,6) and so on. My question is, is there a random effect of using ICA that I didn't catch when inverse PCA transform happens? if so, can I use a seed or similar to control this randomness?
@ShawhinTalebi
@ShawhinTalebi Жыл бұрын
Great question. The ICA implementation here introduces randomness into the code. Quickly skimming the MATLAB doc, it's not immediately obvious how one can control it, but I have provided the link below for you reference. www.mathworks.com/help/stats/rica.html#bvnjjp8-5 Hope that helps!
@manden_fruta
@manden_fruta Жыл бұрын
Thank you! @@ShawhinTalebi
@RahulSingh-up8jo
@RahulSingh-up8jo Жыл бұрын
Thank you!
@ShawhinTalebi
@ShawhinTalebi Жыл бұрын
Happy to help!
@manjukh22
@manjukh22 2 жыл бұрын
How to apply PCA and ICA for cognitive radio? Spectrum sensing and channel detection.
@ShawhinTalebi
@ShawhinTalebi 2 жыл бұрын
Hi Manjunatha, Thanks for the question! I'm sorry, I've never worked with that kind of data before. However if you have a set of time series like with EEG, the code I've shared here should work. Now, whether that gives anything useful is another matter. Sorry if that wasn't helpful. Perhaps someone with more experience with cognitive radio will chime in. Shaw
@manjukh22
@manjukh22 2 жыл бұрын
@@ShawhinTalebi Thanks for the reply sir. Great explanation. I will follow your instructions in the reply.
@shruthivenugopal5792
@shruthivenugopal5792 3 жыл бұрын
Is there any package to implement ICA in skicit -learn ?
@ShawhinTalebi
@ShawhinTalebi 3 жыл бұрын
Hi Sruthi, thank you for the comment. Yes, sklearn has an ica implementation. Here is a link to the doc: scikit-learn.org/stable/modules/generated/sklearn.decomposition.FastICA.html
@me-ou8rf
@me-ou8rf 3 ай бұрын
If I have EOG channels in my EEG data which already contains Eye Artefacts better then should I remove those channels before applying ICA ?
@ShawhinTalebi
@ShawhinTalebi 3 ай бұрын
Good question. I think you can leave those in. It may even improve the results. Alternatively, you can leave it out and use it to pick out the ICs which contain blink artifacts.
@me-ou8rf
@me-ou8rf 3 ай бұрын
@ShawhinTalebi thanks for reply. Is using ICA really necessary ? In many MI-EEG paper, they don't seem to use ICA for their deep learning architecture. They all use BCIC-IV 2a dataset. Is it because during Motor imagery task, which involves short time like 4s , not much eye blinking going on ? Or is the convolution layer automatically take care of that ?
@silvyarahmatiaraputri5133
@silvyarahmatiaraputri5133 2 жыл бұрын
hi, can ICA be used on NASA IMS bearing dataset?
@ShawhinTalebi
@ShawhinTalebi 2 жыл бұрын
Hi Silvya, thanks for the question. I'm not too familiar with that dataset. However, if it is a multivariate time series dataset, ICA is typically applicable.
@ardan7779
@ardan7779 3 жыл бұрын
Thanks!
@ShawhinTalebi
@ShawhinTalebi 3 жыл бұрын
Thanks for watching 😁
@JoshBugg
@JoshBugg Жыл бұрын
When you drop the blink components, are you dropping the columns or zeroing them out, as it says in the commented code?
@ShawhinTalebi
@ShawhinTalebi Жыл бұрын
Thanks for the question. I zero them out to keep the matrix the same shape. Otherwise, there might be issues in reconstructing the signal.
@JoshBugg
@JoshBugg Жыл бұрын
@@ShawhinTalebi Thanks for clarifying!
@danielkrupah
@danielkrupah 3 жыл бұрын
Please can you help me to estimate PCA for panel data using Stata. Thank you
@ShawhinTalebi
@ShawhinTalebi 3 жыл бұрын
Hi Daniel, I’m sorry I do not have experience with Stata. However, the PCA video may be helpful: kzbin.info/www/bejne/jXXNq5qkpt6tatU Hope that helps!
@sfnembedded
@sfnembedded 2 жыл бұрын
You have explained it so well, thank you. May I ask? Removing blink or the other noise, Can we do it with some combination such as HPF (High Pass Filter), LPF (Low Pass Filter), and BPF (Band Pass Filter) or there's any special use for ICA or PCA? in case of filtering signal. Thank you!
@ShawhinTalebi
@ShawhinTalebi 2 жыл бұрын
Absolutely! PCA and ICA are just another set of tools for the signal processing toolbox. So they can be combined with other filtering approaches. For example, one idea is to take a signal, copy it multiple times, and apply a different filter to each copy. Now you’re set up to do a PCA or ICA or both on this set of signals. Hope that answers your question. Please let me know if I missed it.
@sfnembedded
@sfnembedded 2 жыл бұрын
@@ShawhinTalebi It's clear right now. Appreciate it! Can you make a video about the theoretical way? I'm very curious about the signal analysis method
@ShawhinTalebi
@ShawhinTalebi 2 жыл бұрын
@@sfnembedded Thanks for the suggestion! I've been considering making an appendix to this series, and that sounds like a good fit for it.
@sfnembedded
@sfnembedded 2 жыл бұрын
@@ShawhinTalebi Thank you. Already subscribed, can't wait for more great content
@ShawhinTalebi
@ShawhinTalebi 2 жыл бұрын
​@@sfnembedded Thank you, I appreciate it!
@malcolmudeozor3264
@malcolmudeozor3264 Жыл бұрын
Hey! Great video! it seeams like your data is still autoscaled after transforming it back to its original form. Would you recommend un-Zscoring the data?
@ShawhinTalebi
@ShawhinTalebi Жыл бұрын
If you are going to use the raw values directly then yes, but if you are going to convert into spectral bands (eg alpha, beta, etc.) then I don’t think that’s necessary.
@alihamid8085
@alihamid8085 3 жыл бұрын
Could you please send me a link for EEG dataset description that used in this example.
@ShawhinTalebi
@ShawhinTalebi 3 жыл бұрын
Example code and data can be found at the GitHub linked in the description. Data is from me sitting quietly with my eyes open. Hope that helps!
@tanvikapdi1422
@tanvikapdi1422 3 жыл бұрын
can u pls guide how eeg can help with data related to brain disfunction
@ShawhinTalebi
@ShawhinTalebi 3 жыл бұрын
Thanks for the comment! I’m sorry that is not my area of expertise. I’m sure there is a good literature focused on that.
@bluehope4143
@bluehope4143 Жыл бұрын
Can you apply ICA for sharp spike noise removal from local field potentials?
@ShawhinTalebi
@ShawhinTalebi Жыл бұрын
That's a good question. The blink artifacts here are sharp spikes, and ICA does a decent job at handling them. But I'm sure there are cases where this breaks down. It's definitely worth a try!
@bluehope4143
@bluehope4143 Жыл бұрын
@Shawhin Talebi I gave it a try, it removes many spikes but not all. It was still very helpful and reduces my preprocessing work. Thanks!
@ShawhinTalebi
@ShawhinTalebi Жыл бұрын
@@bluehope4143 Good to know, thanks for reporting back :)
@PRASANTHPR-v1g
@PRASANTHPR-v1g Жыл бұрын
❤❤❤❤
@KongQuestCo
@KongQuestCo 3 жыл бұрын
I was gonna ask if they could use the eeg with their eyes closed. Then I remembered how you were getting the data lol
@ShawhinTalebi
@ShawhinTalebi 3 жыл бұрын
Yes
@עינת-ל
@עינת-ל 3 жыл бұрын
Thanx
@dtr_cpg
@dtr_cpg 2 жыл бұрын
Cool
@pravinandhale
@pravinandhale Жыл бұрын
@kumarpratap5115
@kumarpratap5115 6 ай бұрын
so ICA is used to separate the sources? and remove noise?
@ShawhinTalebi
@ShawhinTalebi 6 ай бұрын
Yes that's the idea. We separate the signal into constituent sources, some of which we can pick out as noise.
@physicswithamartya1061
@physicswithamartya1061 3 жыл бұрын
Sir can you provide a pdf note regarding it...
@ShawhinTalebi
@ShawhinTalebi 3 жыл бұрын
Hi Amartya, thank you for the comment. The blog dives a bit more into the details. Hope that is helpful! Blog: towardsdatascience.com/independent-component-analysis-ica-a3eba0ccec35
@physicswithamartya1061
@physicswithamartya1061 3 жыл бұрын
@@ShawhinTalebi 😇
@arvoli2596
@arvoli2596 2 жыл бұрын
Wow
@ShawhinTalebi
@ShawhinTalebi 2 жыл бұрын
🙌
@ITEMAE
@ITEMAE 2 жыл бұрын
分り易い!
@ShawhinTalebi
@ShawhinTalebi 2 жыл бұрын
Glad to hear, thanks for watching!
@fa7234
@fa7234 20 күн бұрын
This is very similar to wavelet noise reduction
@GregoryMonk-o5b
@GregoryMonk-o5b Ай бұрын
Ralph Place
@ShawhinTalebi
@ShawhinTalebi 2 жыл бұрын
📰Read more: towardsdatascience.com/independent-component-analysis-ica-a3eba0ccec35?sk=6ddb9ae6d343de7f667255ab564099dd
Independent Component Analysis 1
50:51
Nathan Kutz
Рет қаралды 30 М.
Can You Find Hulk's True Love? Real vs Fake Girlfriend Challenge | Roblox 3D
00:24
快乐总是短暂的!😂 #搞笑夫妻 #爱美食爱生活 #搞笑达人
00:14
朱大帅and依美姐
Рет қаралды 10 МЛН
Haunted House 😰😨 LeoNata family #shorts
00:37
LeoNata Family
Рет қаралды 16 МЛН
Artifact Removal Using ICA
7:36
math et al
Рет қаралды 21 М.
StatQuest: Principal Component Analysis (PCA), Step-by-Step
21:58
StatQuest with Josh Starmer
Рет қаралды 2,9 МЛН
StatQuest: Linear Discriminant Analysis (LDA) clearly explained.
15:12
StatQuest with Josh Starmer
Рет қаралды 777 М.
Fine-Tuning BERT for Text Classification (Python Code)
23:24
Shaw Talebi
Рет қаралды 4,9 М.
An introduction to Reinforcement Learning
16:27
Arxiv Insights
Рет қаралды 660 М.
EEG Eye Blink Artifact Removal With Independent Component Analysis (ICA)
9:46
Jared Beckwith, R. EEG T.
Рет қаралды 6 М.
Support Vector Machines: All you need to know!
14:58
Intuitive Machine Learning
Рет қаралды 157 М.
Hidden Markov Model : Data Science Concepts
13:52
ritvikmath
Рет қаралды 126 М.
Can You Find Hulk's True Love? Real vs Fake Girlfriend Challenge | Roblox 3D
00:24