<p><span style="padding: 3px 10px; border-radius: 5px; color: #ffffff; font-weight: bold; display: inline-block; background-color: #ff0000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;External Email - Use Caution&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></p><p></p><div dir="ltr">Hello,<div><br></div><div>I would like to check whether, once the influence of some confound variables is ruled out, my decoding still works (EEG data). </div><div>To do so, I thought to try the cross-validated &quot;confound regression&quot; described in <a href="https://secure-web.cisco.com/1ni3y8J6xZXcf5o3KPFNk6U313fE6N5vcmAuJGOmJTv98GdPW9u0zZEhdh-kXMyZZ5LlCEAw6ZvbwnMX36hp_DICC616sLn7tvjNXHVIzktFf4ZnMJlFrUBVncwY28FroSoWwBckoj8atB8RQQtcq5uKv5Tlh5k9oVblcxyVUmX43jj4mctL48Xo862JphSPO7q2rj2Wul6NCLrz_PTpOHk5MedEbub_IgdZhWrVSjVlDCaOD8ONU2nq4-Kagp0CWmPk3b2vrKwh5OtkW_phc5Q/https%3A%2F%2Fwww.sciencedirect.com%2Fscience%2Farticle%2Fpii%2FS1053811918319463">this paper</a>. The code for that is in Github: </div><div><a href="https://secure-web.cisco.com/1iLimRkNJpKP4OGM7F90HkY2QAK_g2Q_tcxxWfAVgh1PWR0zMBdJRD8ipMG4YL_twA8YjtkR72AAHd64-9qVJnjG3ulxd6eOPGqMv3MLQxBYWh8Hd5HflxbvYFS6DTe7b2ixDBnj685cgTQBWFHWITu7jF2ycfq0l6nmUlSNkb9Sl1GyQ4akYkOynxpjIBEYz0OnBbXCECZlH4oh7vkIFcbOC3RS6IVzLymk9YOhHl02iW03x91wuKfg9jrZcCtxhbChHpLHW2OZPNyZFvehhOQ/https%3A%2F%2Fgithub.com%2Flukassnoek%2FMVCA%2Fblob%2Fmaster%2Fanalyses%2Fconfounds.py"><font color="red"><b>MailScanner has detected a possible fraud attempt from "secure-web.cisco.com" claiming to be</b></font> https://github.com/lukassnoek/MVCA/blob/master/analyses/confounds.py</a><br></div><div><br></div><div>The ConfoundRegressor works when I select just one time point, e.g. :</div><div><br></div><div><div style="color:rgb(212,212,212);background-color:rgb(30,30,30);font-family:Consolas,&quot;Courier New&quot;,monospace;font-size:14px;line-height:19px;white-space:pre"><div>temp_data = epochs_train.get_data()</div><div>temp_c = epochs_train.metadata.values</div><br><div>cfr = ConfoundRegressor(<span style="color:rgb(156,220,254)">confound</span>=temp_c, <span style="color:rgb(156,220,254)">X</span>=temp_data[:,:,<span style="color:rgb(181,206,168)">100</span>])</div><div>X_train_corr = cfr.fit_transform(temp_data[:,:,<span style="color:rgb(181,206,168)">100</span>])</div></div></div><div><br></div><div>However, when I try to insert it in the slider I don&#39;t manage to make it work:</div><div><div style="color:rgb(212,212,212);background-color:rgb(30,30,30);font-family:Consolas,&quot;Courier New&quot;,monospace;font-size:14px;line-height:19px;white-space:pre"><div>cfr = ConfoundRegressor(<span style="color:rgb(156,220,254)">confound</span>=temp_c, <span style="color:rgb(156,220,254)">X</span>=temp_data)</div><div>confound_slider = GeneralizingEstimator(cfr)</div></div></div><div><div style="color:rgb(212,212,212);background-color:rgb(30,30,30);font-family:Consolas,&quot;Courier New&quot;,monospace;font-size:14px;line-height:19px;white-space:pre"><div>epochs_train_corr = confound_slider.fit_transform(temp_data, <span style="color:rgb(156,220,254)">y</span>=<span style="color:rgb(86,156,214)">None</span>)</div></div></div><div><br></div><br>IndexError                                Traceback (most recent call last)<br>/neurospin/grip/protocols/EEG/Giulia_NUM_MUSIK/TRY_confound_regressor.py in &lt;mod                 ule&gt;<br>    210 confound_slider = GeneralizingEstimator(cfr)<br>    211<br>--&gt; 212 epochs_train_corr = confound_slider.fit_transform(temp_data, y=None)<br>    213<br>    214<br><br>~/anaconda3/lib/python3.8/site-packages/mne/decoding/search_light.py in fit_tran                 sform(self, X, y, **fit_params)<br>    127             The predicted values for each estimator.<br>    128         &quot;&quot;&quot;  # noqa: E501<br>--&gt; 129         return self.fit(X, y, **fit_params).transform(X)<br>    130<br>    131     @verbose  # to use the class value<br><br>&lt;decorator-gen-407&gt; in fit(self, X, y, **fit_params)<br><br>~/anaconda3/lib/python3.8/site-packages/mne/decoding/search_light.py in fit(self                 , X, y, **fit_params)<br>     91         mesg = &#39;Fitting %s&#39; % (self.__class__.__name__,)<br>     92         with ProgressBar(X.shape[-1], mesg=mesg) as pb:<br>---&gt; 93             estimators = parallel(<br>     94                 p_func(self.base_estimator, split, y, pb.subset(pb_idx),<br>     95                        **fit_params)<br><br>~/anaconda3/lib/python3.8/site-packages/mne/decoding/search_light.py in &lt;genexpr                 &gt;(.0)<br>     92         with ProgressBar(X.shape[-1], mesg=mesg) as pb:<br>     93             estimators = parallel(<br>---&gt; 94                 p_func(self.base_estimator, split, y, pb.subset(pb_idx),<br>     95                        **fit_params)<br>     96                 for pb_idx, split in array_split_idx(X, n_jobs, axis=-1)                 )<br><br>~/anaconda3/lib/python3.8/site-packages/mne/decoding/search_light.py in _sl_fit(                 estimator, X, y, pb, **fit_params)<br>    330     for ii in range(X.shape[-1]):<br>    331         est = clone(estimator)<br>--&gt; 332         est.fit(X[..., ii], y, **fit_params)<br>    333         estimators_.append(est)<br>    334         pb.update(ii + 1)<br><br>/neurospin/grip/protocols/EEG/Giulia_NUM_MUSIK/confounds.py in fit(self                 , X, y)<br>     84             self.X = self.X[:, self.nonzero_X_]<br>     85<br>---&gt; 86         X_nz = X[:, self.nonzero_X_]<br>     87         confound = self.confound<br>     88<div><br>IndexError: too many indices for array: array is 2-dimensional, but 3 were indexed<br><div><br></div><div>Little help? Would you know what this error is related to?</div><div><br></div><div>Thank you, in advance.</div><div><br></div><div>Giulia</div></div></div>