Note

Click here to download the full example code

# Receptive Field Estimation and Prediction¶

This example reproduces figures from Lalor et al’s mTRF toolbox in
matlab 1. We will show how the
`mne.decoding.ReceptiveField`

class
can perform a similar function along with scikit-learn. We will first fit a
linear encoding model using the continuously-varying speech envelope to predict
activity of a 128 channel EEG system. Then, we will take the reverse approach
and try to predict the speech envelope from the EEG (known in the literature
as a decoding model, or simply stimulus reconstruction).

```
# Authors: Chris Holdgraf <choldgraf@gmail.com>
# Eric Larson <larson.eric.d@gmail.com>
# Nicolas Barascud <nicolas.barascud@ens.fr>
#
# License: BSD (3-clause)
import numpy as np
import matplotlib.pyplot as plt
from scipy.io import loadmat
from os.path import join
import mne
from mne.decoding import ReceptiveField
from sklearn.model_selection import KFold
from sklearn.preprocessing import scale
```

## Load the data from the publication¶

First we will load the data collected in 1. In this experiment subjects listened to natural speech. Raw EEG and the speech stimulus are provided. We will load these below, downsampling the data in order to speed up computation since we know that our features are primarily low-frequency in nature. Then we’ll visualize both the EEG and speech envelope.

```
path = mne.datasets.mtrf.data_path()
decim = 2
data = loadmat(join(path, 'speech_data.mat'))
raw = data['EEG'].T
speech = data['envelope'].T
sfreq = float(data['Fs'])
sfreq /= decim
speech = mne.filter.resample(speech, down=decim, npad='auto')
raw = mne.filter.resample(raw, down=decim, npad='auto')
# Read in channel positions and create our MNE objects from the raw data
montage = mne.channels.make_standard_montage('biosemi128')
info = mne.create_info(montage.ch_names, sfreq, 'eeg').set_montage(montage)
raw = mne.io.RawArray(raw, info)
n_channels = len(raw.ch_names)
# Plot a sample of brain and stimulus activity
fig, ax = plt.subplots()
lns = ax.plot(scale(raw[:, :800][0].T), color='k', alpha=.1)
ln1 = ax.plot(scale(speech[0, :800]), color='r', lw=2)
ax.legend([lns[0], ln1[0]], ['EEG', 'Speech Envelope'], frameon=False)
ax.set(title="Sample activity", xlabel="Time (s)")
mne.viz.tight_layout()
```

Out:

```
Creating RawArray with float64 data, n_channels=128, n_times=7677
Range : 0 ... 7676 = 0.000 ... 119.938 secs
Ready.
```

## Create and fit a receptive field model¶

We will construct an encoding model to find the linear relationship between a time-delayed version of the speech envelope and the EEG signal. This allows us to make predictions about the response to new stimuli.

```
# Define the delays that we will use in the receptive field
tmin, tmax = -.2, .4
# Initialize the model
rf = ReceptiveField(tmin, tmax, sfreq, feature_names=['envelope'],
estimator=1., scoring='corrcoef')
# We'll have (tmax - tmin) * sfreq delays
# and an extra 2 delays since we are inclusive on the beginning / end index
n_delays = int((tmax - tmin) * sfreq) + 2
n_splits = 3
cv = KFold(n_splits)
# Prepare model data (make time the first dimension)
speech = speech.T
Y, _ = raw[:] # Outputs for the model
Y = Y.T
# Iterate through splits, fit the model, and predict/test on held-out data
coefs = np.zeros((n_splits, n_channels, n_delays))
scores = np.zeros((n_splits, n_channels))
for ii, (train, test) in enumerate(cv.split(speech)):
print('split %s / %s' % (ii + 1, n_splits))
rf.fit(speech[train], Y[train])
scores[ii] = rf.score(speech[test], Y[test])
# coef_ is shape (n_outputs, n_features, n_delays). we only have 1 feature
coefs[ii] = rf.coef_[:, 0, :]
times = rf.delays_ / float(rf.sfreq)
# Average scores and coefficients across CV splits
mean_coefs = coefs.mean(axis=0)
mean_scores = scores.mean(axis=0)
# Plot mean prediction scores across all channels
fig, ax = plt.subplots()
ix_chs = np.arange(n_channels)
ax.plot(ix_chs, mean_scores)
ax.axhline(0, ls='--', color='r')
ax.set(title="Mean prediction score", xlabel="Channel", ylabel="Score ($r$)")
mne.viz.tight_layout()
```

Out:

```
split 1 / 3
Fitting 1 epochs, 1 channels
0%| | Sample : 0/2 [00:00<?, ?it/s]
50%|##### | Sample : 1/2 [00:00<00:00, 11.58it/s]
100%|##########| Sample : 2/2 [00:00<00:00, 11.80it/s]
100%|##########| Sample : 2/2 [00:00<00:00, 12.83it/s]
split 2 / 3
Fitting 1 epochs, 1 channels
0%| | Sample : 0/2 [00:00<?, ?it/s]
50%|##### | Sample : 1/2 [00:00<00:00, 24.92it/s]
100%|##########| Sample : 2/2 [00:00<00:00, 24.96it/s]
100%|##########| Sample : 2/2 [00:00<00:00, 22.99it/s]
split 3 / 3
Fitting 1 epochs, 1 channels
0%| | Sample : 0/2 [00:00<?, ?it/s]
50%|##### | Sample : 1/2 [00:00<00:00, 18.18it/s]
100%|##########| Sample : 2/2 [00:00<00:00, 18.17it/s]
100%|##########| Sample : 2/2 [00:00<00:00, 17.96it/s]
```

### Investigate model coefficients¶

Finally, we will look at how the linear coefficients (sometimes referred to as beta values) are distributed across time delays as well as across the scalp. We will recreate figure 1 and figure 2 from 1.

```
# Print mean coefficients across all time delays / channels (see Fig 1)
time_plot = 0.180 # For highlighting a specific time.
fig, ax = plt.subplots(figsize=(4, 8))
max_coef = mean_coefs.max()
ax.pcolormesh(times, ix_chs, mean_coefs, cmap='RdBu_r',
vmin=-max_coef, vmax=max_coef, shading='gouraud')
ax.axvline(time_plot, ls='--', color='k', lw=2)
ax.set(xlabel='Delay (s)', ylabel='Channel', title="Mean Model\nCoefficients",
xlim=times[[0, -1]], ylim=[len(ix_chs) - 1, 0],
xticks=np.arange(tmin, tmax + .2, .2))
plt.setp(ax.get_xticklabels(), rotation=45)
mne.viz.tight_layout()
# Make a topographic map of coefficients for a given delay (see Fig 2C)
ix_plot = np.argmin(np.abs(time_plot - times))
fig, ax = plt.subplots()
mne.viz.plot_topomap(mean_coefs[:, ix_plot], pos=info, axes=ax, show=False,
vmin=-max_coef, vmax=max_coef)
ax.set(title="Topomap of model coefficients\nfor delay %s" % time_plot)
mne.viz.tight_layout()
```

## Create and fit a stimulus reconstruction model¶

We will now demonstrate another use case for the for the
`mne.decoding.ReceptiveField`

class as we try to predict the stimulus
activity from the EEG data. This is known in the literature as a decoding, or
stimulus reconstruction model 1.
A decoding model aims to find the
relationship between the speech signal and a time-delayed version of the EEG.
This can be useful as we exploit all of the available neural data in a
multivariate context, compared to the encoding case which treats each M/EEG
channel as an independent feature. Therefore, decoding models might provide a
better quality of fit (at the expense of not controlling for stimulus
covariance), especially for low SNR stimuli such as speech.

```
# We use the same lags as in :footcite:`CrosseEtAl2016`. Negative lags now
# index the relationship
# between the neural response and the speech envelope earlier in time, whereas
# positive lags would index how a unit change in the amplitude of the EEG would
# affect later stimulus activity (obviously this should have an amplitude of
# zero).
tmin, tmax = -.2, 0.
# Initialize the model. Here the features are the EEG data. We also specify
# ``patterns=True`` to compute inverse-transformed coefficients during model
# fitting (cf. next section and :footcite:`HaufeEtAl2014`).
# We'll use a ridge regression estimator with an alpha value similar to
# Crosse et al.
sr = ReceptiveField(tmin, tmax, sfreq, feature_names=raw.ch_names,
estimator=1e4, scoring='corrcoef', patterns=True)
# We'll have (tmax - tmin) * sfreq delays
# and an extra 2 delays since we are inclusive on the beginning / end index
n_delays = int((tmax - tmin) * sfreq) + 2
n_splits = 3
cv = KFold(n_splits)
# Iterate through splits, fit the model, and predict/test on held-out data
coefs = np.zeros((n_splits, n_channels, n_delays))
patterns = coefs.copy()
scores = np.zeros((n_splits,))
for ii, (train, test) in enumerate(cv.split(speech)):
print('split %s / %s' % (ii + 1, n_splits))
sr.fit(Y[train], speech[train])
scores[ii] = sr.score(Y[test], speech[test])[0]
# coef_ is shape (n_outputs, n_features, n_delays). We have 128 features
coefs[ii] = sr.coef_[0, :, :]
patterns[ii] = sr.patterns_[0, :, :]
times = sr.delays_ / float(sr.sfreq)
# Average scores and coefficients across CV splits
mean_coefs = coefs.mean(axis=0)
mean_patterns = patterns.mean(axis=0)
mean_scores = scores.mean(axis=0)
max_coef = np.abs(mean_coefs).max()
max_patterns = np.abs(mean_patterns).max()
```

Out:

