# summary performance for ICA

**URL:** <https://mne.discourse.group/t/summary-performance-for-ica/863>\
**Category:** Mailing List Archive (read-only)\
**Tags:** list-archive\
**Created:** [October 27, 2014, 6:14pm UTC](https://mne.discourse.group/t/summary-performance-for-ica/863 "2014-10-27T18:14:25Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [October 27, 2014, 6:14pm UTC](https://mne.discourse.group/t/summary-performance-for-ica/863/1 "2014-10-27T18:14:25Z")

</div>

Hi,

I used ICA for removing EOG and ECG (using CTPS) artifact.

Is there a function to compute the percentage of amplitude of the raw data was removed from the cardiac components (based the epoch with R peak as onset) ?

Thanks!

Best, Yuhan  
-------------- next part --------------  
An HTML attachment was scrubbed...  
URL: [http://mail.nmr.mgh.harvard.edu/pipermail/mne\_analysis/attachments/20141027/c41a6c10/attachment.html](http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20141027/c41a6c10/attachment.html)

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [October 27, 2014, 6:26pm UTC](https://mne.discourse.group/t/summary-performance-for-ica/863/2 "2014-10-27T18:26:17Z")

</div>

Hi Yuan,

that would be a nice addition. Either using r^2 or RMS differences as a metric. If you are interested in making a contribution I'd be happy to supervise you and review. I even have some private code for that.

-- Denis

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [November 3, 2014, 7:43pm UTC](https://mne.discourse.group/t/summary-performance-for-ica/863/3 "2014-11-03T19:43:22Z")

</div>

Hi Yuhan,

I include the mailing list in this part of our conversation because this  
might be interesting for other people as well.

2014-11-03 20:30 GMT+01:00 Chen, Yu-han \<CHENY4 at email.chop.edu\>:

> Hi Dennis,
> 
> I (...) figured out that the SSP was turned on during epoching. Our

original problem is that when we tried to epoch raw data, ICA cleaned data,  
ECG signal, the averaged ECG epoch is flat (zeros across the entire epoch).  
When we set proj = False for mne.Epoch, the problem is resolved. Is it true  
that by default, Epoch.py will set the SSP on?

> 

Yes, you need to take care of this. Anyways I'm surprised you're getting  
flat signals. What kind of SSPs did you include?

> The data I feed in is the Elekta data with maxfiltered tsss and movement

correction applied.

> 

Normally you have SSPS included in the raws if you don't use maxfilter. But  
think there's no point in using those if you have maxfiltered your data.  
If you aim to identify biological artifacts using ICA there is no point in  
having ECG/EOG projections.  
When using maxfilter and ICA, you should not necessarily use SSP in  
addition.  
FYI I'd recommend to look up the number of dimensions estimated by  
maxfilter from the log or recover it by estimating the rank of the data and  
using this as input to ICA(n\_components).

HTH,  
Denis

PS: what about the performance metric, still interested in contributing it?  
😉

> Thanks!  
> Yuhan

-------------- next part --------------  
An HTML attachment was scrubbed...  
URL: [http://mail.nmr.mgh.harvard.edu/pipermail/mne\_analysis/attachments/20141103/8f1cf991/attachment.html](http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20141103/8f1cf991/attachment.html)

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [November 3, 2014, 8:19pm UTC](https://mne.discourse.group/t/summary-performance-for-ica/863/4 "2014-11-03T20:19:51Z")

</div>

Hi Dennis,

Thanks a lot for youre reply. Please see my answers below:

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [November 3, 2014, 8:38pm UTC](https://mne.discourse.group/t/summary-performance-for-ica/863/5 "2014-11-03T20:38:53Z")

</div>

Hi Yu-han,

take a look at this preprocessing script which I wrote to handle ICA for  
Neuromag + EEG recordings with maxfilter present.  
It's a prototype and might become a function / script at later stages.  
Testing + input welcome, I'm trying not to overfilt the recordings from our  
lab.

> <https://gist.github.com/dengemann/da7068af7babdfbf12a2>

HTH,  
Denis

2014-11-03 21:19 GMT+01:00 Chen, Yu-han \<CHENY4 at email.chop.edu\>:

> Hi Dennis,
> 
> Thanks a lot for youre reply. Please see my answers below:
> 
> &nbsp;&nbsp;From: Denis-Alexander Engemann \<denis.engemann at gmail.com\>  
> Date: Monday, November 3, 2014 2:43 PM  
> To: The Children's Hospital of Philadelphia The Children's Hospital of  
> Philadelphia \<cheny4 at email.chop.edu\>, "\<Mne\_analysis at nmr.mgh.harvard.edu\>"  
> \<Mne\_analysis at nmr.mgh.harvard.edu\>  
> Subject: Re: [Mne\_analysis] summary performance for ICA
> 
> &nbsp;&nbsp;Hi Yuhan,
> 
> I include the mailing list in this part of our conversation because this  
> might be interesting for other people as well.
> 
> 2014-11-03 20:30 GMT+01:00 Chen, Yu-han \<CHENY4 at email.chop.edu\>:  
> \>  
> \> Hi Dennis,  
> \>  
> \> I (...) figured out that the SSP was turned on during epoching. Our  
> original problem is that when we tried to epoch raw data, ICA cleaned data,  
> ECG signal, the averaged ECG epoch is flat (zeros across the entire epoch).  
> When we set proj = False for mne.Epoch, the problem is resolved. Is it true  
> that by default, Epoch.py will set the SSP on?  
> \>
> 
> Yes, you need to take care of this. Anyways I'm surprised you're getting  
> flat signals. What kind of SSPs did you include?
> 
> \*\*\* I didn't intentionally include any SSPs when I read in the data so I  
> don't know what type of SSP was included.
> 
> \>  
> \> The data I feed in is the Elekta data with maxfiltered tsss and movement  
> correction applied.  
> \>
> 
> Normally you have SSPS included in the raws if you don't use maxfilter.  
> But think there's no point in using those if you have maxfiltered your data.  
> If you aim to identify biological artifacts using ICA there is no point in  
> having ECG/EOG projections.  
> When using maxfilter and ICA, you should not necessarily use SSP in  
> addition.  
> FYI I'd recommend to look up the number of dimensions estimated by  
> maxfilter from the log or recover it by estimating the rank of the data and  
> using this as input to ICA(n\_components).
> 
> \*\*\* I wasn't planning to use SSP. In my case the SSPS was off when I  
> read in maxfiltered raw data. For some reason when I epoch the raw data, by  
> default the SSP was set on. So I think the Epoch.py function just set SSP  
> on. Should I always assume the SSP is on when I epoch any type of raw  
> Elekta data no matter the maxfilter was applied or not?
> 
> \*\*\* the n\_components I used for ICA is 95% assuming 5% of our data is  
> noise. I realized I don't have the number of dimensions extimated from the  
> maxfilter log. Is this something I should specifically set when I run  
> maxfilter? Also could you please tell e how to get the estimated ran of the  
> data?
> 
> HTH,  
> Denis
> 
> PS: what about the performance metric, still interested in contributing  
> it? 😉
> 
> \*\*\* I'm still using the exact same code from Juergen and I thought that  
> was already shared and uploaded to gitHub?
> 
> \> Thanks!  
> \> Yuhan

-------------- next part --------------  
An HTML attachment was scrubbed...  
URL: [http://mail.nmr.mgh.harvard.edu/pipermail/mne\_analysis/attachments/20141103/9eecc11e/attachment.html](http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20141103/9eecc11e/attachment.html)

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [November 3, 2014, 9:32pm UTC](https://mne.discourse.group/t/summary-performance-for-ica/863/6 "2014-11-03T21:32:04Z")

</div>

Thanks Dennis! This is very helpful.

I'm also trying to make the preprocessing script later become a function. I will let you know how it goes.

Best, Yuhan

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [November 3, 2014, 9:55pm UTC](https://mne.discourse.group/t/summary-performance-for-ica/863/7 "2014-11-03T21:55:30Z")

</div>

Hi Yuhan,

for the moment it would be great to just receive some feedback about it  
works for your data.  
I need to update the script, during the last week I singled out a series of  
issues with filtering, which are relevant  
for certain datasets. I still need to update this example accordingly. It  
will be more important to converge on and decide about the most general and  
relevant use cases before wrapping it in function. Also note that this is  
specifically fitted to MEG and EEG datasets which come with EOG and ECG  
recordings. The idea would be end up with a good preprocessing script that  
does the job well in 80% of the cases.

Feel free to keep me posted about how it goes for you and don't hesitate to  
ask me if something is not clear or behaves unexpectedly.

Best,  
Denis

2014-11-03 22:32 GMT+01:00 Chen, Yu-han \<CHENY4 at email.chop.edu\>:

> Thanks Dennis! This is very helpful.
> 
> I'm also trying to make the preprocessing script later become a  
> function. I will let you know how it goes.
> 
> Best, Yuhan
> 
> &nbsp;&nbsp;From: Denis-Alexander Engemann \<denis.engemann at gmail.com\>  
> Reply-To: Discussion and support forum for the users of MNE Software \<  
> mne\_analysis at nmr.mgh.harvard.edu\>  
> Date: Monday, November 3, 2014 3:38 PM  
> To: The Children's Hospital of Philadelphia The Children's Hospital of  
> Philadelphia \<cheny4 at email.chop.edu\>  
> Cc: "\<Mne\_analysis at nmr.mgh.harvard.edu\>" \<Mne\_analysis at nmr.mgh.harvard.edu  
> \>  
> Subject: Re: [Mne\_analysis] summary performance for ICA
> 
> become
> 
> \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
> Mne\_analysis mailing list  
> Mne\_analysis at nmr.mgh.harvard.edu  
> [https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne\_analysis](https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis)
> 
> The information in this e-mail is intended only for the person to whom it  
> is  
> addressed. If you believe this e-mail was sent to you in error and the  
> e-mail  
> contains patient information, please contact the Partners Compliance  
> HelpLine at  
> [http://www.partners.org/complianceline](http://www.partners.org/complianceline) . If the e-mail was sent to you in  
> error  
> but does not contain patient information, please contact the sender and  
> properly  
> dispose of the e-mail.

-------------- next part --------------  
An HTML attachment was scrubbed...  
URL: [http://mail.nmr.mgh.harvard.edu/pipermail/mne\_analysis/attachments/20141103/367854bf/attachment.html](http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20141103/367854bf/attachment.html)

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [November 29, 2014, 8:12pm UTC](https://mne.discourse.group/t/summary-performance-for-ica/863/8 "2014-11-29T20:12:05Z")

</div>

Hi Yuhan, dear list,

I meanwhile transformed my script into a function, improved the code and  
added tests.

You can access it here:

> **[GitHub - dengemann/meeg-preprocessing: Preprocessing tools for MEG/EEG](https://github.com/dengemann/meeg-preprocessing)**
>
> Preprocessing tools for MEG/EEG. Contribute to dengemann/meeg-preprocessing development by creating an account on GitHub.

This is how the output looks like for the example script:

> **[preprocessing-report-sample.html](https://www.dropbox.com/s/j8r2ujbnsgq5njr/preprocessing-report-sample.html?dl=0)**
>
> Shared with Dropbox

Feel free to use it, to suggest improvements or to contribute.

Best,  
Denis

2014-11-03 22:55 GMT+01:00 Denis-Alexander Engemann \<  
denis.engemann at gmail.com\>:

> Hi Yuhan,
> 
> for the moment it would be great to just receive some feedback about it  
> works for your data.  
> I need to update the script, during the last week I singled out a series  
> of issues with filtering, which are relevant  
> for certain datasets. I still need to update this example accordingly. It  
> will be more important to converge on and decide about the most general and  
> relevant use cases before wrapping it in function. Also note that this is  
> specifically fitted to MEG and EEG datasets which come with EOG and ECG  
> recordings. The idea would be end up with a good preprocessing script that  
> does the job well in 80% of the cases.
> 
> Feel free to keep me posted about how it goes for you and don't hesitate  
> to ask me if something is not clear or behaves unexpectedly.
> 
> Best,  
> Denis
> 
> 2014-11-03 22:32 GMT+01:00 Chen, Yu-han \<CHENY4 at email.chop.edu\>:
> 
> > Thanks Dennis! This is very helpful.
> > 
> > I'm also trying to make the preprocessing script later become a  
> > function. I will let you know how it goes.
> > 
> > Best, Yuhan
> > 
> > &nbsp;&nbsp;From: Denis-Alexander Engemann \<denis.engemann at gmail.com\>  
> > Reply-To: Discussion and support forum for the users of MNE Software \<  
> > mne\_analysis at nmr.mgh.harvard.edu\>  
> > Date: Monday, November 3, 2014 3:38 PM  
> > To: The Children's Hospital of Philadelphia The Children's Hospital of  
> > Philadelphia \<cheny4 at email.chop.edu\>  
> > Cc: "\<Mne\_analysis at nmr.mgh.harvard.edu\>" \<  
> > Mne\_analysis at nmr.mgh.harvard.edu\>  
> > Subject: Re: [Mne\_analysis] summary performance for ICA
> > 
> > become
> > 
> > \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
> > Mne\_analysis mailing list  
> > Mne\_analysis at nmr.mgh.harvard.edu  
> > [Mne\_analysis Info Page](https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis)
> > 
> > The information in this e-mail is intended only for the person to whom it  
> > is  
> > addressed. If you believe this e-mail was sent to you in error and the  
> > e-mail  
> > contains patient information, please contact the Partners Compliance  
> > HelpLine at  
> > [MyComplianceReport.com: Compliance and Ethics Reporting](http://www.partners.org/complianceline) . If the e-mail was sent to you  
> > in error  
> > but does not contain patient information, please contact the sender and  
> > properly  
> > dispose of the e-mail.

-------------- next part --------------  
An HTML attachment was scrubbed...  
URL: [http://mail.nmr.mgh.harvard.edu/pipermail/mne\_analysis/attachments/20141129/d6d20055/attachment.html](http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20141129/d6d20055/attachment.html)
