Confusion around Consensus parameter in Autoreject and ICA

Hello everyone,
I specially mention @mainakjas and @richard because it’s an AutoReject related question.

I have read the thesis and the article along with the GitHub repo and some forum discussions and I am confused about how to choose consensus parameter.

In the thesis, k is the maximum number of bad sensors in a non rejected trial and on github I see that consensus = k/Q where Q is the total number of sensors.

So basically with a 64channels montage; if I want my good epoch to have a maximum of 10 bad sensors I have to choose consensus = 10/64 = 0.15 so I could try consensus = np.linspace(0, 0.15, 5) for example ? (this is option 1)

Because if I consider the definition of consensus given only on the github it says consensus is
“The values to try for percentage of channels that must agree as a fraction of the total number of channels” and for me that means consensus is : at least how many good channels should a good epoch have and this is 1- 10/64 if I used the same example as previously, which give consensus = np.linspace(0.85, 1, 5). (this is option 2)

And I must say, results are very different based on the good definition of the consensus parameter.

So which one is the good definition : the 1) or the 2nd) ?

Another question I have is regarding use of Autoreject local before and after ICA : if we apply transform on both it seems to me as we are doing bad channel interpolation 2 times, isn’t it too much ?

Thank you very much for your help.

Hi –

Sorry for the late response … if you want my attention sooner, please post on the autoreject github.

You are confusing rho and consensus (k). Rho is the maximum number of bad sensors in a trial. Consensus is the fraction of sensors (0 to 1) that need to be bad for the trial to be declared bad.

Regarding use of autoreject before and after ICA, please see this example: https://autoreject.github.io/stable/auto_examples/plot_autoreject_workflow.html#sphx-glr-auto-examples-plot-autoreject-workflow-py

Note that the first application of autoreject does not do interpolation on the actual epochs. It is only used to help the ICA algorithm.

Hope that helps,
Mainak

Hello @mainakjas ,
Thank you for your answer.

So if I understood right, following my example, if I want to consider a trial as bad if it has 10 or more bad channels (on a 64channels montage) I have to select consensus = np.linspace(10/64, 64/64, 5) for example ?

On ICA, I had a doubt due to the note where it’s stated
“We recommend that you first highpass filter the data, then run autoreject (local) and supply the bad epochs detected by it to the ICA algorithm for a robust fit, and finally run autoreject (local) again”

but in the example I only see that we fit the ICA on clean epochs : "ica.fit(epochs[~reject_log.bad_epochs])
So, when do we supply the ICA the bad epochs ? or is it that just by specifying reject_log.bad_epochs ica internally knows which channels are bad ?

Sorry my basic questions and thank you very much for your help.

Hi –

If you want to fix the consensus parameter so that the trial is bad if it has more than 10 bad channels, then you should provide a list with a single element. That is consensus = [10/64].

Regarding your question, you are correct that ICA isn’t provided the bad epochs. The phrasing is incorrect and we should fix it. The ICA algorithm is provided with epochs that do not contain bad data segments.

Hope that clarifies things for you.

Mainak

1 Like

Thank you very much for your clear answers.