```
split 1 / 3
Fitting 1 epochs, 128 channels
0%| | Sample : 0/8384 [00:00<?, ?it/s]
0%| | Sample : 1/8384 [00:00<08:53, 15.72it/s]
0%| | Sample : 31/8384 [00:00<08:25, 16.54it/s]
1%| | Sample : 64/8384 [00:00<07:58, 17.40it/s]
1%|1 | Sample : 98/8384 [00:00<07:32, 18.31it/s]
2%|1 | Sample : 131/8384 [00:00<07:08, 19.26it/s]
2%|1 | Sample : 165/8384 [00:00<06:45, 20.27it/s]
2%|2 | Sample : 199/8384 [00:00<06:23, 21.32it/s]
3%|2 | Sample : 234/8384 [00:00<06:03, 22.43it/s]
3%|3 | Sample : 268/8384 [00:00<05:43, 23.60it/s]
4%|3 | Sample : 302/8384 [00:00<05:25, 24.83it/s]
4%|4 | Sample : 336/8384 [00:00<05:08, 26.12it/s]
4%|4 | Sample : 370/8384 [00:00<04:51, 27.48it/s]
5%|4 | Sample : 405/8384 [00:00<04:36, 28.90it/s]
5%|5 | Sample : 439/8384 [00:00<04:21, 30.40it/s]
6%|5 | Sample : 473/8384 [00:00<04:07, 31.98it/s]
6%|6 | Sample : 508/8384 [00:00<03:54, 33.64it/s]
6%|6 | Sample : 543/8384 [00:00<03:41, 35.38it/s]
7%|6 | Sample : 578/8384 [00:00<03:29, 37.21it/s]
7%|7 | Sample : 612/8384 [00:00<03:18, 39.13it/s]
8%|7 | Sample : 646/8384 [00:00<03:08, 41.15it/s]
8%|8 | Sample : 680/8384 [00:00<02:58, 43.27it/s]
9%|8 | Sample : 714/8384 [00:00<02:48, 45.50it/s]
9%|8 | Sample : 749/8384 [00:00<02:39, 47.84it/s]
9%|9 | Sample : 784/8384 [00:00<02:31, 50.30it/s]
10%|9 | Sample : 819/8384 [00:00<02:23, 52.88it/s]
10%|# | Sample : 854/8384 [00:00<02:15, 55.59it/s]
11%|# | Sample : 889/8384 [00:00<02:08, 58.44it/s]
11%|#1 | Sample : 925/8384 [00:00<02:01, 61.43it/s]
11%|#1 | Sample : 960/8384 [00:00<01:54, 64.56it/s]
12%|#1 | Sample : 995/8384 [00:00<01:48, 67.86it/s]
12%|#2 | Sample : 1030/8384 [00:00<01:43, 71.31it/s]
13%|#2 | Sample : 1065/8384 [00:00<01:37, 74.93it/s]
13%|#3 | Sample : 1099/8384 [00:00<01:32, 78.73it/s]
14%|#3 | Sample : 1133/8384 [00:00<01:27, 82.71it/s]
14%|#3 | Sample : 1168/8384 [00:00<01:23, 86.88it/s]
14%|#4 | Sample : 1202/8384 [00:00<01:18, 91.26it/s]
15%|#4 | Sample : 1228/8384 [00:00<01:14, 95.77it/s]
15%|#5 | Sample : 1261/8384 [00:00<01:10, 100.50it/s]
15%|#5 | Sample : 1295/8384 [00:00<01:07, 105.52it/s]
16%|#5 | Sample : 1320/8384 [00:00<01:03, 110.67it/s]
16%|#6 | Sample : 1354/8384 [00:00<01:00, 116.18it/s]
17%|#6 | Sample : 1388/8384 [00:00<00:57, 121.94it/s]
17%|#6 | Sample : 1422/8384 [00:00<00:54, 127.97it/s]
17%|#7 | Sample : 1446/8384 [00:00<00:51, 134.09it/s]
18%|#7 | Sample : 1481/8384 [00:00<00:49, 140.69it/s]
18%|#8 | Sample : 1516/8384 [00:00<00:46, 147.58it/s]
18%|#8 | Sample : 1550/8384 [00:00<00:44, 154.78it/s]
19%|#8 | Sample : 1584/8384 [00:00<00:41, 162.28it/s]
19%|#9 | Sample : 1619/8384 [00:00<00:39, 170.14it/s]
20%|#9 | Sample : 1652/8384 [00:00<00:37, 178.33it/s]
20%|## | Sample : 1688/8384 [00:00<00:35, 186.91it/s]
21%|## | Sample : 1722/8384 [00:00<00:34, 195.83it/s]
21%|## | Sample : 1756/8384 [00:00<00:32, 205.14it/s]
21%|##1 | Sample : 1791/8384 [00:00<00:30, 214.85it/s]
22%|##1 | Sample : 1825/8384 [00:00<00:29, 224.95it/s]
22%|##2 | Sample : 1860/8384 [00:00<00:27, 235.49it/s]
23%|##2 | Sample : 1894/8384 [00:00<00:26, 246.44it/s]
23%|##2 | Sample : 1928/8384 [00:00<00:25, 257.82it/s]
23%|##3 | Sample : 1963/8384 [00:01<00:23, 269.69it/s]
24%|##3 | Sample : 1997/8384 [00:01<00:22, 282.00it/s]
24%|##4 | Sample : 2032/8384 [00:01<00:21, 294.82it/s]
25%|##4 | Sample : 2066/8384 [00:01<00:20, 308.06it/s]
25%|##5 | Sample : 2101/8384 [00:01<00:19, 321.82it/s]
25%|##5 | Sample : 2134/8384 [00:01<00:18, 336.00it/s]
26%|##5 | Sample : 2167/8384 [00:01<00:17, 350.68it/s]
26%|##6 | Sample : 2192/8384 [00:01<00:16, 364.73it/s]
27%|##6 | Sample : 2226/8384 [00:01<00:16, 380.44it/s]
27%|##6 | Sample : 2251/8384 [00:01<00:15, 395.31it/s]
27%|##7 | Sample : 2287/8384 [00:01<00:14, 412.24it/s]
28%|##7 | Sample : 2321/8384 [00:01<00:14, 429.51it/s]
28%|##8 | Sample : 2355/8384 [00:01<00:13, 447.27it/s]
28%|##8 | Sample : 2389/8384 [00:01<00:12, 465.53it/s]
29%|##8 | Sample : 2424/8384 [00:01<00:12, 484.53it/s]
29%|##9 | Sample : 2458/8384 [00:01<00:11, 503.89it/s]
30%|##9 | Sample : 2492/8384 [00:01<00:11, 523.85it/s]
30%|### | Sample : 2527/8384 [00:01<00:10, 544.51it/s]
31%|### | Sample : 2561/8384 [00:01<00:10, 565.53it/s]
31%|### | Sample : 2595/8384 [00:01<00:09, 586.96it/s]
31%|###1 | Sample : 2631/8384 [00:01<00:09, 609.28it/s]
32%|###1 | Sample : 2667/8384 [00:01<00:09, 632.27it/s]
32%|###2 | Sample : 2702/8384 [00:01<00:08, 655.47it/s]
33%|###2 | Sample : 2737/8384 [00:01<00:08, 679.06it/s]
33%|###3 | Sample : 2774/8384 [00:01<00:07, 703.91it/s]
34%|###3 | Sample : 2809/8384 [00:01<00:07, 728.48it/s]
34%|###3 | Sample : 2843/8384 [00:01<00:07, 753.04it/s]
34%|###4 | Sample : 2876/8384 [00:01<00:07, 777.69it/s]
35%|###4 | Sample : 2909/8384 [00:01<00:06, 802.62it/s]
35%|###5 | Sample : 2946/8384 [00:01<00:06, 829.69it/s]
36%|###5 | Sample : 2980/8384 [00:01<00:06, 855.56it/s]
36%|###5 | Sample : 3014/8384 [00:01<00:06, 881.47it/s]
36%|###6 | Sample : 3048/8384 [00:01<00:05, 907.83it/s]
37%|###6 | Sample : 3086/8384 [00:01<00:05, 936.32it/s]
37%|###7 | Sample : 3122/8384 [00:01<00:05, 964.01it/s]
38%|###7 | Sample : 3160/8384 [00:01<00:05, 993.31it/s]
38%|###8 | Sample : 3198/8384 [00:01<00:05, 1022.78it/s]
39%|###8 | Sample : 3235/8384 [00:01<00:04, 1051.66it/s]
39%|###9 | Sample : 3271/8384 [00:01<00:04, 1079.83it/s]
39%|###9 | Sample : 3310/8384 [00:01<00:04, 1110.31it/s]
40%|###9 | Sample : 3345/8384 [00:01<00:04, 1138.31it/s]
40%|#### | Sample : 3383/8384 [00:01<00:04, 1168.44it/s]
41%|#### | Sample : 3421/8384 [00:01<00:04, 1198.41it/s]
41%|####1 | Sample : 3457/8384 [00:01<00:04, 1226.92it/s]
42%|####1 | Sample : 3495/8384 [00:01<00:03, 1257.12it/s]
42%|####2 | Sample : 3532/8384 [00:01<00:03, 1285.98it/s]
43%|####2 | Sample : 3565/8384 [00:01<00:03, 1304.73it/s]
43%|####2 | Sample : 3602/8384 [00:01<00:03, 1332.94it/s]
43%|####3 | Sample : 3636/8384 [00:01<00:03, 1357.36it/s]
44%|####3 | Sample : 3672/8384 [00:01<00:03, 1384.02it/s]
44%|####4 | Sample : 3706/8384 [00:01<00:03, 1407.30it/s]
45%|####4 | Sample : 3740/8384 [00:01<00:03, 1430.26it/s]
45%|####5 | Sample : 3775/8384 [00:01<00:03, 1454.56it/s]
45%|####5 | Sample : 3803/8384 [00:01<00:03, 1466.56it/s]
46%|####5 | Sample : 3837/8384 [00:01<00:03, 1488.60it/s]
46%|####6 | Sample : 3871/8384 [00:01<00:02, 1510.05it/s]
47%|####6 | Sample : 3905/8384 [00:01<00:02, 1530.45it/s]
47%|####6 | Sample : 3939/8384 [00:01<00:02, 1551.46it/s]
47%|####7 | Sample : 3975/8384 [00:01<00:02, 1575.14it/s]
48%|####7 | Sample : 4010/8384 [00:01<00:02, 1597.28it/s]
48%|####8 | Sample : 4044/8384 [00:01<00:02, 1617.34it/s]
49%|####8 | Sample : 4079/8384 [00:01<00:02, 1638.32it/s]
49%|####9 | Sample : 4114/8384 [00:02<00:02, 1658.77it/s]
49%|####9 | Sample : 4149/8384 [00:02<00:02, 1677.96it/s]
50%|####9 | Sample : 4184/8384 [00:02<00:02, 1696.87it/s]
50%|##### | Sample : 4219/8384 [00:02<00:02, 1715.28it/s]
51%|##### | Sample : 4255/8384 [00:02<00:02, 1734.15it/s]
51%|#####1 | Sample : 4291/8384 [00:02<00:02, 1752.81it/s]
52%|#####1 | Sample : 4327/8384 [00:02<00:02, 1770.94it/s]
52%|#####2 | Sample : 4364/8384 [00:02<00:02, 1789.81it/s]
53%|#####2 | Sample : 4404/8384 [00:02<00:02, 1813.78it/s]
53%|#####2 | Sample : 4438/8384 [00:02<00:02, 1825.48it/s]
53%|#####3 | Sample : 4472/8384 [00:02<00:02, 1837.21it/s]
54%|#####3 | Sample : 4507/8384 [00:02<00:02, 1850.01it/s]
54%|#####4 | Sample : 4543/8384 [00:02<00:02, 1864.88it/s]
55%|#####4 | Sample : 4578/8384 [00:02<00:02, 1877.78it/s]
55%|#####5 | Sample : 4612/8384 [00:02<00:01, 1887.94it/s]
55%|#####5 | Sample : 4646/8384 [00:02<00:01, 1897.87it/s]
56%|#####5 | Sample : 4681/8384 [00:02<00:01, 1910.44it/s]
56%|#####6 | Sample : 4716/8384 [00:02<00:01, 1922.37it/s]
57%|#####6 | Sample : 4753/8384 [00:02<00:01, 1938.12it/s]
57%|#####7 | Sample : 4788/8384 [00:02<00:01, 1947.85it/s]
58%|#####7 | Sample : 4824/8384 [00:02<00:01, 1959.79it/s]
58%|#####7 | Sample : 4859/8384 [00:02<00:01, 1969.22it/s]
58%|#####8 | Sample : 4894/8384 [00:02<00:01, 1978.23it/s]
59%|#####8 | Sample : 4929/8384 [00:02<00:01, 1986.99it/s]
59%|#####9 | Sample : 4965/8384 [00:02<00:01, 1996.63it/s]
60%|#####9 | Sample : 5002/8384 [00:02<00:01, 2009.30it/s]
60%|###### | Sample : 5037/8384 [00:02<00:01, 2015.17it/s]
61%|###### | Sample : 5074/8384 [00:02<00:01, 2026.74it/s]
61%|###### | Sample : 5110/8384 [00:02<00:01, 2036.52it/s]
61%|######1 | Sample : 5146/8384 [00:02<00:01, 2043.95it/s]
62%|######1 | Sample : 5180/8384 [00:02<00:01, 2047.84it/s]
62%|######2 | Sample : 5214/8384 [00:02<00:01, 2051.53it/s]
63%|######2 | Sample : 5251/8384 [00:02<00:01, 2062.10it/s]
63%|######3 | Sample : 5286/8384 [00:02<00:01, 2065.77it/s]
63%|######3 | Sample : 5321/8384 [00:02<00:01, 2069.34it/s]
64%|######3 | Sample : 5357/8384 [00:02<00:01, 2075.40it/s]
64%|######4 | Sample : 5391/8384 [00:02<00:01, 2077.43it/s]
65%|######4 | Sample : 5426/8384 [00:02<00:01, 2080.91it/s]
65%|######5 | Sample : 5461/8384 [00:02<00:01, 2085.67it/s]
66%|######5 | Sample : 5496/8384 [00:02<00:01, 2088.25it/s]
66%|######5 | Sample : 5531/8384 [00:02<00:01, 2090.80it/s]
66%|######6 | Sample : 5566/8384 [00:02<00:01, 2092.62it/s]
67%|######6 | Sample : 5601/8384 [00:02<00:01, 2094.76it/s]
67%|######7 | Sample : 5636/8384 [00:02<00:01, 2098.72it/s]
68%|######7 | Sample : 5671/8384 [00:02<00:01, 2101.19it/s]
68%|######8 | Sample : 5705/8384 [00:02<00:01, 2102.09it/s]
68%|######8 | Sample : 5739/8384 [00:02<00:01, 2101.19it/s]
69%|######8 | Sample : 5774/8384 [00:02<00:01, 2103.77it/s]
69%|######9 | Sample : 5808/8384 [00:02<00:01, 2104.52it/s]
70%|######9 | Sample : 5842/8384 [00:02<00:01, 2104.06it/s]
70%|####### | Sample : 5876/8384 [00:02<00:01, 2103.54it/s]
71%|####### | Sample : 5911/8384 [00:02<00:01, 2107.36it/s]
71%|####### | Sample : 5945/8384 [00:02<00:01, 2107.47it/s]
71%|#######1 | Sample : 5979/8384 [00:02<00:01, 2107.84it/s]
72%|#######1 | Sample : 6013/8384 [00:02<00:01, 2108.28it/s]
72%|#######2 | Sample : 6049/8384 [00:02<00:01, 2113.75it/s]
73%|#######2 | Sample : 6087/8384 [00:02<00:01, 2124.60it/s]
73%|#######3 | Sample : 6122/8384 [00:02<00:01, 2125.29it/s]
73%|#######3 | Sample : 6157/8384 [00:02<00:01, 2125.61it/s]
74%|#######3 | Sample : 6191/8384 [00:02<00:01, 2125.49it/s]
74%|#######4 | Sample : 6225/8384 [00:02<00:01, 2124.86it/s]
75%|#######4 | Sample : 6261/8384 [00:03<00:00, 2129.73it/s]
75%|#######5 | Sample : 6296/8384 [00:03<00:00, 2131.55it/s]
76%|#######5 | Sample : 6331/8384 [00:03<00:00, 2132.39it/s]
76%|#######5 | Sample : 6365/8384 [00:03<00:00, 2131.72it/s]
76%|#######6 | Sample : 6400/8384 [00:03<00:00, 2132.57it/s]
77%|#######6 | Sample : 6434/8384 [00:03<00:00, 2131.16it/s]
77%|#######7 | Sample : 6470/8384 [00:03<00:00, 2135.31it/s]
78%|#######7 | Sample : 6512/8384 [00:03<00:00, 2154.93it/s]
78%|#######8 | Sample : 6549/8384 [00:03<00:00, 2160.59it/s]
79%|#######8 | Sample : 6586/8384 [00:03<00:00, 2167.34it/s]
79%|#######8 | Sample : 6623/8384 [00:03<00:00, 2172.98it/s]
79%|#######9 | Sample : 6660/8384 [00:03<00:00, 2178.86it/s]
80%|#######9 | Sample : 6697/8384 [00:03<00:00, 2184.72it/s]
80%|######## | Sample : 6734/8384 [00:03<00:00, 2189.87it/s]
81%|######## | Sample : 6772/8384 [00:03<00:00, 2195.75it/s]
81%|########1 | Sample : 6810/8384 [00:03<00:00, 2201.81it/s]
82%|########1 | Sample : 6847/8384 [00:03<00:00, 2206.56it/s]
82%|########2 | Sample : 6884/8384 [00:03<00:00, 2211.04it/s]
83%|########2 | Sample : 6922/8384 [00:03<00:00, 2216.79it/s]
83%|########3 | Sample : 6959/8384 [00:03<00:00, 2221.19it/s]
83%|########3 | Sample : 6990/8384 [00:03<00:00, 2186.20it/s]
84%|########3 | Sample : 7025/8384 [00:03<00:00, 2185.38it/s]
84%|########4 | Sample : 7060/8384 [00:03<00:00, 2184.29it/s]
85%|########4 | Sample : 7095/8384 [00:03<00:00, 2184.09it/s]
85%|########5 | Sample : 7131/8384 [00:03<00:00, 2185.62it/s]
85%|########5 | Sample : 7167/8384 [00:03<00:00, 2187.87it/s]
86%|########5 | Sample : 7203/8384 [00:03<00:00, 2190.47it/s]
86%|########6 | Sample : 7238/8384 [00:03<00:00, 2188.19it/s]
87%|########6 | Sample : 7273/8384 [00:03<00:00, 2187.19it/s]
87%|########7 | Sample : 7308/8384 [00:03<00:00, 2185.64it/s]
88%|########7 | Sample : 7340/8384 [00:03<00:00, 2172.84it/s]
88%|########8 | Sample : 7378/8384 [00:03<00:00, 2181.36it/s]
88%|########8 | Sample : 7415/8384 [00:03<00:00, 2186.35it/s]
89%|########8 | Sample : 7456/8384 [00:03<00:00, 2201.86it/s]
89%|########9 | Sample : 7493/8384 [00:03<00:00, 2207.02it/s]
90%|########9 | Sample : 7529/8384 [00:03<00:00, 2206.80it/s]
90%|######### | Sample : 7565/8384 [00:03<00:00, 2208.79it/s]
91%|######### | Sample : 7601/8384 [00:03<00:00, 2208.54it/s]
91%|#########1| Sample : 7637/8384 [00:03<00:00, 2209.39it/s]
92%|#########1| Sample : 7672/8384 [00:03<00:00, 2207.63it/s]
92%|#########1| Sample : 7707/8384 [00:03<00:00, 2206.48it/s]
92%|#########2| Sample : 7742/8384 [00:03<00:00, 2204.98it/s]
93%|#########2| Sample : 7778/8384 [00:03<00:00, 2205.11it/s]
93%|#########3| Sample : 7813/8384 [00:03<00:00, 2202.09it/s]
94%|#########3| Sample : 7848/8384 [00:03<00:00, 2199.74it/s]
94%|#########4| Sample : 7882/8384 [00:03<00:00, 2168.34it/s]
94%|#########4| Sample : 7916/8384 [00:03<00:00, 2165.72it/s]
95%|#########4| Sample : 7951/8384 [00:03<00:00, 2165.52it/s]
95%|#########5| Sample : 7989/8384 [00:03<00:00, 2174.86it/s]
96%|#########5| Sample : 8026/8384 [00:03<00:00, 2180.92it/s]
96%|#########6| Sample : 8063/8384 [00:03<00:00, 2186.17it/s]
97%|#########6| Sample : 8108/8384 [00:03<00:00, 2210.48it/s]
97%|#########7| Sample : 8150/8384 [00:03<00:00, 2225.73it/s]
98%|#########7| Sample : 8186/8384 [00:03<00:00, 2224.43it/s]
98%|#########8| Sample : 8221/8384 [00:03<00:00, 2220.10it/s]
98%|#########8| Sample : 8256/8384 [00:03<00:00, 2216.71it/s]
99%|#########8| Sample : 8292/8384 [00:03<00:00, 2217.93it/s]
99%|#########9| Sample : 8327/8384 [00:03<00:00, 2215.46it/s]
100%|#########9| Sample : 8367/8384 [00:03<00:00, 2226.41it/s]
100%|##########| Sample : 8384/8384 [00:03<00:00, 2115.47it/s]
split 2 / 3
Fitting 1 epochs, 128 channels
0%| | Sample : 0/8384 [00:00<?, ?it/s]
0%| | Sample : 1/8384 [00:00<06:03, 23.04it/s]
0%| | Sample : 35/8384 [00:00<05:44, 24.24it/s]
1%| | Sample : 69/8384 [00:00<05:26, 25.50it/s]
1%|1 | Sample : 104/8384 [00:00<05:08, 26.83it/s]
2%|1 | Sample : 141/8384 [00:00<04:52, 28.22it/s]
2%|2 | Sample : 178/8384 [00:00<04:36, 29.69it/s]
3%|2 | Sample : 213/8384 [00:00<04:21, 31.23it/s]
3%|2 | Sample : 250/8384 [00:00<04:07, 32.85it/s]
3%|3 | Sample : 284/8384 [00:00<03:54, 34.55it/s]
4%|3 | Sample : 319/8384 [00:00<03:41, 36.33it/s]
4%|4 | Sample : 353/8384 [00:00<03:30, 38.21it/s]
5%|4 | Sample : 388/8384 [00:00<03:18, 40.19it/s]
5%|5 | Sample : 422/8384 [00:00<03:08, 42.26it/s]
5%|5 | Sample : 456/8384 [00:00<02:58, 44.44it/s]
6%|5 | Sample : 490/8384 [00:00<02:48, 46.72it/s]
6%|6 | Sample : 524/8384 [00:00<02:40, 49.12it/s]
7%|6 | Sample : 558/8384 [00:00<02:31, 51.64it/s]
7%|6 | Sample : 577/8384 [00:00<02:23, 54.23it/s]
7%|7 | Sample : 613/8384 [00:00<02:16, 57.01it/s]
8%|7 | Sample : 647/8384 [00:00<02:09, 59.93it/s]
8%|8 | Sample : 682/8384 [00:00<02:02, 62.99it/s]
9%|8 | Sample : 716/8384 [00:00<01:55, 66.20it/s]
9%|8 | Sample : 750/8384 [00:00<01:49, 69.57it/s]
9%|9 | Sample : 785/8384 [00:00<01:43, 73.11it/s]
10%|9 | Sample : 820/8384 [00:00<01:38, 76.82it/s]
10%|# | Sample : 854/8384 [00:00<01:33, 80.71it/s]
11%|# | Sample : 889/8384 [00:00<01:28, 84.79it/s]
11%|#1 | Sample : 924/8384 [00:00<01:23, 89.07it/s]
11%|#1 | Sample : 958/8384 [00:00<01:19, 93.55it/s]
12%|#1 | Sample : 992/8384 [00:00<01:15, 98.24it/s]
12%|#2 | Sample : 1027/8384 [00:00<01:11, 103.17it/s]
13%|#2 | Sample : 1062/8384 [00:00<01:07, 108.32it/s]
13%|#3 | Sample : 1096/8384 [00:00<01:04, 113.72it/s]
13%|#3 | Sample : 1130/8384 [00:00<01:00, 119.36it/s]
14%|#3 | Sample : 1164/8384 [00:00<00:57, 125.27it/s]
14%|#4 | Sample : 1199/8384 [00:00<00:54, 131.46it/s]
15%|#4 | Sample : 1233/8384 [00:00<00:51, 137.93it/s]
15%|#4 | Sample : 1251/8384 [00:00<00:49, 144.25it/s]
15%|#5 | Sample : 1289/8384 [00:00<00:46, 151.35it/s]
16%|#5 | Sample : 1325/8384 [00:00<00:44, 158.75it/s]
16%|#6 | Sample : 1365/8384 [00:00<00:42, 166.55it/s]
17%|#6 | Sample : 1401/8384 [00:00<00:39, 174.63it/s]
17%|#7 | Sample : 1443/8384 [00:00<00:37, 183.17it/s]
18%|#7 | Sample : 1483/8384 [00:00<00:35, 192.06it/s]
18%|#8 | Sample : 1521/8384 [00:00<00:34, 201.30it/s]
19%|#8 | Sample : 1559/8384 [00:00<00:32, 210.93it/s]
19%|#9 | Sample : 1594/8384 [00:00<00:30, 220.91it/s]
19%|#9 | Sample : 1628/8384 [00:00<00:29, 231.26it/s]
20%|#9 | Sample : 1664/8384 [00:00<00:27, 242.12it/s]
20%|## | Sample : 1699/8384 [00:00<00:26, 253.36it/s]
21%|## | Sample : 1734/8384 [00:00<00:25, 265.04it/s]
21%|##1 | Sample : 1769/8384 [00:00<00:23, 277.18it/s]
22%|##1 | Sample : 1803/8384 [00:00<00:22, 289.74it/s]
22%|##1 | Sample : 1837/8384 [00:00<00:21, 302.77it/s]
22%|##2 | Sample : 1872/8384 [00:00<00:20, 316.34it/s]
23%|##2 | Sample : 1906/8384 [00:00<00:19, 330.35it/s]
23%|##3 | Sample : 1940/8384 [00:00<00:18, 344.89it/s]
24%|##3 | Sample : 1975/8384 [00:00<00:17, 360.01it/s]
24%|##3 | Sample : 2009/8384 [00:00<00:16, 375.57it/s]
24%|##4 | Sample : 2044/8384 [00:00<00:16, 391.76it/s]
25%|##4 | Sample : 2081/8384 [00:01<00:15, 408.72it/s]
25%|##5 | Sample : 2117/8384 [00:01<00:14, 426.14it/s]
26%|##5 | Sample : 2152/8384 [00:01<00:14, 443.91it/s]
26%|##6 | Sample : 2188/8384 [00:01<00:13, 462.38it/s]
27%|##6 | Sample : 2224/8384 [00:01<00:12, 481.46it/s]
27%|##7 | Sample : 2267/8384 [00:01<00:12, 501.95it/s]
27%|##7 | Sample : 2301/8384 [00:01<00:11, 521.82it/s]
28%|##7 | Sample : 2335/8384 [00:01<00:11, 542.24it/s]
28%|##8 | Sample : 2369/8384 [00:01<00:10, 563.04it/s]
29%|##8 | Sample : 2403/8384 [00:01<00:10, 584.47it/s]
29%|##9 | Sample : 2437/8384 [00:01<00:09, 606.44it/s]
29%|##9 | Sample : 2470/8384 [00:01<00:09, 628.63it/s]
30%|##9 | Sample : 2503/8384 [00:01<00:09, 651.21it/s]
30%|### | Sample : 2537/8384 [00:01<00:08, 674.53it/s]
31%|### | Sample : 2570/8384 [00:01<00:08, 698.01it/s]
31%|###1 | Sample : 2605/8384 [00:01<00:07, 722.57it/s]
31%|###1 | Sample : 2639/8384 [00:01<00:07, 747.15it/s]
32%|###1 | Sample : 2673/8384 [00:01<00:07, 771.98it/s]
32%|###2 | Sample : 2706/8384 [00:01<00:07, 796.72it/s]
33%|###2 | Sample : 2740/8384 [00:01<00:06, 822.29it/s]
33%|###3 | Sample : 2774/8384 [00:01<00:06, 848.10it/s]
33%|###3 | Sample : 2808/8384 [00:01<00:06, 874.15it/s]
34%|###3 | Sample : 2842/8384 [00:01<00:06, 900.48it/s]
34%|###4 | Sample : 2876/8384 [00:01<00:05, 926.83it/s]
35%|###4 | Sample : 2909/8384 [00:01<00:05, 952.87it/s]
35%|###5 | Sample : 2943/8384 [00:01<00:05, 979.38it/s]
36%|###5 | Sample : 2977/8384 [00:01<00:05, 1006.27it/s]
36%|###5 | Sample : 3011/8384 [00:01<00:05, 1032.98it/s]
36%|###6 | Sample : 3044/8384 [00:01<00:05, 1059.18it/s]
37%|###6 | Sample : 3079/8384 [00:01<00:04, 1086.57it/s]
37%|###7 | Sample : 3113/8384 [00:01<00:04, 1113.51it/s]
37%|###7 | Sample : 3138/8384 [00:01<00:04, 1129.66it/s]
38%|###7 | Sample : 3172/8384 [00:01<00:04, 1156.03it/s]
38%|###8 | Sample : 3206/8384 [00:01<00:04, 1182.42it/s]
39%|###8 | Sample : 3240/8384 [00:01<00:04, 1208.53it/s]
39%|###9 | Sample : 3275/8384 [00:01<00:04, 1235.77it/s]
39%|###9 | Sample : 3309/8384 [00:01<00:04, 1261.97it/s]
40%|###9 | Sample : 3342/8384 [00:01<00:03, 1286.60it/s]
40%|#### | Sample : 3377/8384 [00:01<00:03, 1312.39it/s]
41%|#### | Sample : 3410/8384 [00:01<00:03, 1335.50it/s]
41%|####1 | Sample : 3443/8384 [00:01<00:03, 1358.57it/s]
41%|####1 | Sample : 3475/8384 [00:01<00:03, 1380.66it/s]
42%|####1 | Sample : 3508/8384 [00:01<00:03, 1402.61it/s]
42%|####2 | Sample : 3541/8384 [00:01<00:03, 1424.97it/s]
43%|####2 | Sample : 3579/8384 [00:01<00:03, 1453.83it/s]
43%|####3 | Sample : 3612/8384 [00:01<00:03, 1475.01it/s]
44%|####3 | Sample : 3649/8384 [00:01<00:03, 1501.30it/s]
44%|####3 | Sample : 3682/8384 [00:01<00:03, 1520.44it/s]
44%|####4 | Sample : 3716/8384 [00:01<00:03, 1541.10it/s]
45%|####4 | Sample : 3749/8384 [00:01<00:02, 1560.30it/s]
45%|####5 | Sample : 3782/8384 [00:01<00:02, 1579.37it/s]
46%|####5 | Sample : 3816/8384 [00:01<00:02, 1598.84it/s]
46%|####5 | Sample : 3850/8384 [00:01<00:02, 1618.08it/s]
46%|####6 | Sample : 3884/8384 [00:01<00:02, 1636.18it/s]
47%|####6 | Sample : 3918/8384 [00:01<00:02, 1653.52it/s]
47%|####7 | Sample : 3952/8384 [00:01<00:02, 1671.08it/s]
48%|####7 | Sample : 3990/8384 [00:01<00:02, 1695.16it/s]
48%|####7 | Sample : 4024/8384 [00:01<00:02, 1712.16it/s]
48%|####8 | Sample : 4057/8384 [00:01<00:02, 1725.53it/s]
49%|####8 | Sample : 4089/8384 [00:01<00:02, 1737.25it/s]
49%|####9 | Sample : 4123/8384 [00:01<00:02, 1752.85it/s]
50%|####9 | Sample : 4157/8384 [00:02<00:02, 1766.86it/s]
50%|####9 | Sample : 4190/8384 [00:02<00:02, 1779.08it/s]
50%|##### | Sample : 4224/8384 [00:02<00:02, 1793.56it/s]
51%|##### | Sample : 4258/8384 [00:02<00:02, 1805.82it/s]
51%|#####1 | Sample : 4292/8384 [00:02<00:02, 1817.50it/s]
52%|#####1 | Sample : 4326/8384 [00:02<00:02, 1829.78it/s]
52%|#####2 | Sample : 4360/8384 [00:02<00:02, 1842.32it/s]
52%|#####2 | Sample : 4397/8384 [00:02<00:02, 1860.28it/s]
53%|#####2 | Sample : 4433/8384 [00:02<00:02, 1876.03it/s]
53%|#####3 | Sample : 4468/8384 [00:02<00:02, 1888.19it/s]
54%|#####3 | Sample : 4503/8384 [00:02<00:02, 1899.82it/s]
54%|#####4 | Sample : 4538/8384 [00:02<00:02, 1910.08it/s]
55%|#####4 | Sample : 4573/8384 [00:02<00:01, 1920.33it/s]
55%|#####4 | Sample : 4609/8384 [00:02<00:01, 1934.44it/s]
55%|#####5 | Sample : 4643/8384 [00:02<00:01, 1942.97it/s]
56%|#####5 | Sample : 4678/8384 [00:02<00:01, 1952.62it/s]
56%|#####6 | Sample : 4712/8384 [00:02<00:01, 1957.94it/s]
57%|#####6 | Sample : 4747/8384 [00:02<00:01, 1967.98it/s]
57%|#####7 | Sample : 4782/8384 [00:02<00:01, 1977.60it/s]
57%|#####7 | Sample : 4817/8384 [00:02<00:01, 1986.40it/s]
58%|#####7 | Sample : 4853/8384 [00:02<00:01, 1997.46it/s]
58%|#####8 | Sample : 4888/8384 [00:02<00:01, 2005.60it/s]
59%|#####8 | Sample : 4927/8384 [00:02<00:01, 2021.96it/s]
59%|#####9 | Sample : 4963/8384 [00:02<00:01, 2031.27it/s]
60%|#####9 | Sample : 5005/8384 [00:02<00:01, 2053.25it/s]
60%|###### | Sample : 5040/8384 [00:02<00:01, 2058.46it/s]
61%|###### | Sample : 5076/8384 [00:02<00:01, 2066.44it/s]
61%|###### | Sample : 5110/8384 [00:02<00:01, 2069.28it/s]
61%|######1 | Sample : 5144/8384 [00:02<00:01, 2070.36it/s]
62%|######1 | Sample : 5179/8384 [00:02<00:01, 2074.04it/s]
62%|######2 | Sample : 5213/8384 [00:02<00:01, 2075.58it/s]
63%|######2 | Sample : 5248/8384 [00:02<00:01, 2078.22it/s]
63%|######3 | Sample : 5283/8384 [00:02<00:01, 2080.49it/s]
63%|######3 | Sample : 5318/8384 [00:02<00:01, 2083.47it/s]
64%|######3 | Sample : 5353/8384 [00:02<00:01, 2085.90it/s]
64%|######4 | Sample : 5388/8384 [00:02<00:01, 2089.68it/s]
65%|######4 | Sample : 5429/8384 [00:02<00:01, 2107.21it/s]
65%|######5 | Sample : 5463/8384 [00:02<00:01, 2107.98it/s]
66%|######5 | Sample : 5497/8384 [00:02<00:01, 2108.30it/s]
66%|######5 | Sample : 5532/8384 [00:02<00:01, 2110.96it/s]
66%|######6 | Sample : 5566/8384 [00:02<00:01, 2110.58it/s]
67%|######6 | Sample : 5602/8384 [00:02<00:01, 2114.44it/s]
67%|######7 | Sample : 5644/8384 [00:02<00:01, 2134.01it/s]
68%|######7 | Sample : 5683/8384 [00:02<00:01, 2145.15it/s]
68%|######8 | Sample : 5721/8384 [00:02<00:01, 2153.54it/s]
69%|######8 | Sample : 5756/8384 [00:02<00:01, 2154.92it/s]
69%|######9 | Sample : 5794/8384 [00:02<00:01, 2164.14it/s]
70%|######9 | Sample : 5830/8384 [00:02<00:01, 2167.27it/s]
70%|####### | Sample : 5869/8384 [00:02<00:01, 2177.72it/s]
70%|####### | Sample : 5906/8384 [00:02<00:01, 2183.04it/s]
71%|####### | Sample : 5946/8384 [00:02<00:01, 2196.25it/s]
71%|#######1 | Sample : 5980/8384 [00:02<00:01, 2189.93it/s]
72%|#######1 | Sample : 6014/8384 [00:02<00:01, 2185.65it/s]
72%|#######2 | Sample : 6052/8384 [00:02<00:01, 2192.71it/s]
73%|#######2 | Sample : 6088/8384 [00:02<00:01, 2193.31it/s]
73%|#######3 | Sample : 6123/8384 [00:02<00:01, 2192.06it/s]
73%|#######3 | Sample : 6159/8384 [00:02<00:01, 2193.31it/s]
74%|#######3 | Sample : 6194/8384 [00:02<00:00, 2192.90it/s]
74%|#######4 | Sample : 6231/8384 [00:02<00:00, 2197.22it/s]
75%|#######4 | Sample : 6263/8384 [00:02<00:00, 2185.12it/s]
75%|#######5 | Sample : 6292/8384 [00:02<00:00, 2162.42it/s]
76%|#######5 | Sample : 6330/8384 [00:02<00:00, 2170.89it/s]
76%|#######5 | Sample : 6366/8384 [00:03<00:00, 2174.61it/s]
76%|#######6 | Sample : 6413/8384 [00:03<00:00, 2203.20it/s]
77%|#######6 | Sample : 6450/8384 [00:03<00:00, 2205.80it/s]
77%|#######7 | Sample : 6485/8384 [00:03<00:00, 2203.73it/s]
78%|#######7 | Sample : 6522/8384 [00:03<00:00, 2206.25it/s]
78%|#######8 | Sample : 6558/8384 [00:03<00:00, 2207.30it/s]
79%|#######8 | Sample : 6597/8384 [00:03<00:00, 2215.74it/s]
79%|#######9 | Sample : 6634/8384 [00:03<00:00, 2218.07it/s]
80%|#######9 | Sample : 6673/8384 [00:03<00:00, 2225.36it/s]
80%|######## | Sample : 6712/8384 [00:03<00:00, 2233.25it/s]
80%|######## | Sample : 6749/8384 [00:03<00:00, 2235.67it/s]
81%|######## | Sample : 6787/8384 [00:03<00:00, 2240.54it/s]
81%|########1 | Sample : 6824/8384 [00:03<00:00, 2241.46it/s]
82%|########1 | Sample : 6862/8384 [00:03<00:00, 2247.40it/s]
82%|########2 | Sample : 6899/8384 [00:03<00:00, 2248.85it/s]
83%|########2 | Sample : 6937/8384 [00:03<00:00, 2253.43it/s]
83%|########3 | Sample : 6974/8384 [00:03<00:00, 2255.51it/s]
84%|########3 | Sample : 7012/8384 [00:03<00:00, 2258.94it/s]
84%|########4 | Sample : 7047/8384 [00:03<00:00, 2253.94it/s]
84%|########4 | Sample : 7084/8384 [00:03<00:00, 2254.49it/s]
85%|########4 | Sample : 7123/8384 [00:03<00:00, 2261.67it/s]
85%|########5 | Sample : 7160/8384 [00:03<00:00, 2262.49it/s]
86%|########5 | Sample : 7196/8384 [00:03<00:00, 2261.27it/s]
86%|########6 | Sample : 7236/8384 [00:03<00:00, 2270.17it/s]
87%|########6 | Sample : 7272/8384 [00:03<00:00, 2268.69it/s]
87%|########7 | Sample : 7309/8384 [00:03<00:00, 2269.45it/s]
88%|########7 | Sample : 7348/8384 [00:03<00:00, 2275.83it/s]
88%|########8 | Sample : 7385/8384 [00:03<00:00, 2276.58it/s]
89%|########8 | Sample : 7423/8384 [00:03<00:00, 2278.62it/s]
89%|########8 | Sample : 7460/8384 [00:03<00:00, 2277.76it/s]
89%|########9 | Sample : 7495/8384 [00:03<00:00, 2271.58it/s]
90%|########9 | Sample : 7532/8384 [00:03<00:00, 2271.05it/s]
90%|######### | Sample : 7566/8384 [00:03<00:00, 2263.21it/s]
91%|######### | Sample : 7601/8384 [00:03<00:00, 2256.27it/s]
91%|#########1| Sample : 7636/8384 [00:03<00:00, 2250.18it/s]
91%|#########1| Sample : 7671/8384 [00:03<00:00, 2246.59it/s]
92%|#########1| Sample : 7706/8384 [00:03<00:00, 2240.23it/s]
92%|#########2| Sample : 7741/8384 [00:03<00:00, 2234.44it/s]
93%|#########2| Sample : 7776/8384 [00:03<00:00, 2228.92it/s]
93%|#########3| Sample : 7811/8384 [00:03<00:00, 2223.90it/s]
94%|#########3| Sample : 7846/8384 [00:03<00:00, 2219.04it/s]
94%|#########3| Sample : 7880/8384 [00:03<00:00, 2213.84it/s]
94%|#########4| Sample : 7915/8384 [00:03<00:00, 2210.30it/s]
95%|#########4| Sample : 7950/8384 [00:03<00:00, 2208.26it/s]
95%|#########5| Sample : 7985/8384 [00:03<00:00, 2204.79it/s]
96%|#########5| Sample : 8020/8384 [00:03<00:00, 2201.98it/s]
96%|#########6| Sample : 8055/8384 [00:03<00:00, 2198.89it/s]
96%|#########6| Sample : 8090/8384 [00:03<00:00, 2195.68it/s]
97%|#########6| Sample : 8125/8384 [00:03<00:00, 2193.26it/s]
97%|#########7| Sample : 8160/8384 [00:03<00:00, 2191.59it/s]
98%|#########7| Sample : 8195/8384 [00:03<00:00, 2189.31it/s]
98%|#########8| Sample : 8230/8384 [00:03<00:00, 2186.96it/s]
99%|#########8| Sample : 8264/8384 [00:03<00:00, 2182.82it/s]
99%|#########8| Sample : 8300/8384 [00:03<00:00, 2184.40it/s]
99%|#########9| Sample : 8336/8384 [00:03<00:00, 2186.35it/s]
100%|#########9| Sample : 8373/8384 [00:03<00:00, 2190.17it/s]
100%|##########| Sample : 8384/8384 [00:03<00:00, 2143.05it/s]
split 3 / 3
Fitting 1 epochs, 128 channels
0%| | Sample : 0/8384 [00:00<?, ?it/s]
0%| | Sample : 1/8384 [00:00<05:44, 24.36it/s]
0%| | Sample : 39/8384 [00:00<05:25, 25.63it/s]
1%| | Sample : 73/8384 [00:00<05:08, 26.96it/s]
1%|1 | Sample : 106/8384 [00:00<04:51, 28.36it/s]
2%|1 | Sample : 140/8384 [00:00<04:36, 29.83it/s]
2%|2 | Sample : 173/8384 [00:00<04:21, 31.38it/s]
2%|2 | Sample : 188/8384 [00:00<04:08, 32.97it/s]
3%|2 | Sample : 212/8384 [00:00<03:55, 34.67it/s]
3%|2 | Sample : 237/8384 [00:00<03:43, 36.44it/s]
3%|3 | Sample : 270/8384 [00:00<03:31, 38.32it/s]
3%|3 | Sample : 286/8384 [00:00<03:21, 40.25it/s]
4%|3 | Sample : 317/8384 [00:00<03:10, 42.31it/s]
4%|4 | Sample : 349/8384 [00:00<03:00, 44.48it/s]
4%|4 | Sample : 373/8384 [00:00<02:51, 46.75it/s]
5%|4 | Sample : 406/8384 [00:00<02:42, 49.15it/s]
5%|5 | Sample : 439/8384 [00:00<02:33, 51.67it/s]
6%|5 | Sample : 469/8384 [00:00<02:25, 54.31it/s]
6%|5 | Sample : 502/8384 [00:00<02:18, 57.09it/s]
6%|6 | Sample : 535/8384 [00:00<02:10, 60.01it/s]
7%|6 | Sample : 568/8384 [00:00<02:03, 63.07it/s]
7%|7 | Sample : 602/8384 [00:00<01:57, 66.28it/s]
8%|7 | Sample : 636/8384 [00:00<01:51, 69.65it/s]
8%|7 | Sample : 669/8384 [00:00<01:45, 73.19it/s]
8%|8 | Sample : 702/8384 [00:00<01:39, 76.90it/s]
9%|8 | Sample : 735/8384 [00:00<01:34, 80.79it/s]
9%|9 | Sample : 769/8384 [00:00<01:29, 84.86it/s]
10%|9 | Sample : 807/8384 [00:00<01:24, 89.16it/s]
10%|# | Sample : 840/8384 [00:00<01:20, 93.64it/s]
10%|# | Sample : 873/8384 [00:00<01:16, 98.33it/s]
11%|# | Sample : 907/8384 [00:00<01:12, 103.24it/s]
11%|#1 | Sample : 940/8384 [00:00<01:08, 108.39it/s]
12%|#1 | Sample : 973/8384 [00:00<01:05, 113.78it/s]
12%|#1 | Sample : 1006/8384 [00:00<01:01, 119.42it/s]
12%|#2 | Sample : 1040/8384 [00:00<00:58, 125.33it/s]
13%|#2 | Sample : 1073/8384 [00:00<00:55, 131.50it/s]
13%|#3 | Sample : 1106/8384 [00:00<00:52, 137.95it/s]
14%|#3 | Sample : 1139/8384 [00:00<00:50, 144.70it/s]
14%|#3 | Sample : 1173/8384 [00:00<00:47, 151.76it/s]
14%|#4 | Sample : 1211/8384 [00:00<00:45, 159.21it/s]
15%|#4 | Sample : 1243/8384 [00:00<00:42, 166.89it/s]
15%|#5 | Sample : 1276/8384 [00:00<00:40, 174.92it/s]
16%|#5 | Sample : 1309/8384 [00:00<00:38, 183.30it/s]
16%|#6 | Sample : 1342/8384 [00:00<00:36, 192.03it/s]
16%|#6 | Sample : 1376/8384 [00:00<00:34, 201.16it/s]
17%|#6 | Sample : 1411/8384 [00:00<00:33, 210.73it/s]
17%|#7 | Sample : 1441/8384 [00:00<00:31, 220.49it/s]
18%|#7 | Sample : 1474/8384 [00:00<00:29, 230.78it/s]
18%|#7 | Sample : 1507/8384 [00:00<00:28, 241.49it/s]
18%|#8 | Sample : 1540/8384 [00:00<00:27, 252.64it/s]
19%|#8 | Sample : 1573/8384 [00:00<00:25, 264.21it/s]
19%|#9 | Sample : 1610/8384 [00:00<00:24, 276.42it/s]
20%|#9 | Sample : 1643/8384 [00:00<00:23, 288.93it/s]
20%|## | Sample : 1677/8384 [00:00<00:22, 301.94it/s]
20%|## | Sample : 1710/8384 [00:00<00:21, 315.34it/s]
21%|## | Sample : 1744/8384 [00:00<00:20, 329.31it/s]
21%|##1 | Sample : 1777/8384 [00:00<00:19, 343.71it/s]
22%|##1 | Sample : 1810/8384 [00:00<00:18, 358.55it/s]
22%|##1 | Sample : 1844/8384 [00:00<00:17, 374.02it/s]
22%|##2 | Sample : 1879/8384 [00:00<00:16, 390.12it/s]
23%|##2 | Sample : 1912/8384 [00:01<00:15, 406.49it/s]
23%|##3 | Sample : 1945/8384 [00:01<00:15, 423.48it/s]
24%|##3 | Sample : 1979/8384 [00:01<00:14, 441.10it/s]
24%|##4 | Sample : 2016/8384 [00:01<00:13, 459.60it/s]
24%|##4 | Sample : 2050/8384 [00:01<00:13, 478.25it/s]
25%|##4 | Sample : 2086/8384 [00:01<00:12, 497.83it/s]
25%|##5 | Sample : 2120/8384 [00:01<00:12, 517.47it/s]
26%|##5 | Sample : 2153/8384 [00:01<00:11, 537.53it/s]
26%|##6 | Sample : 2187/8384 [00:01<00:11, 558.23it/s]
26%|##6 | Sample : 2221/8384 [00:01<00:10, 579.40it/s]
27%|##6 | Sample : 2254/8384 [00:01<00:10, 600.93it/s]
27%|##7 | Sample : 2288/8384 [00:01<00:09, 623.17it/s]
28%|##7 | Sample : 2323/8384 [00:01<00:09, 646.03it/s]
28%|##8 | Sample : 2357/8384 [00:01<00:09, 669.07it/s]
29%|##8 | Sample : 2390/8384 [00:01<00:08, 692.40it/s]
29%|##8 | Sample : 2423/8384 [00:01<00:08, 716.06it/s]
29%|##9 | Sample : 2456/8384 [00:01<00:08, 740.02it/s]
30%|##9 | Sample : 2489/8384 [00:01<00:07, 764.28it/s]
30%|### | Sample : 2522/8384 [00:01<00:07, 788.97it/s]
31%|### | Sample : 2559/8384 [00:01<00:07, 815.60it/s]
31%|### | Sample : 2594/8384 [00:01<00:06, 841.67it/s]
31%|###1 | Sample : 2627/8384 [00:01<00:06, 867.33it/s]
32%|###1 | Sample : 2660/8384 [00:01<00:06, 892.89it/s]
32%|###2 | Sample : 2693/8384 [00:01<00:06, 918.37it/s]
33%|###2 | Sample : 2726/8384 [00:01<00:05, 944.34it/s]
33%|###2 | Sample : 2759/8384 [00:01<00:05, 970.25it/s]
33%|###3 | Sample : 2792/8384 [00:01<00:05, 996.16it/s]
34%|###3 | Sample : 2825/8384 [00:01<00:05, 1022.17it/s]
34%|###4 | Sample : 2858/8384 [00:01<00:05, 1048.59it/s]
34%|###4 | Sample : 2892/8384 [00:01<00:05, 1075.54it/s]
35%|###4 | Sample : 2926/8384 [00:01<00:04, 1102.25it/s]
35%|###5 | Sample : 2968/8384 [00:01<00:04, 1134.89it/s]
36%|###5 | Sample : 3001/8384 [00:01<00:04, 1160.64it/s]
36%|###6 | Sample : 3034/8384 [00:01<00:04, 1185.87it/s]
37%|###6 | Sample : 3068/8384 [00:01<00:04, 1211.60it/s]
37%|###6 | Sample : 3101/8384 [00:01<00:04, 1236.41it/s]
37%|###7 | Sample : 3134/8384 [00:01<00:04, 1260.81it/s]
38%|###7 | Sample : 3167/8384 [00:01<00:04, 1285.55it/s]
38%|###8 | Sample : 3200/8384 [00:01<00:03, 1309.06it/s]
39%|###8 | Sample : 3233/8384 [00:01<00:03, 1332.47it/s]
39%|###8 | Sample : 3267/8384 [00:01<00:03, 1356.70it/s]
39%|###9 | Sample : 3300/8384 [00:01<00:03, 1379.51it/s]
40%|###9 | Sample : 3333/8384 [00:01<00:03, 1401.73it/s]
40%|#### | Sample : 3366/8384 [00:01<00:03, 1424.39it/s]
41%|#### | Sample : 3399/8384 [00:01<00:03, 1445.44it/s]
41%|#### | Sample : 3432/8384 [00:01<00:03, 1466.16it/s]
41%|####1 | Sample : 3466/8384 [00:01<00:03, 1487.70it/s]
42%|####1 | Sample : 3498/8384 [00:01<00:03, 1506.85it/s]
42%|####2 | Sample : 3531/8384 [00:01<00:03, 1527.19it/s]
43%|####2 | Sample : 3567/8384 [00:01<00:03, 1550.87it/s]
43%|####2 | Sample : 3602/8384 [00:01<00:03, 1573.73it/s]
43%|####3 | Sample : 3640/8384 [00:01<00:02, 1599.95it/s]
44%|####3 | Sample : 3677/8384 [00:01<00:02, 1623.77it/s]
44%|####4 | Sample : 3712/8384 [00:01<00:02, 1644.25it/s]
45%|####4 | Sample : 3747/8384 [00:01<00:02, 1664.91it/s]
45%|####5 | Sample : 3783/8384 [00:01<00:02, 1686.36it/s]
46%|####5 | Sample : 3817/8384 [00:01<00:02, 1703.54it/s]
46%|####5 | Sample : 3854/8384 [00:01<00:02, 1725.95it/s]
46%|####6 | Sample : 3891/8384 [00:01<00:02, 1746.61it/s]
47%|####6 | Sample : 3926/8384 [00:01<00:02, 1762.81it/s]
47%|####7 | Sample : 3963/8384 [00:01<00:02, 1782.37it/s]
48%|####7 | Sample : 3999/8384 [00:02<00:02, 1801.03it/s]
48%|####8 | Sample : 4032/8384 [00:02<00:02, 1811.93it/s]
49%|####8 | Sample : 4067/8384 [00:02<00:02, 1826.31it/s]
49%|####8 | Sample : 4102/8384 [00:02<00:02, 1840.87it/s]
49%|####9 | Sample : 4137/8384 [00:02<00:02, 1854.86it/s]
50%|####9 | Sample : 4173/8384 [00:02<00:02, 1870.43it/s]
50%|##### | Sample : 4209/8384 [00:02<00:02, 1885.10it/s]
51%|##### | Sample : 4244/8384 [00:02<00:02, 1896.50it/s]
51%|#####1 | Sample : 4280/8384 [00:02<00:02, 1909.92it/s]
51%|#####1 | Sample : 4315/8384 [00:02<00:02, 1920.13it/s]
52%|#####1 | Sample : 4349/8384 [00:02<00:02, 1927.16it/s]
52%|#####2 | Sample : 4383/8384 [00:02<00:02, 1935.90it/s]
53%|#####2 | Sample : 4418/8384 [00:02<00:02, 1945.22it/s]
53%|#####3 | Sample : 4452/8384 [00:02<00:02, 1952.60it/s]
54%|#####3 | Sample : 4487/8384 [00:02<00:01, 1962.08it/s]
54%|#####3 | Sample : 4522/8384 [00:02<00:01, 1970.25it/s]
54%|#####4 | Sample : 4556/8384 [00:02<00:01, 1977.42it/s]
55%|#####4 | Sample : 4590/8384 [00:02<00:01, 1984.06it/s]
55%|#####5 | Sample : 4624/8384 [00:02<00:01, 1989.06it/s]
56%|#####5 | Sample : 4658/8384 [00:02<00:01, 1993.78it/s]
56%|#####5 | Sample : 4693/8384 [00:02<00:01, 2000.87it/s]
56%|#####6 | Sample : 4727/8384 [00:02<00:01, 2004.62it/s]
57%|#####6 | Sample : 4762/8384 [00:02<00:01, 2011.10it/s]
57%|#####7 | Sample : 4796/8384 [00:02<00:01, 2015.55it/s]
58%|#####7 | Sample : 4830/8384 [00:02<00:01, 2018.87it/s]
58%|#####8 | Sample : 4864/8384 [00:02<00:01, 2023.18it/s]
58%|#####8 | Sample : 4898/8384 [00:02<00:01, 2025.45it/s]
59%|#####8 | Sample : 4933/8384 [00:02<00:01, 2031.77it/s]
59%|#####9 | Sample : 4967/8384 [00:02<00:01, 2033.80it/s]
60%|#####9 | Sample : 5002/8384 [00:02<00:01, 2038.26it/s]
60%|###### | Sample : 5037/8384 [00:02<00:01, 2044.22it/s]
60%|###### | Sample : 5070/8384 [00:02<00:01, 2044.46it/s]
61%|###### | Sample : 5104/8384 [00:02<00:01, 2047.68it/s]
61%|######1 | Sample : 5138/8384 [00:02<00:01, 2050.71it/s]
62%|######1 | Sample : 5173/8384 [00:02<00:01, 2054.71it/s]
62%|######2 | Sample : 5207/8384 [00:02<00:01, 2056.80it/s]
63%|######2 | Sample : 5241/8384 [00:02<00:01, 2059.85it/s]
63%|######2 | Sample : 5275/8384 [00:02<00:01, 2061.76it/s]
63%|######3 | Sample : 5310/8384 [00:02<00:01, 2066.65it/s]
64%|######3 | Sample : 5344/8384 [00:02<00:01, 2068.86it/s]
64%|######4 | Sample : 5377/8384 [00:02<00:01, 2068.49it/s]
65%|######4 | Sample : 5411/8384 [00:02<00:01, 2068.60it/s]
65%|######4 | Sample : 5445/8384 [00:02<00:01, 2069.60it/s]
65%|######5 | Sample : 5479/8384 [00:02<00:01, 2072.21it/s]
66%|######5 | Sample : 5513/8384 [00:02<00:01, 2074.27it/s]
66%|######6 | Sample : 5547/8384 [00:02<00:01, 2075.23it/s]
67%|######6 | Sample : 5581/8384 [00:02<00:01, 2076.11it/s]
67%|######6 | Sample : 5615/8384 [00:02<00:01, 2075.85it/s]
67%|######7 | Sample : 5649/8384 [00:02<00:01, 2075.39it/s]
68%|######7 | Sample : 5684/8384 [00:02<00:01, 2080.19it/s]
68%|######8 | Sample : 5718/8384 [00:02<00:01, 2080.49it/s]
69%|######8 | Sample : 5751/8384 [00:02<00:01, 2079.23it/s]
69%|######9 | Sample : 5785/8384 [00:02<00:01, 2078.78it/s]
69%|######9 | Sample : 5820/8384 [00:02<00:01, 2082.00it/s]
70%|######9 | Sample : 5854/8384 [00:02<00:01, 2083.59it/s]
70%|####### | Sample : 5888/8384 [00:02<00:01, 2083.86it/s]
71%|####### | Sample : 5922/8384 [00:02<00:01, 2085.76it/s]
71%|#######1 | Sample : 5957/8384 [00:02<00:01, 2090.56it/s]
71%|#######1 | Sample : 5994/8384 [00:02<00:01, 2100.57it/s]
72%|#######1 | Sample : 6034/8384 [00:02<00:01, 2115.76it/s]
72%|#######2 | Sample : 6071/8384 [00:02<00:01, 2123.59it/s]
73%|#######2 | Sample : 6109/8384 [00:02<00:01, 2134.05it/s]
73%|#######3 | Sample : 6146/8384 [00:03<00:01, 2141.27it/s]
74%|#######3 | Sample : 6181/8384 [00:03<00:01, 2141.17it/s]
74%|#######4 | Sample : 6216/8384 [00:03<00:01, 2141.70it/s]
75%|#######4 | Sample : 6257/8384 [00:03<00:00, 2157.79it/s]
75%|#######5 | Sample : 6292/8384 [00:03<00:00, 2157.88it/s]
75%|#######5 | Sample : 6327/8384 [00:03<00:00, 2157.37it/s]
76%|#######5 | Sample : 6363/8384 [00:03<00:00, 2159.32it/s]
76%|#######6 | Sample : 6400/8384 [00:03<00:00, 2163.60it/s]
77%|#######6 | Sample : 6438/8384 [00:03<00:00, 2171.30it/s]
77%|#######7 | Sample : 6477/8384 [00:03<00:00, 2181.06it/s]
78%|#######7 | Sample : 6516/8384 [00:03<00:00, 2191.18it/s]
78%|#######8 | Sample : 6553/8384 [00:03<00:00, 2194.35it/s]
79%|#######8 | Sample : 6592/8384 [00:03<00:00, 2204.86it/s]
79%|#######9 | Sample : 6633/8384 [00:03<00:00, 2218.56it/s]
80%|#######9 | Sample : 6673/8384 [00:03<00:00, 2228.86it/s]
80%|######## | Sample : 6711/8384 [00:03<00:00, 2233.90it/s]
80%|######## | Sample : 6749/8384 [00:03<00:00, 2238.45it/s]
81%|########1 | Sample : 6793/8384 [00:03<00:00, 2257.27it/s]
81%|########1 | Sample : 6827/8384 [00:03<00:00, 2247.75it/s]
82%|########1 | Sample : 6863/8384 [00:03<00:00, 2246.07it/s]
82%|########2 | Sample : 6901/8384 [00:03<00:00, 2250.82it/s]
83%|########2 | Sample : 6936/8384 [00:03<00:00, 2245.52it/s]
83%|########3 | Sample : 6971/8384 [00:03<00:00, 2239.35it/s]
84%|########3 | Sample : 7006/8384 [00:03<00:00, 2234.76it/s]
84%|########3 | Sample : 7041/8384 [00:03<00:00, 2230.98it/s]
84%|########4 | Sample : 7076/8384 [00:03<00:00, 2227.63it/s]
85%|########4 | Sample : 7111/8384 [00:03<00:00, 2223.64it/s]
85%|########5 | Sample : 7145/8384 [00:03<00:00, 2217.34it/s]
86%|########5 | Sample : 7180/8384 [00:03<00:00, 2214.38it/s]
86%|########6 | Sample : 7214/8384 [00:03<00:00, 2209.25it/s]
86%|########6 | Sample : 7250/8384 [00:03<00:00, 2208.06it/s]
87%|########6 | Sample : 7267/8384 [00:03<00:00, 2089.80it/s]
87%|########7 | Sample : 7302/8384 [00:03<00:00, 2091.95it/s]
87%|########7 | Sample : 7331/8384 [00:03<00:00, 2075.42it/s]
88%|########7 | Sample : 7367/8384 [00:03<00:00, 2080.79it/s]
88%|########8 | Sample : 7401/8384 [00:03<00:00, 2082.76it/s]
89%|########8 | Sample : 7435/8384 [00:03<00:00, 2084.77it/s]
89%|########9 | Sample : 7469/8384 [00:03<00:00, 2086.01it/s]
89%|########9 | Sample : 7503/8384 [00:03<00:00, 2087.20it/s]
90%|########9 | Sample : 7537/8384 [00:03<00:00, 2088.71it/s]
90%|######### | Sample : 7571/8384 [00:03<00:00, 2088.49it/s]
91%|######### | Sample : 7605/8384 [00:03<00:00, 2089.70it/s]
91%|#########1| Sample : 7640/8384 [00:03<00:00, 2091.73it/s]
92%|#########1| Sample : 7675/8384 [00:03<00:00, 2094.36it/s]
92%|#########1| Sample : 7712/8384 [00:03<00:00, 2101.68it/s]
92%|#########2| Sample : 7746/8384 [00:03<00:00, 2101.35it/s]
93%|#########2| Sample : 7772/8384 [00:03<00:00, 2067.02it/s]
93%|#########3| Sample : 7803/8384 [00:03<00:00, 2057.46it/s]
93%|#########3| Sample : 7835/8384 [00:03<00:00, 2053.25it/s]
94%|#########3| Sample : 7868/8384 [00:03<00:00, 2050.98it/s]
94%|#########4| Sample : 7902/8384 [00:03<00:00, 2053.50it/s]
95%|#########4| Sample : 7941/8384 [00:03<00:00, 2067.13it/s]
95%|#########5| Sample : 7976/8384 [00:03<00:00, 2070.31it/s]
96%|#########5| Sample : 8011/8384 [00:03<00:00, 2073.84it/s]
96%|#########5| Sample : 8045/8384 [00:03<00:00, 2075.98it/s]
96%|#########6| Sample : 8080/8384 [00:03<00:00, 2079.66it/s]
97%|#########6| Sample : 8115/8384 [00:03<00:00, 2082.22it/s]
97%|#########7| Sample : 8150/8384 [00:03<00:00, 2087.07it/s]
98%|#########7| Sample : 8185/8384 [00:03<00:00, 2091.85it/s]
98%|#########8| Sample : 8221/8384 [00:03<00:00, 2096.81it/s]
98%|#########8| Sample : 8257/8384 [00:03<00:00, 2102.92it/s]
99%|#########8| Sample : 8293/8384 [00:03<00:00, 2108.21it/s]
99%|#########9| Sample : 8327/8384 [00:04<00:00, 2107.99it/s]
100%|#########9| Sample : 8370/8384 [00:04<00:00, 2129.90it/s]
100%|##########| Sample : 8384/8384 [00:04<00:00, 2076.49it/s]
```

