Note
Go to the end to download the full example code.
Comparison of embeddings of covariance matrices¶
Comparison of several embeddings of a set of ERP covariance matrices extracted on MEG data: SE, LLE and t-SNE
Spectral Embedding (SE) is based on computing the low-dimensional representation that best preserves locality instead of local linearity in LLE [1].
Locally Linear Embedding (LLE) assumes that the local neighborhood of a matrix on the manifold can be well approximated by the affine subspace spanned by the k-nearest neighbors of the matrix and finds a low-dimensional embedding of the data based on these affine approximations.
t-SNE reduces SPD matrices into lower dimensional SPD matrices by computing conditional probabilities that represent similarities [2]. This fully Riemannian algorithm helps preserve the non-Euclidean structure of the data.
# Authors: Pedro Rodrigues <pedro.rodrigues01@gmail.com>,
# Gabriel Wagner vom Berg <gabriel@bccn-berlin.de>
# Thibault de Surrel <thibault.de-surrel@lamsade.dauphine.fr>
#
# License: BSD (3-clause)
import matplotlib.pyplot as plt
import mne
from mne import io
from mne.datasets import sample
from sklearn.model_selection import train_test_split
from pyriemann.estimation import XdawnCovariances
from pyriemann.utils.viz import plot_embedding
print(__doc__)
Set parameters and read data¶
data_path = str(sample.data_path())
raw_fname = data_path + "/MEG/sample/sample_audvis_filt-0-40_raw.fif"
event_fname = data_path + "/MEG/sample/sample_audvis_filt-0-40_raw-eve.fif"
tmin, tmax = -0., 1
event_id = dict(aud_l=1, aud_r=2, vis_l=3, vis_r=4)
# Setup for reading the raw data
raw = io.Raw(raw_fname, preload=True, verbose=False)
raw.filter(2, None, method="iir") # replace baselining with high-pass
events = mne.read_events(event_fname)
raw.info["bads"] = ["MEG 2443"] # set bad channels
picks = mne.pick_types(raw.info, meg=True, eeg=False, stim=False, eog=False,
exclude="bads")
# Read epochs
epochs = mne.Epochs(raw, events, event_id, tmin, tmax, proj=False,
picks=picks, baseline=None, preload=True, verbose=False)
X = epochs.get_data(copy=False)
y = epochs.events[:, -1]
Using default location ~/mne_data for sample...
0%| | 0.00/1.65G [00:00<?, ?B/s]
0%| | 5.03M/1.65G [00:00<00:32, 50.3MB/s]
1%|▎ | 13.4M/1.65G [00:00<00:23, 70.2MB/s]
1%|▍ | 21.9M/1.65G [00:00<00:21, 76.8MB/s]
2%|▋ | 30.4M/1.65G [00:00<00:20, 80.0MB/s]
2%|▊ | 38.7M/1.65G [00:00<00:19, 81.2MB/s]
3%|█ | 47.2M/1.65G [00:00<00:19, 82.3MB/s]
3%|█▏ | 55.4M/1.65G [00:00<00:19, 80.2MB/s]
4%|█▍ | 63.9M/1.65G [00:00<00:19, 81.5MB/s]
4%|█▌ | 72.3M/1.65G [00:00<00:19, 82.4MB/s]
5%|█▊ | 80.8M/1.65G [00:01<00:18, 83.1MB/s]
5%|█▉ | 89.1M/1.65G [00:01<00:19, 81.5MB/s]
6%|██▏ | 97.2M/1.65G [00:01<00:19, 78.4MB/s]
6%|██▍ | 105M/1.65G [00:01<00:19, 77.9MB/s]
7%|██▌ | 113M/1.65G [00:01<00:19, 79.3MB/s]
7%|██▊ | 122M/1.65G [00:01<00:19, 80.0MB/s]
8%|██▉ | 130M/1.65G [00:01<00:21, 72.2MB/s]
8%|███▏ | 138M/1.65G [00:01<00:19, 75.8MB/s]
9%|███▎ | 146M/1.65G [00:01<00:19, 76.9MB/s]
9%|███▌ | 154M/1.65G [00:02<00:21, 68.9MB/s]
10%|███▋ | 162M/1.65G [00:02<00:20, 71.5MB/s]
10%|███▉ | 170M/1.65G [00:02<00:19, 75.2MB/s]
11%|████ | 179M/1.65G [00:02<00:18, 78.0MB/s]
11%|████▎ | 187M/1.65G [00:02<00:18, 78.1MB/s]
12%|████▍ | 195M/1.65G [00:02<00:18, 79.9MB/s]
12%|████▋ | 203M/1.65G [00:02<00:18, 79.3MB/s]
13%|████▊ | 211M/1.65G [00:02<00:18, 79.8MB/s]
13%|█████ | 219M/1.65G [00:02<00:18, 79.0MB/s]
14%|█████▏ | 227M/1.65G [00:02<00:19, 72.9MB/s]
14%|█████▍ | 235M/1.65G [00:03<00:20, 70.6MB/s]
15%|█████▌ | 243M/1.65G [00:03<00:18, 74.5MB/s]
15%|█████▊ | 251M/1.65G [00:03<00:18, 76.5MB/s]
16%|█████▉ | 259M/1.65G [00:03<00:20, 66.6MB/s]
16%|██████▏ | 267M/1.65G [00:03<00:19, 69.5MB/s]
17%|██████▎ | 274M/1.65G [00:03<00:19, 70.4MB/s]
17%|██████▍ | 282M/1.65G [00:03<00:18, 72.5MB/s]
17%|██████▋ | 289M/1.65G [00:03<00:18, 72.9MB/s]
18%|██████▊ | 297M/1.65G [00:03<00:18, 75.2MB/s]
18%|███████ | 306M/1.65G [00:04<00:17, 78.0MB/s]
19%|███████▏ | 314M/1.65G [00:04<00:16, 80.0MB/s]
20%|███████▍ | 323M/1.65G [00:04<00:16, 81.5MB/s]
20%|███████▌ | 331M/1.65G [00:04<00:16, 82.5MB/s]
21%|███████▊ | 339M/1.65G [00:04<00:16, 81.6MB/s]
21%|███████▉ | 348M/1.65G [00:04<00:15, 81.6MB/s]
22%|████████▏ | 356M/1.65G [00:04<00:15, 81.5MB/s]
22%|████████▍ | 364M/1.65G [00:04<00:15, 82.5MB/s]
23%|████████▌ | 373M/1.65G [00:04<00:15, 82.3MB/s]
23%|████████▊ | 381M/1.65G [00:04<00:15, 80.5MB/s]
24%|████████▉ | 389M/1.65G [00:05<00:15, 81.7MB/s]
24%|█████████▏ | 398M/1.65G [00:05<00:15, 82.7MB/s]
25%|█████████▎ | 406M/1.65G [00:05<00:15, 81.8MB/s]
25%|█████████▌ | 414M/1.65G [00:05<00:14, 82.6MB/s]
26%|█████████▋ | 423M/1.65G [00:05<00:15, 80.2MB/s]
26%|█████████▉ | 431M/1.65G [00:05<00:14, 81.6MB/s]
27%|██████████ | 439M/1.65G [00:05<00:14, 81.2MB/s]
27%|██████████▎ | 448M/1.65G [00:05<00:14, 82.3MB/s]
28%|██████████▍ | 456M/1.65G [00:05<00:14, 82.9MB/s]
28%|██████████▋ | 465M/1.65G [00:05<00:14, 83.5MB/s]
29%|██████████▉ | 473M/1.65G [00:06<00:14, 84.0MB/s]
29%|███████████ | 482M/1.65G [00:06<00:14, 78.2MB/s]
30%|███████████▎ | 490M/1.65G [00:06<00:14, 80.0MB/s]
30%|███████████▍ | 498M/1.65G [00:06<00:14, 79.0MB/s]
31%|███████████▋ | 506M/1.65G [00:06<00:15, 76.2MB/s]
31%|███████████▊ | 514M/1.65G [00:06<00:15, 74.5MB/s]
32%|████████████ | 522M/1.65G [00:06<00:14, 77.3MB/s]
32%|████████████▏ | 530M/1.65G [00:06<00:14, 78.0MB/s]
33%|████████████▎ | 538M/1.65G [00:06<00:14, 75.4MB/s]
33%|████████████▌ | 546M/1.65G [00:07<00:14, 74.0MB/s]
33%|████████████▋ | 553M/1.65G [00:07<00:14, 73.4MB/s]
34%|████████████▉ | 561M/1.65G [00:07<00:14, 73.8MB/s]
34%|█████████████ | 569M/1.65G [00:07<00:14, 76.9MB/s]
35%|█████████████▎ | 578M/1.65G [00:07<00:13, 79.1MB/s]
35%|█████████████▍ | 586M/1.65G [00:07<00:13, 80.6MB/s]
36%|█████████████▋ | 594M/1.65G [00:07<00:12, 81.5MB/s]
36%|█████████████▊ | 602M/1.65G [00:07<00:13, 79.8MB/s]
37%|██████████████ | 610M/1.65G [00:07<00:13, 78.8MB/s]
37%|██████████████▏ | 619M/1.65G [00:07<00:12, 80.8MB/s]
38%|██████████████▍ | 627M/1.65G [00:08<00:13, 75.6MB/s]
38%|██████████████▌ | 636M/1.65G [00:08<00:13, 78.1MB/s]
39%|██████████████▊ | 643M/1.65G [00:08<00:13, 77.1MB/s]
39%|██████████████▉ | 651M/1.65G [00:08<00:14, 71.2MB/s]
40%|███████████████▏ | 658M/1.65G [00:08<00:15, 64.0MB/s]
40%|███████████████▎ | 665M/1.65G [00:08<00:15, 64.7MB/s]
41%|███████████████▍ | 672M/1.65G [00:08<00:16, 60.2MB/s]
41%|███████████████▌ | 678M/1.65G [00:08<00:16, 58.7MB/s]
41%|███████████████▋ | 684M/1.65G [00:08<00:16, 58.2MB/s]
42%|███████████████▉ | 692M/1.65G [00:09<00:14, 64.3MB/s]
42%|████████████████ | 698M/1.65G [00:09<00:15, 60.7MB/s]
43%|████████████████▎ | 707M/1.65G [00:09<00:14, 67.4MB/s]
43%|████████████████▍ | 714M/1.65G [00:09<00:13, 67.7MB/s]
44%|████████████████▌ | 722M/1.65G [00:09<00:13, 70.6MB/s]
44%|████████████████▊ | 730M/1.65G [00:09<00:12, 73.7MB/s]
45%|████████████████▉ | 737M/1.65G [00:09<00:12, 74.7MB/s]
45%|█████████████████▏ | 745M/1.65G [00:09<00:12, 75.2MB/s]
46%|█████████████████▎ | 753M/1.65G [00:09<00:11, 76.4MB/s]
46%|█████████████████▍ | 761M/1.65G [00:09<00:11, 76.7MB/s]
47%|█████████████████▋ | 769M/1.65G [00:10<00:11, 77.4MB/s]
47%|█████████████████▊ | 777M/1.65G [00:10<00:11, 77.9MB/s]
47%|██████████████████ | 784M/1.65G [00:10<00:11, 78.3MB/s]
48%|██████████████████▏ | 792M/1.65G [00:10<00:10, 78.7MB/s]
48%|██████████████████▍ | 800M/1.65G [00:10<00:10, 78.3MB/s]
49%|██████████████████▌ | 808M/1.65G [00:10<00:10, 78.3MB/s]
49%|██████████████████▊ | 816M/1.65G [00:10<00:10, 78.2MB/s]
50%|██████████████████▉ | 824M/1.65G [00:10<00:11, 71.5MB/s]
50%|███████████████████ | 832M/1.65G [00:10<00:11, 73.4MB/s]
51%|███████████████████▎ | 839M/1.65G [00:11<00:10, 74.8MB/s]
51%|███████████████████▍ | 847M/1.65G [00:11<00:10, 75.7MB/s]
52%|███████████████████▋ | 855M/1.65G [00:11<00:10, 75.3MB/s]
52%|███████████████████▊ | 862M/1.65G [00:11<00:10, 75.4MB/s]
53%|████████████████████ | 870M/1.65G [00:11<00:10, 75.9MB/s]
53%|████████████████████▏ | 878M/1.65G [00:11<00:10, 76.4MB/s]
54%|████████████████████▎ | 886M/1.65G [00:11<00:09, 77.0MB/s]
54%|████████████████████▌ | 894M/1.65G [00:11<00:10, 71.9MB/s]
55%|████████████████████▋ | 901M/1.65G [00:11<00:10, 73.3MB/s]
55%|████████████████████▉ | 909M/1.65G [00:11<00:09, 74.6MB/s]
55%|█████████████████████ | 916M/1.65G [00:12<00:11, 63.8MB/s]
56%|█████████████████████▏ | 924M/1.65G [00:12<00:10, 67.1MB/s]
56%|█████████████████████▍ | 932M/1.65G [00:12<00:10, 69.8MB/s]
57%|█████████████████████▌ | 939M/1.65G [00:12<00:10, 69.1MB/s]
57%|█████████████████████▊ | 946M/1.65G [00:12<00:09, 70.7MB/s]
58%|█████████████████████▉ | 954M/1.65G [00:12<00:09, 72.8MB/s]
58%|██████████████████████ | 962M/1.65G [00:12<00:09, 74.9MB/s]
59%|██████████████████████▎ | 970M/1.65G [00:12<00:09, 70.0MB/s]
59%|██████████████████████▍ | 978M/1.65G [00:12<00:09, 74.3MB/s]
60%|██████████████████████▋ | 986M/1.65G [00:13<00:09, 69.8MB/s]
60%|██████████████████████▊ | 993M/1.65G [00:13<00:09, 70.3MB/s]
61%|██████████████████████▍ | 1.00G/1.65G [00:13<00:13, 47.8MB/s]
61%|██████████████████████▌ | 1.01G/1.65G [00:13<00:13, 46.5MB/s]
61%|██████████████████████▋ | 1.01G/1.65G [00:13<00:12, 51.5MB/s]
62%|██████████████████████▊ | 1.02G/1.65G [00:13<00:12, 52.5MB/s]
62%|██████████████████████▉ | 1.03G/1.65G [00:13<00:11, 56.0MB/s]
62%|███████████████████████ | 1.03G/1.65G [00:13<00:10, 57.7MB/s]
63%|███████████████████████▎ | 1.04G/1.65G [00:14<00:09, 62.3MB/s]
63%|███████████████████████▍ | 1.05G/1.65G [00:14<00:09, 66.8MB/s]
64%|███████████████████████▌ | 1.05G/1.65G [00:14<00:08, 70.3MB/s]
64%|███████████████████████▊ | 1.06G/1.65G [00:14<00:08, 72.7MB/s]
65%|███████████████████████▉ | 1.07G/1.65G [00:14<00:07, 74.5MB/s]
65%|████████████████████████▏ | 1.08G/1.65G [00:14<00:07, 75.8MB/s]
66%|████████████████████████▎ | 1.09G/1.65G [00:14<00:07, 76.7MB/s]
66%|████████████████████████▍ | 1.09G/1.65G [00:14<00:07, 76.1MB/s]
67%|████████████████████████▋ | 1.10G/1.65G [00:14<00:07, 77.4MB/s]
67%|████████████████████████▊ | 1.11G/1.65G [00:14<00:07, 77.4MB/s]
68%|█████████████████████████ | 1.12G/1.65G [00:15<00:06, 78.9MB/s]
68%|█████████████████████████▏ | 1.13G/1.65G [00:15<00:06, 80.7MB/s]
69%|█████████████████████████▍ | 1.13G/1.65G [00:15<00:06, 79.5MB/s]
69%|█████████████████████████▌ | 1.14G/1.65G [00:15<00:06, 78.8MB/s]
70%|█████████████████████████▊ | 1.15G/1.65G [00:15<00:06, 79.9MB/s]
70%|█████████████████████████▉ | 1.16G/1.65G [00:15<00:06, 81.1MB/s]
71%|██████████████████████████▏ | 1.17G/1.65G [00:15<00:06, 71.3MB/s]
71%|██████████████████████████▎ | 1.18G/1.65G [00:15<00:06, 74.5MB/s]
72%|██████████████████████████▍ | 1.18G/1.65G [00:15<00:06, 75.2MB/s]
72%|██████████████████████████▋ | 1.19G/1.65G [00:16<00:05, 77.7MB/s]
73%|██████████████████████████▊ | 1.20G/1.65G [00:16<00:06, 67.0MB/s]
73%|███████████████████████████ | 1.21G/1.65G [00:16<00:07, 63.3MB/s]
73%|███████████████████████████▏ | 1.21G/1.65G [00:16<00:06, 67.0MB/s]
74%|███████████████████████████▎ | 1.22G/1.65G [00:16<00:06, 68.5MB/s]
74%|███████████████████████████▌ | 1.23G/1.65G [00:16<00:06, 61.4MB/s]
75%|███████████████████████████▋ | 1.23G/1.65G [00:16<00:06, 60.1MB/s]
75%|███████████████████████████▊ | 1.24G/1.65G [00:16<00:07, 56.7MB/s]
75%|███████████████████████████▉ | 1.25G/1.65G [00:17<00:06, 58.1MB/s]
76%|████████████████████████████ | 1.26G/1.65G [00:17<00:06, 63.3MB/s]
76%|████████████████████████████▏ | 1.26G/1.65G [00:17<00:06, 63.6MB/s]
77%|████████████████████████████▍ | 1.27G/1.65G [00:17<00:05, 68.7MB/s]
77%|████████████████████████████▌ | 1.28G/1.65G [00:17<00:05, 69.8MB/s]
78%|████████████████████████████▋ | 1.28G/1.65G [00:17<00:05, 66.2MB/s]
78%|████████████████████████████▉ | 1.29G/1.65G [00:17<00:05, 68.7MB/s]
79%|█████████████████████████████ | 1.30G/1.65G [00:17<00:05, 64.6MB/s]
79%|█████████████████████████████▏ | 1.31G/1.65G [00:17<00:05, 68.0MB/s]
79%|█████████████████████████████▍ | 1.31G/1.65G [00:17<00:05, 60.7MB/s]
80%|█████████████████████████████▌ | 1.32G/1.65G [00:18<00:06, 55.3MB/s]
80%|█████████████████████████████▋ | 1.32G/1.65G [00:18<00:06, 51.9MB/s]
80%|█████████████████████████████▊ | 1.33G/1.65G [00:18<00:07, 45.6MB/s]
81%|█████████████████████████████▉ | 1.34G/1.65G [00:18<00:07, 45.2MB/s]
81%|█████████████████████████████▉ | 1.34G/1.65G [00:18<00:06, 44.8MB/s]
82%|██████████████████████████████▏ | 1.35G/1.65G [00:18<00:05, 54.4MB/s]
82%|██████████████████████████████▎ | 1.35G/1.65G [00:18<00:05, 50.4MB/s]
82%|██████████████████████████████▍ | 1.36G/1.65G [00:18<00:05, 57.2MB/s]
83%|██████████████████████████████▌ | 1.37G/1.65G [00:19<00:04, 58.6MB/s]
83%|██████████████████████████████▊ | 1.37G/1.65G [00:19<00:04, 59.8MB/s]
83%|██████████████████████████████▉ | 1.38G/1.65G [00:19<00:06, 42.5MB/s]
84%|███████████████████████████████ | 1.38G/1.65G [00:19<00:06, 44.5MB/s]
84%|███████████████████████████████▏ | 1.39G/1.65G [00:19<00:05, 49.9MB/s]
85%|███████████████████████████████▎ | 1.40G/1.65G [00:19<00:04, 52.1MB/s]
85%|███████████████████████████████▍ | 1.40G/1.65G [00:19<00:04, 55.7MB/s]
85%|███████████████████████████████▌ | 1.41G/1.65G [00:19<00:03, 62.5MB/s]
86%|███████████████████████████████▊ | 1.42G/1.65G [00:20<00:04, 56.7MB/s]
86%|███████████████████████████████▉ | 1.42G/1.65G [00:20<00:04, 50.8MB/s]
87%|████████████████████████████████ | 1.43G/1.65G [00:20<00:04, 50.7MB/s]
87%|████████████████████████████████▏ | 1.44G/1.65G [00:20<00:03, 54.9MB/s]
87%|████████████████████████████████▎ | 1.44G/1.65G [00:20<00:03, 56.2MB/s]
88%|████████████████████████████████▍ | 1.45G/1.65G [00:20<00:03, 54.9MB/s]
88%|████████████████████████████████▌ | 1.45G/1.65G [00:20<00:03, 57.0MB/s]
88%|████████████████████████████████▋ | 1.46G/1.65G [00:20<00:03, 58.2MB/s]
89%|████████████████████████████████▊ | 1.47G/1.65G [00:20<00:03, 55.5MB/s]
89%|████████████████████████████████▉ | 1.47G/1.65G [00:21<00:03, 58.5MB/s]
90%|█████████████████████████████████ | 1.48G/1.65G [00:21<00:03, 48.9MB/s]
90%|█████████████████████████████████▎ | 1.49G/1.65G [00:21<00:02, 57.8MB/s]
90%|█████████████████████████████████▍ | 1.49G/1.65G [00:21<00:02, 57.2MB/s]
91%|█████████████████████████████████▌ | 1.50G/1.65G [00:21<00:02, 61.3MB/s]
91%|█████████████████████████████████▊ | 1.51G/1.65G [00:21<00:02, 51.2MB/s]
92%|█████████████████████████████████▊ | 1.51G/1.65G [00:21<00:02, 47.1MB/s]
92%|█████████████████████████████████▉ | 1.52G/1.65G [00:21<00:03, 44.4MB/s]
92%|██████████████████████████████████ | 1.52G/1.65G [00:22<00:03, 39.7MB/s]
92%|██████████████████████████████████▏ | 1.53G/1.65G [00:22<00:02, 43.3MB/s]
93%|██████████████████████████████████▎ | 1.53G/1.65G [00:22<00:02, 45.0MB/s]
93%|██████████████████████████████████▍ | 1.54G/1.65G [00:22<00:02, 47.1MB/s]
93%|██████████████████████████████████▌ | 1.54G/1.65G [00:22<00:02, 46.7MB/s]
94%|██████████████████████████████████▋ | 1.55G/1.65G [00:22<00:02, 47.1MB/s]
94%|██████████████████████████████████▊ | 1.55G/1.65G [00:22<00:02, 47.3MB/s]
94%|██████████████████████████████████▉ | 1.56G/1.65G [00:22<00:02, 47.0MB/s]
95%|██████████████████████████████████▉ | 1.56G/1.65G [00:22<00:01, 47.9MB/s]
95%|███████████████████████████████████ | 1.57G/1.65G [00:23<00:01, 44.2MB/s]
95%|███████████████████████████████████▏ | 1.57G/1.65G [00:23<00:01, 40.5MB/s]
95%|███████████████████████████████████▎ | 1.58G/1.65G [00:23<00:01, 38.1MB/s]
96%|███████████████████████████████████▍ | 1.58G/1.65G [00:23<00:01, 37.8MB/s]
96%|███████████████████████████████████▍ | 1.58G/1.65G [00:23<00:01, 38.5MB/s]
96%|███████████████████████████████████▌ | 1.59G/1.65G [00:23<00:01, 39.3MB/s]
96%|███████████████████████████████████▋ | 1.59G/1.65G [00:23<00:01, 43.1MB/s]
97%|███████████████████████████████████▊ | 1.60G/1.65G [00:23<00:01, 42.1MB/s]
97%|███████████████████████████████████▉ | 1.60G/1.65G [00:23<00:01, 42.9MB/s]
97%|███████████████████████████████████▉ | 1.61G/1.65G [00:24<00:01, 43.6MB/s]
98%|████████████████████████████████████ | 1.61G/1.65G [00:24<00:00, 47.2MB/s]
98%|████████████████████████████████████▏| 1.62G/1.65G [00:24<00:00, 49.0MB/s]
98%|████████████████████████████████████▍| 1.63G/1.65G [00:24<00:00, 56.1MB/s]
99%|████████████████████████████████████▌| 1.63G/1.65G [00:24<00:00, 62.4MB/s]
99%|████████████████████████████████████▋| 1.64G/1.65G [00:24<00:00, 59.5MB/s]
100%|████████████████████████████████████▊| 1.65G/1.65G [00:24<00:00, 61.2MB/s]
0%| | 0.00/1.65G [00:00<?, ?B/s]
100%|█████████████████████████████████████| 1.65G/1.65G [00:00<00:00, 6.16TB/s]
Download complete in 58s (1576.2 MB)
Filtering raw data in 1 contiguous segment
Setting up high-pass filter at 2 Hz
IIR filter parameters
---------------------
Butterworth highpass zero-phase (two-pass forward and reverse) non-causal filter:
- Filter order 8 (effective, after forward-backward)
- Cutoff at 2.00 Hz: -6.02 dB
Extract Xdawn covariance matrices¶
nfilter = 4
xdwn = XdawnCovariances(estimator="scm", nfilter=nfilter)
split = train_test_split(X, y, train_size=0.25, random_state=42)
Xtrain, Xtest, ytrain, ytest = split
covs = xdwn.fit(Xtrain, ytrain).transform(Xtest)
Spectral Embedding (SE)¶
plot_embedding(covs, ytest, metric="riemann", embd_type="Spectral",
normalize=True)
plt.show()

Locally Linear Embedding (LLE)¶
plot_embedding(covs, ytest, metric="riemann", embd_type="LocallyLinear",
normalize=False)
plt.show()

TNSE¶
plot_embedding(covs, ytest, metric="riemann", embd_type="TSNE",
normalize=False, max_iter=50)
plt.show()

/home/docs/checkouts/readthedocs.org/user_builds/pyriemann/checkouts/latest/pyriemann/optimization/positive_definite.py:284: UserWarning: Convergence not reached. Try increasing max_iter.
warnings.warn("Convergence not reached. Try increasing max_iter.")
References¶
Total running time of the script: (1 minutes 5.976 seconds)