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...
Fetching 1 file for the sample dataset ...
0%| | 0.00/1.65G [00:00<?, ?B/s]
0%| | 166k/1.65G [00:00<16:36, 1.66MB/s]
0%| | 2.04M/1.65G [00:00<02:21, 11.7MB/s]
1%|▏ | 8.31M/1.65G [00:00<00:47, 35.0MB/s]
1%|▎ | 15.7M/1.65G [00:00<00:32, 50.3MB/s]
1%|▌ | 22.8M/1.65G [00:00<00:28, 57.8MB/s]
2%|▋ | 30.0M/1.65G [00:00<00:25, 62.6MB/s]
2%|▊ | 37.2M/1.65G [00:00<00:24, 65.8MB/s]
3%|▉ | 44.7M/1.65G [00:00<00:23, 68.5MB/s]
3%|█▏ | 52.0M/1.65G [00:00<00:22, 70.0MB/s]
4%|█▎ | 59.4M/1.65G [00:01<00:22, 71.4MB/s]
4%|█▍ | 66.7M/1.65G [00:01<00:22, 71.7MB/s]
4%|█▋ | 74.0M/1.65G [00:01<00:21, 72.2MB/s]
5%|█▊ | 81.3M/1.65G [00:01<00:21, 72.5MB/s]
5%|█▉ | 88.7M/1.65G [00:01<00:21, 72.9MB/s]
6%|██▏ | 96.0M/1.65G [00:01<00:21, 72.7MB/s]
6%|██▍ | 103M/1.65G [00:01<00:21, 73.0MB/s]
7%|██▌ | 111M/1.65G [00:01<00:21, 73.0MB/s]
7%|██▋ | 118M/1.65G [00:01<00:20, 73.3MB/s]
8%|██▉ | 125M/1.65G [00:01<00:20, 73.2MB/s]
8%|███ | 133M/1.65G [00:02<00:20, 73.2MB/s]
8%|███▏ | 140M/1.65G [00:02<00:20, 73.2MB/s]
9%|███▍ | 147M/1.65G [00:02<00:20, 73.1MB/s]
9%|███▌ | 155M/1.65G [00:02<00:20, 72.7MB/s]
10%|███▋ | 162M/1.65G [00:02<00:20, 73.1MB/s]
10%|███▉ | 169M/1.65G [00:02<00:20, 70.9MB/s]
11%|████ | 177M/1.65G [00:02<00:20, 71.1MB/s]
11%|████▏ | 184M/1.65G [00:02<00:20, 72.1MB/s]
12%|████▍ | 191M/1.65G [00:02<00:20, 72.6MB/s]
12%|████▌ | 199M/1.65G [00:02<00:19, 73.3MB/s]
12%|████▋ | 206M/1.65G [00:03<00:19, 73.4MB/s]
13%|████▉ | 214M/1.65G [00:03<00:19, 73.9MB/s]
13%|█████ | 221M/1.65G [00:03<00:19, 74.1MB/s]
14%|█████▎ | 229M/1.65G [00:03<00:19, 74.1MB/s]
14%|█████▍ | 236M/1.65G [00:03<00:19, 74.2MB/s]
15%|█████▌ | 244M/1.65G [00:03<00:19, 74.1MB/s]
15%|█████▊ | 251M/1.65G [00:03<00:19, 73.7MB/s]
16%|█████▉ | 258M/1.65G [00:03<00:18, 74.0MB/s]
16%|██████ | 266M/1.65G [00:03<00:18, 73.9MB/s]
17%|██████▎ | 273M/1.65G [00:03<00:18, 74.0MB/s]
17%|██████▍ | 281M/1.65G [00:04<00:18, 73.8MB/s]
17%|██████▌ | 288M/1.65G [00:04<00:18, 73.7MB/s]
18%|██████▊ | 296M/1.65G [00:04<00:18, 74.1MB/s]
18%|██████▉ | 303M/1.65G [00:04<00:18, 73.7MB/s]
19%|███████▏ | 310M/1.65G [00:04<00:18, 73.9MB/s]
19%|███████▎ | 318M/1.65G [00:04<00:18, 73.4MB/s]
20%|███████▍ | 325M/1.65G [00:04<00:18, 73.6MB/s]
20%|███████▋ | 333M/1.65G [00:04<00:17, 73.7MB/s]
21%|███████▊ | 340M/1.65G [00:04<00:17, 73.9MB/s]
21%|███████▉ | 347M/1.65G [00:04<00:17, 74.2MB/s]
21%|████████▏ | 355M/1.65G [00:05<00:17, 74.3MB/s]
22%|████████▎ | 362M/1.65G [00:05<00:17, 74.4MB/s]
22%|████████▌ | 370M/1.65G [00:05<00:16, 75.7MB/s]
23%|████████▋ | 378M/1.65G [00:05<00:19, 66.1MB/s]
23%|████████▊ | 385M/1.65G [00:05<00:18, 67.6MB/s]
24%|█████████ | 392M/1.65G [00:05<00:18, 69.1MB/s]
24%|█████████▏ | 400M/1.65G [00:05<00:17, 70.6MB/s]
25%|█████████▎ | 407M/1.65G [00:05<00:17, 71.4MB/s]
25%|█████████▌ | 414M/1.65G [00:05<00:17, 72.2MB/s]
26%|█████████▋ | 422M/1.65G [00:05<00:16, 72.8MB/s]
26%|█████████▊ | 429M/1.65G [00:06<00:16, 72.7MB/s]
26%|██████████ | 437M/1.65G [00:06<00:16, 73.1MB/s]
27%|██████████▏ | 444M/1.65G [00:06<00:16, 73.2MB/s]
27%|██████████▍ | 451M/1.65G [00:06<00:16, 73.6MB/s]
28%|██████████▌ | 459M/1.65G [00:06<00:16, 73.2MB/s]
28%|██████████▋ | 466M/1.65G [00:06<00:16, 72.8MB/s]
29%|██████████▉ | 474M/1.65G [00:06<00:16, 73.4MB/s]
29%|███████████ | 481M/1.65G [00:06<00:16, 73.0MB/s]
30%|███████████▏ | 488M/1.65G [00:06<00:16, 72.4MB/s]
30%|███████████▍ | 495M/1.65G [00:06<00:15, 72.4MB/s]
30%|███████████▌ | 503M/1.65G [00:07<00:16, 71.9MB/s]
31%|███████████▋ | 510M/1.65G [00:07<00:15, 71.9MB/s]
31%|███████████▉ | 517M/1.65G [00:07<00:15, 72.1MB/s]
32%|████████████ | 525M/1.65G [00:07<00:15, 72.6MB/s]
32%|████████████▏ | 532M/1.65G [00:07<00:15, 72.9MB/s]
33%|████████████▍ | 539M/1.65G [00:07<00:15, 73.2MB/s]
33%|████████████▌ | 547M/1.65G [00:07<00:15, 73.4MB/s]
34%|████████████▋ | 554M/1.65G [00:07<00:14, 73.7MB/s]
34%|████████████▉ | 562M/1.65G [00:07<00:14, 73.2MB/s]
34%|█████████████ | 569M/1.65G [00:07<00:15, 71.4MB/s]
35%|█████████████▏ | 576M/1.65G [00:08<00:15, 71.1MB/s]
35%|█████████████▍ | 583M/1.65G [00:08<00:14, 71.4MB/s]
36%|█████████████▌ | 590M/1.65G [00:08<00:14, 71.3MB/s]
36%|█████████████▋ | 597M/1.65G [00:08<00:14, 70.4MB/s]
37%|█████████████▉ | 604M/1.65G [00:08<00:14, 70.1MB/s]
37%|██████████████ | 612M/1.65G [00:08<00:14, 70.2MB/s]
37%|██████████████▏ | 619M/1.65G [00:08<00:14, 70.5MB/s]
38%|██████████████▍ | 626M/1.65G [00:08<00:14, 69.8MB/s]
38%|██████████████▌ | 633M/1.65G [00:08<00:14, 70.7MB/s]
39%|██████████████▋ | 640M/1.65G [00:09<00:14, 71.2MB/s]
39%|██████████████▉ | 648M/1.65G [00:09<00:14, 71.7MB/s]
40%|███████████████ | 655M/1.65G [00:09<00:14, 70.9MB/s]
40%|███████████████▏ | 662M/1.65G [00:09<00:13, 71.3MB/s]
40%|███████████████▍ | 669M/1.65G [00:09<00:13, 71.7MB/s]
41%|███████████████▌ | 676M/1.65G [00:09<00:13, 71.4MB/s]
41%|███████████████▋ | 683M/1.65G [00:09<00:13, 70.3MB/s]
42%|███████████████▉ | 691M/1.65G [00:09<00:13, 70.4MB/s]
42%|████████████████ | 698M/1.65G [00:09<00:13, 70.7MB/s]
43%|████████████████▏ | 705M/1.65G [00:09<00:13, 70.6MB/s]
43%|████████████████▎ | 712M/1.65G [00:10<00:13, 70.7MB/s]
43%|████████████████▌ | 719M/1.65G [00:10<00:13, 69.8MB/s]
44%|████████████████▋ | 726M/1.65G [00:10<00:13, 70.1MB/s]
44%|████████████████▊ | 733M/1.65G [00:10<00:13, 69.9MB/s]
45%|█████████████████ | 740M/1.65G [00:10<00:12, 70.4MB/s]
45%|█████████████████▏ | 747M/1.65G [00:10<00:13, 69.0MB/s]
46%|█████████████████▎ | 754M/1.65G [00:10<00:12, 69.4MB/s]
46%|█████████████████▌ | 761M/1.65G [00:10<00:12, 70.2MB/s]
47%|█████████████████▋ | 769M/1.65G [00:10<00:12, 70.6MB/s]
47%|█████████████████▊ | 776M/1.65G [00:10<00:12, 70.2MB/s]
47%|█████████████████▉ | 783M/1.65G [00:11<00:12, 70.7MB/s]
48%|██████████████████▏ | 790M/1.65G [00:11<00:12, 71.4MB/s]
48%|██████████████████▎ | 797M/1.65G [00:11<00:11, 71.7MB/s]
49%|██████████████████▍ | 805M/1.65G [00:11<00:11, 71.0MB/s]
49%|██████████████████▋ | 812M/1.65G [00:11<00:11, 71.1MB/s]
50%|██████████████████▊ | 819M/1.65G [00:11<00:11, 71.8MB/s]
50%|██████████████████▉ | 826M/1.65G [00:11<00:11, 71.7MB/s]
50%|███████████████████▏ | 833M/1.65G [00:11<00:11, 70.8MB/s]
51%|███████████████████▎ | 841M/1.65G [00:11<00:11, 71.5MB/s]
51%|███████████████████▍ | 848M/1.65G [00:11<00:11, 71.6MB/s]
52%|███████████████████▋ | 855M/1.65G [00:12<00:11, 71.7MB/s]
52%|███████████████████▊ | 862M/1.65G [00:12<00:11, 70.6MB/s]
53%|███████████████████▉ | 870M/1.65G [00:12<00:10, 71.4MB/s]
53%|████████████████████▏ | 877M/1.65G [00:12<00:10, 71.2MB/s]
53%|████████████████████▎ | 884M/1.65G [00:12<00:10, 71.5MB/s]
54%|████████████████████▍ | 891M/1.65G [00:12<00:10, 70.5MB/s]
54%|████████████████████▋ | 898M/1.65G [00:12<00:10, 70.7MB/s]
55%|████████████████████▊ | 906M/1.65G [00:12<00:10, 71.2MB/s]
55%|████████████████████▉ | 913M/1.65G [00:12<00:10, 72.1MB/s]
56%|█████████████████████▏ | 920M/1.65G [00:12<00:10, 71.5MB/s]
56%|█████████████████████▎ | 928M/1.65G [00:13<00:10, 72.2MB/s]
57%|█████████████████████▍ | 935M/1.65G [00:13<00:09, 72.4MB/s]
57%|█████████████████████▋ | 942M/1.65G [00:13<00:09, 72.8MB/s]
57%|█████████████████████▊ | 949M/1.65G [00:13<00:09, 71.7MB/s]
58%|█████████████████████▉ | 957M/1.65G [00:13<00:09, 72.2MB/s]
58%|██████████████████████▏ | 964M/1.65G [00:13<00:09, 72.1MB/s]
59%|██████████████████████▎ | 971M/1.65G [00:13<00:09, 72.5MB/s]
59%|██████████████████████▌ | 979M/1.65G [00:13<00:09, 71.5MB/s]
60%|██████████████████████▋ | 986M/1.65G [00:13<00:09, 71.9MB/s]
60%|██████████████████████▊ | 993M/1.65G [00:13<00:09, 71.9MB/s]
61%|██████████████████████▍ | 1.00G/1.65G [00:14<00:09, 72.1MB/s]
61%|██████████████████████▌ | 1.01G/1.65G [00:14<00:09, 70.8MB/s]
61%|██████████████████████▋ | 1.01G/1.65G [00:14<00:08, 71.3MB/s]
62%|██████████████████████▉ | 1.02G/1.65G [00:14<00:08, 71.5MB/s]
62%|███████████████████████ | 1.03G/1.65G [00:14<00:08, 71.6MB/s]
63%|███████████████████████▏ | 1.04G/1.65G [00:14<00:08, 69.9MB/s]
63%|███████████████████████▎ | 1.04G/1.65G [00:14<00:08, 70.8MB/s]
64%|███████████████████████▌ | 1.05G/1.65G [00:14<00:08, 71.2MB/s]
64%|███████████████████████▋ | 1.06G/1.65G [00:14<00:08, 71.3MB/s]
64%|███████████████████████▊ | 1.07G/1.65G [00:14<00:08, 70.7MB/s]
65%|████████████████████████ | 1.07G/1.65G [00:15<00:08, 70.9MB/s]
65%|████████████████████████▏ | 1.08G/1.65G [00:15<00:08, 71.4MB/s]
66%|████████████████████████▎ | 1.09G/1.65G [00:15<00:07, 71.9MB/s]
66%|████████████████████████▍ | 1.09G/1.65G [00:15<00:07, 72.2MB/s]
67%|████████████████████████▋ | 1.10G/1.65G [00:15<00:07, 70.9MB/s]
67%|████████████████████████▊ | 1.11G/1.65G [00:15<00:07, 70.9MB/s]
68%|████████████████████████▉ | 1.12G/1.65G [00:15<00:07, 71.4MB/s]
68%|█████████████████████████▏ | 1.12G/1.65G [00:15<00:07, 71.8MB/s]
68%|█████████████████████████▎ | 1.13G/1.65G [00:15<00:07, 72.0MB/s]
69%|█████████████████████████▍ | 1.14G/1.65G [00:15<00:07, 71.1MB/s]
69%|█████████████████████████▌ | 1.14G/1.65G [00:16<00:07, 71.2MB/s]
70%|█████████████████████████▊ | 1.15G/1.65G [00:16<00:07, 71.1MB/s]
70%|█████████████████████████▉ | 1.16G/1.65G [00:16<00:06, 71.1MB/s]
71%|██████████████████████████ | 1.17G/1.65G [00:16<00:06, 70.3MB/s]
71%|██████████████████████████▎ | 1.17G/1.65G [00:16<00:06, 70.7MB/s]
71%|██████████████████████████▍ | 1.18G/1.65G [00:16<00:06, 70.6MB/s]
72%|██████████████████████████▌ | 1.19G/1.65G [00:16<00:06, 71.3MB/s]
72%|██████████████████████████▋ | 1.19G/1.65G [00:16<00:06, 71.8MB/s]
73%|██████████████████████████▉ | 1.20G/1.65G [00:16<00:06, 71.1MB/s]
73%|███████████████████████████ | 1.21G/1.65G [00:17<00:06, 71.6MB/s]
74%|███████████████████████████▏ | 1.22G/1.65G [00:17<00:06, 71.8MB/s]
74%|███████████████████████████▍ | 1.22G/1.65G [00:17<00:05, 72.1MB/s]
74%|███████████████████████████▌ | 1.23G/1.65G [00:17<00:05, 71.4MB/s]
75%|███████████████████████████▋ | 1.24G/1.65G [00:17<00:05, 71.2MB/s]
75%|███████████████████████████▉ | 1.25G/1.65G [00:17<00:05, 71.6MB/s]
76%|████████████████████████████ | 1.25G/1.65G [00:17<00:05, 70.5MB/s]
76%|████████████████████████████▏ | 1.26G/1.65G [00:17<00:05, 66.9MB/s]
77%|████████████████████████████▎ | 1.27G/1.65G [00:17<00:05, 65.0MB/s]
77%|████████████████████████████▌ | 1.27G/1.65G [00:17<00:05, 66.2MB/s]
77%|████████████████████████████▋ | 1.28G/1.65G [00:18<00:05, 67.6MB/s]
78%|████████████████████████████▊ | 1.29G/1.65G [00:18<00:05, 68.7MB/s]
78%|████████████████████████████▉ | 1.29G/1.65G [00:18<00:05, 69.7MB/s]
79%|█████████████████████████████▏ | 1.30G/1.65G [00:18<00:05, 68.4MB/s]
79%|█████████████████████████████▎ | 1.31G/1.65G [00:18<00:04, 69.5MB/s]
80%|█████████████████████████████▍ | 1.32G/1.65G [00:18<00:04, 70.0MB/s]
80%|█████████████████████████████▋ | 1.32G/1.65G [00:18<00:04, 71.3MB/s]
81%|█████████████████████████████▊ | 1.33G/1.65G [00:18<00:04, 72.3MB/s]
81%|█████████████████████████████▉ | 1.34G/1.65G [00:18<00:04, 72.1MB/s]
81%|██████████████████████████████ | 1.35G/1.65G [00:18<00:04, 73.0MB/s]
82%|██████████████████████████████▎ | 1.35G/1.65G [00:19<00:04, 73.5MB/s]
82%|██████████████████████████████▍ | 1.36G/1.65G [00:19<00:03, 74.1MB/s]
83%|██████████████████████████████▋ | 1.37G/1.65G [00:19<00:03, 73.4MB/s]
83%|██████████████████████████████▊ | 1.38G/1.65G [00:19<00:03, 74.2MB/s]
84%|██████████████████████████████▉ | 1.38G/1.65G [00:19<00:03, 74.2MB/s]
84%|███████████████████████████████▏ | 1.39G/1.65G [00:19<00:03, 74.4MB/s]
85%|███████████████████████████████▎ | 1.40G/1.65G [00:19<00:03, 74.3MB/s]
85%|███████████████████████████████▍ | 1.41G/1.65G [00:19<00:03, 73.3MB/s]
85%|███████████████████████████████▋ | 1.41G/1.65G [00:19<00:03, 73.8MB/s]
86%|███████████████████████████████▊ | 1.42G/1.65G [00:19<00:03, 74.0MB/s]
86%|███████████████████████████████▉ | 1.43G/1.65G [00:20<00:03, 73.6MB/s]
87%|████████████████████████████████▏ | 1.44G/1.65G [00:20<00:03, 71.7MB/s]
87%|████████████████████████████████▎ | 1.44G/1.65G [00:20<00:02, 71.8MB/s]
88%|████████████████████████████████▍ | 1.45G/1.65G [00:20<00:02, 71.6MB/s]
88%|████████████████████████████████▌ | 1.46G/1.65G [00:20<00:02, 71.6MB/s]
89%|████████████████████████████████▊ | 1.46G/1.65G [00:20<00:02, 71.3MB/s]
89%|████████████████████████████████▉ | 1.47G/1.65G [00:20<00:02, 70.0MB/s]
89%|█████████████████████████████████ | 1.48G/1.65G [00:20<00:02, 70.3MB/s]
90%|█████████████████████████████████▎ | 1.49G/1.65G [00:20<00:02, 70.9MB/s]
90%|█████████████████████████████████▍ | 1.49G/1.65G [00:20<00:02, 71.9MB/s]
91%|█████████████████████████████████▌ | 1.50G/1.65G [00:21<00:02, 71.9MB/s]
91%|█████████████████████████████████▋ | 1.51G/1.65G [00:21<00:02, 72.4MB/s]
92%|█████████████████████████████████▉ | 1.51G/1.65G [00:21<00:01, 73.3MB/s]
92%|██████████████████████████████████ | 1.52G/1.65G [00:21<00:01, 73.6MB/s]
93%|██████████████████████████████████▏ | 1.53G/1.65G [00:21<00:01, 73.5MB/s]
93%|██████████████████████████████████▍ | 1.54G/1.65G [00:21<00:01, 72.6MB/s]
93%|██████████████████████████████████▌ | 1.54G/1.65G [00:21<00:01, 73.2MB/s]
94%|██████████████████████████████████▋ | 1.55G/1.65G [00:21<00:01, 73.7MB/s]
94%|██████████████████████████████████▉ | 1.56G/1.65G [00:21<00:01, 73.9MB/s]
95%|███████████████████████████████████ | 1.57G/1.65G [00:21<00:01, 74.2MB/s]
95%|███████████████████████████████████▏ | 1.57G/1.65G [00:22<00:01, 72.7MB/s]
96%|███████████████████████████████████▍ | 1.58G/1.65G [00:22<00:00, 72.9MB/s]
96%|███████████████████████████████████▌ | 1.59G/1.65G [00:22<00:00, 73.3MB/s]
97%|███████████████████████████████████▋ | 1.60G/1.65G [00:22<00:00, 73.5MB/s]
97%|███████████████████████████████████▉ | 1.60G/1.65G [00:22<00:00, 73.5MB/s]
97%|████████████████████████████████████ | 1.61G/1.65G [00:22<00:00, 71.9MB/s]
98%|████████████████████████████████████▏| 1.62G/1.65G [00:22<00:00, 72.9MB/s]
98%|████████████████████████████████████▍| 1.63G/1.65G [00:22<00:00, 73.6MB/s]
99%|████████████████████████████████████▌| 1.63G/1.65G [00:22<00:00, 74.1MB/s]
99%|████████████████████████████████████▋| 1.64G/1.65G [00:22<00:00, 74.6MB/s]
100%|████████████████████████████████████▉| 1.65G/1.65G [00:23<00:00, 74.4MB/s]
0%| | 0.00/1.65G [00:00<?, ?B/s]
100%|█████████████████████████████████████| 1.65G/1.65G [00:00<00:00, 6.88TB/s]
Download complete in 59s (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 10.853 seconds)