### Visualize stimulus reconstruction¶

To get a sense of our model performance, we can plot the actual and predicted stimulus envelopes side by side.

```
y_pred = sr.predict(Y[test])
time = np.linspace(0, 2., 5 * int(sfreq))
fig, ax = plt.subplots(figsize=(8, 4))
ax.plot(time, speech[test][sr.valid_samples_][:int(5 * sfreq)],
color='grey', lw=2, ls='--')
ax.plot(time, y_pred[sr.valid_samples_][:int(5 * sfreq)], color='r', lw=2)
ax.legend([lns[0], ln1[0]], ['Envelope', 'Reconstruction'], frameon=False)
ax.set(title="Stimulus reconstruction")
ax.set_xlabel('Time (s)')
mne.viz.tight_layout()
```

### Investigate model coefficients¶

Finally, we will look at how the decoding model coefficients are distributed across the scalp. We will attempt to recreate figure 5 from 1. The decoding model weights reflect the channels that contribute most toward reconstructing the stimulus signal, but are not directly interpretable in a neurophysiological sense. Here we also look at the coefficients obtained via an inversion procedure 2, which have a more straightforward interpretation as their value (and sign) directly relates to the stimulus signal’s strength (and effect direction).

```
time_plot = (-.140, -.125) # To average between two timepoints.
ix_plot = np.arange(np.argmin(np.abs(time_plot[0] - times)),
np.argmin(np.abs(time_plot[1] - times)))
fig, ax = plt.subplots(1, 2)
mne.viz.plot_topomap(np.mean(mean_coefs[:, ix_plot], axis=1),
pos=info, axes=ax[0], show=False,
vmin=-max_coef, vmax=max_coef)
ax[0].set(title="Model coefficients\nbetween delays %s and %s"
% (time_plot[0], time_plot[1]))
mne.viz.plot_topomap(np.mean(mean_patterns[:, ix_plot], axis=1),
pos=info, axes=ax[1],
show=False, vmin=-max_patterns, vmax=max_patterns)
ax[1].set(title="Inverse-transformed coefficients\nbetween delays %s and %s"
% (time_plot[0], time_plot[1]))
mne.viz.tight_layout()
plt.show()
```

## References¶

- 1(1,2,3,4,5)
Michael J. Crosse, Giovanni M. Di Liberto, Adam Bednar, and Edmund C. Lalor. The multivariate temporal response function (mTRF) toolbox: a MATLAB toolbox for relating neural signals to continuous stimuli.

*Frontiers in Human Neuroscience*, 2016. doi:10.3389/fnhum.2016.00604.- 2
Stefan Haufe, Frank Meinecke, Kai Görgen, Sven Dähne, John-Dylan Haynes, Benjamin Blankertz, and Felix Bießmann. On the interpretation of weight vectors of linear models in multivariate neuroimaging.

*NeuroImage*, 87:96–110, 2014. doi:10.1016/j.neuroimage.2013.10.067.

**Total running time of the script:** ( 0 minutes 27.893 seconds)

**Estimated memory usage:** 54 MB