-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdecoding.html
More file actions
382 lines (366 loc) · 40.5 KB
/
Copy pathdecoding.html
File metadata and controls
382 lines (366 loc) · 40.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
<title>Conduct Classification-based EEG Decoding — NeuroRA 1.1.6.8 documentation</title>
<link rel="stylesheet" type="text/css" href="static/pygments.css" />
<link rel="stylesheet" type="text/css" href="static/classic.css" />
<script data-url_root="./" id="documentation_options" src="static/documentation_options.js"></script>
<script src="static/jquery.js"></script>
<script src="static/underscore.js"></script>
<script src="static/doctools.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="Statistical Analysis" href="stats_cal.html" />
<link rel="prev" title="Cross-Temporal Representational Similarity Analysis (CTRSA)" href="ctrsa.html" />
</head><body>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="stats_cal.html" title="Statistical Analysis"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="ctrsa.html" title="Cross-Temporal Representational Similarity Analysis (CTRSA)"
accesskey="P">previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">NeuroRA 1.1.6.8 documentation</a> »</li>
<li class="nav-item nav-item-this"><a href="">Conduct Classification-based EEG Decoding</a></li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<section id="conduct-classification-based-eeg-decoding">
<h1>Conduct Classification-based EEG Decoding<a class="headerlink" href="#conduct-classification-based-eeg-decoding" title="Permalink to this headline">¶</a></h1>
<section id="module-neurora.decoding">
<span id="neurora-decoding-module"></span><h2>neurora.decoding module<a class="headerlink" href="#module-neurora.decoding" title="Permalink to this headline">¶</a></h2>
<p>a module for classification-based neural decoding</p>
<dl class="py function">
<dt class="sig sig-object py" id="neurora.decoding.bidirectional_transfer_decoding">
<span class="sig-prename descclassname"><span class="pre">neurora.decoding.</span></span><span class="sig-name descname"><span class="pre">bidirectional_transfer_decoding</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">data1</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">labels1</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data2</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">labels2</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">n</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">2</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">navg</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">5</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">time_opt</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'average'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">time_win</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">5</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">time_step</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">5</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">iter</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">10</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">normalization</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">pca</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">pca_components</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0.95</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">smooth</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#neurora.decoding.bidirectional_transfer_decoding" title="Permalink to this definition">¶</a></dt>
<dd><p>Conduct bidirectional transfer decoding for EEG-like data</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>data1</strong> (<em>array</em>) – The neural data under condition1.
The shape of data must be [n_subs, n_trials, n_chls, n_ts]. n_subs, n_trials, n_chls and n_ts represent the
number of subjects, the number of trails, the number of channels and the number of time-points.</p></li>
<li><p><strong>labels1</strong> (<em>array</em>) – The labels of each trials under condition1.
The shape of labels must be [n_subs, n_trials]. n_subs and n_trials represent the number of subjects and the
number of trials.</p></li>
<li><p><strong>data2</strong> (<em>array</em>) – The neural data under condition2.</p></li>
<li><p><strong>labels2</strong> (<em>array</em>) – The labels of each trials under condition2.</p></li>
<li><p><strong>n</strong> (<em>int. Default is 2.</em>) – The number of categories for classification.</p></li>
<li><p><strong>navg</strong> (<em>int. Default is 5.</em>) – The number of trials used to average.</p></li>
<li><p><strong>time_opt</strong> (<em>string "average"</em><em> or </em><em>"features". Default is "average".</em>) – Average the time-points or regard the time points as features for classification
If time_opt=”average”, the time-points in a certain time-window will be averaged.
If time_opt=”features”, the time-points in a certain time-window will be used as features for classification.</p></li>
<li><p><strong>time_win</strong> (<em>int. Default is 5.</em>) – Set a time-window for decoding for different time-points.
If time_win=5, that means each decoding process based on 5 time-points.</p></li>
<li><p><strong>time_step</strong> (<em>int. Default is 5.</em>) – The time step size for each time of decoding.</p></li>
<li><p><strong>iter</strong> (<em>int. Default is 10.</em>) – The times for iteration.</p></li>
<li><p><strong>normalization</strong> (<em>boolean True</em><em> or </em><em>False. Default is False.</em>) – Normalize the data or not.</p></li>
<li><p><strong>pca</strong> (<em>boolean True</em><em> or </em><em>False. Default is True.</em>) – Apply principal component analysis (PCA).</p></li>
<li><p><strong>pca_components</strong> (<em>int</em><em> or </em><em>float. Default is 0.95.</em>) – Number of components for PCA to keep. If 0<pca_components<1, select the numbder of components such that the
amount of variance that needs to be explained is greater than the percentage specified by pca_components.</p></li>
<li><p><strong>smooth</strong> (<em>boolean True</em><em> or </em><em>False</em><em>, or </em><em>int. Default is True.</em>) – Smooth the decoding result or not.
If smooth = True, the default smoothing step is 5. If smooth = n (type of n: int), the smoothing step is n.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><ul class="simple">
<li><p><strong>Con1toCon2_accuracies</strong> (<em>array</em>) – The 1 transfer to 2 decoding accuracies.
The shape of accuracies is [n_subs, int((n_ts1-time_win)/time_step)+1, int((n_ts2-time_win)/time_step)+1].</p></li>
<li><p><strong>Con2toCon1_accuracies</strong> (<em>array</em>) – The 2 transfer to 1 decoding accuracies.
The shape of accuracies is [n_subs, int((n_ts2-time_win)/time_step)+1, int((n_ts1-time_win)/time_step)+1].</p></li>
</ul>
</p>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="neurora.decoding.ct_decoding_holdout">
<span class="sig-prename descclassname"><span class="pre">neurora.decoding.</span></span><span class="sig-name descname"><span class="pre">ct_decoding_holdout</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">data</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">labels</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">n</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">2</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">navg</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">5</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">time_opt</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'average'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">time_win</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">5</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">time_step</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">5</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">iter</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">10</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">test_size</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0.3</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">normalization</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">pca</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">pca_components</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0.95</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">smooth</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#neurora.decoding.ct_decoding_holdout" title="Permalink to this definition">¶</a></dt>
<dd><p>Conduct cross-temporal decoding for EEG-like data (hold-out)</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>data</strong> (<em>array</em>) – The neural data.
The shape of data must be [n_subs, n_trials, n_chls, n_ts]. n_subs, n_trials, n_chls and n_ts represent the
number of subjects, the number of trails, the number of channels and the number of time-points.</p></li>
<li><p><strong>labels</strong> (<em>array</em>) – The labels of each trial.
The shape of labels must be [n_subs, n_trials]. n_subs and n_trials represent the number of subjects and the
number of trials.</p></li>
<li><p><strong>n</strong> (<em>int. Default is 2.</em>) – The number of categories for classification.</p></li>
<li><p><strong>navg</strong> (<em>int. Default is 5.</em>) – The number of trials used to average.</p></li>
<li><p><strong>time_opt</strong> (<em>string "average"</em><em> or </em><em>"features". Default is "average".</em>) – Average the time-points or regard the time points as features for classification
If time_opt=”average”, the time-points in a certain time-window will be averaged.
If time_opt=”features”, the time-points in a certain time-window will be used as features for classification.</p></li>
<li><p><strong>time_win</strong> (<em>int. Default is 5.</em>) – Set a time-window for decoding for different time-points.
If time_win=5, that means each decoding process based on 5 time-points.</p></li>
<li><p><strong>time_step</strong> (<em>int. Default is 5.</em>) – The time step size for each time of decoding.</p></li>
<li><p><strong>iter</strong> (<em>int. Default is 10.</em>) – The times for iteration.</p></li>
<li><p><strong>test_size</strong> (<em>float. Default is 0.3.</em>) – The proportion of the test set.
test_size should be between 0.0 and 1.0.</p></li>
<li><p><strong>normalization</strong> (<em>boolean True</em><em> or </em><em>False. Default is False.</em>) – Normalize the data or not.</p></li>
<li><p><strong>pca</strong> (<em>boolean True</em><em> or </em><em>False. Default is True.</em>) – Apply principal component analysis (PCA).</p></li>
<li><p><strong>pca_components</strong> (<em>int</em><em> or </em><em>float. Default is 0.95.</em>) – Number of components for PCA to keep. If 0<pca_components<1, select the numbder of components such that the
amount of variance that needs to be explained is greater than the percentage specified by pca_components.</p></li>
<li><p><strong>smooth</strong> (<em>boolean True</em><em> or </em><em>False</em><em>, or </em><em>int. Default is True.</em>) – Smooth the decoding result or not.
If smooth = True, the default smoothing step is 5. If smooth = n (type of n: int), the smoothing step is n.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><strong>accuracies</strong> – The cross-temporal decoding accuracies.
The shape of accuracies is [n_subs, int((n_ts-time_win)/time_step)+1, int((n_ts-time_win)/time_step)+1].</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>array</p>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="neurora.decoding.ct_decoding_kfold">
<span class="sig-prename descclassname"><span class="pre">neurora.decoding.</span></span><span class="sig-name descname"><span class="pre">ct_decoding_kfold</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">data</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">labels</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">n</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">2</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">navg</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">5</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">time_opt</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'average'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">time_win</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">5</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">time_step</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">5</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">nfolds</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">5</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">nrepeats</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">2</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">normalization</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">pca</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">pca_components</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0.95</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">smooth</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#neurora.decoding.ct_decoding_kfold" title="Permalink to this definition">¶</a></dt>
<dd><p>Conduct cross-temporal decoding for EEG-like data (cross validation)</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>data</strong> (<em>array</em>) – The neural data.
The shape of data must be [n_subs, n_trials, n_chls, n_ts]. n_subs, n_trials, n_chls and n_ts represent the
number of subjects, the number of trails, the number of channels and the number of time-points.</p></li>
<li><p><strong>labels</strong> (<em>array</em>) – The labels of each trial.
The shape of labels must be [n_subs, n_trials]. n_subs and n_trials represent the number of subjects and the
number of trials.</p></li>
<li><p><strong>n</strong> (<em>int. Default is 2.</em>) – The number of categories for classification.</p></li>
<li><p><strong>navg</strong> (<em>int. Default is 5.</em>) – The number of trials used to average.</p></li>
<li><p><strong>time_opt</strong> (<em>string "average"</em><em> or </em><em>"features". Default is "average".</em>) – Average the time-points or regard the time points as features for classification
If time_opt=”average”, the time-points in a certain time-window will be averaged.
If time_opt=”features”, the time-points in a certain time-window will be used as features for classification.</p></li>
<li><p><strong>time_win</strong> (<em>int. Default is 5.</em>) – Set a time-window for decoding for different time-points.
If time_win=5, that means each decoding process based on 5 time-points.</p></li>
<li><p><strong>time_step</strong> (<em>int. Default is 5.</em>) – The time step size for each time of decoding.</p></li>
<li><p><strong>nfolds</strong> (<em>int. Default is 5.</em>) – The number of folds.
nfolds should be at least 2.</p></li>
<li><p><strong>nrepeats</strong> (<em>int. Default is 2.</em>) – The times for iteration.</p></li>
<li><p><strong>normalization</strong> (<em>boolean True</em><em> or </em><em>False. Default is False.</em>) – Normalize the data or not.</p></li>
<li><p><strong>pca</strong> (<em>boolean True</em><em> or </em><em>False. Default is True.</em>) – Apply principal component analysis (PCA).</p></li>
<li><p><strong>pca_components</strong> (<em>int</em><em> or </em><em>float. Default is 0.95.</em>) – Number of components for PCA to keep. If 0<pca_components<1, select the numbder of components such that the
amount of variance that needs to be explained is greater than the percentage specified by pca_components.</p></li>
<li><p><strong>smooth</strong> (<em>boolean True</em><em> or </em><em>False</em><em>, or </em><em>int. Default is True.</em>) – Smooth the decoding result or not.
If smooth = True, the default smoothing step is 5. If smooth = n (type of n: int), the smoothing step is n.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><strong>accuracies</strong> – The cross-temporal decoding accuracies.
The shape of accuracies is [n_subs, int((n_ts-time_win)/time_step)+1, int((n_ts-time_win)/time_step)+1].</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>array</p>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="neurora.decoding.tbyt_decoding_holdout">
<span class="sig-prename descclassname"><span class="pre">neurora.decoding.</span></span><span class="sig-name descname"><span class="pre">tbyt_decoding_holdout</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">data</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">labels</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">n</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">2</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">navg</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">5</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">time_opt</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'average'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">time_win</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">5</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">time_step</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">5</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">iter</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">10</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">test_size</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0.3</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">normalization</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">pca</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">pca_components</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0.95</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">smooth</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#neurora.decoding.tbyt_decoding_holdout" title="Permalink to this definition">¶</a></dt>
<dd><p>Conduct time-by-time decoding for EEG-like data (hold out)</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>data</strong> (<em>array</em>) – The neural data.
The shape of data must be [n_subs, n_trials, n_chls, n_ts]. n_subs, n_trials, n_chls and n_ts represent the
number of subjects, the number of trails, the number of channels and the number of time-points.</p></li>
<li><p><strong>labels</strong> (<em>array</em>) – The labels of each trial.
The shape of labels must be [n_subs, n_trials]. n_subs and n_trials represent the number of subjects and the
number of trials.</p></li>
<li><p><strong>n</strong> (<em>int. Default is 2.</em>) – The number of categories for classification.</p></li>
<li><p><strong>navg</strong> (<em>int. Default is 5.</em>) – The number of trials used to average.</p></li>
<li><p><strong>time_opt</strong> (<em>string "average"</em><em> or </em><em>"features". Default is "average".</em>) – Average the time-points or regard the time points as features for classification
If time_opt=”average”, the time-points in a certain time-window will be averaged.
If time_opt=”features”, the time-points in a certain time-window will be used as features for classification.</p></li>
<li><p><strong>time_win</strong> (<em>int. Default is 5.</em>) – Set a time-window for decoding for different time-points.
If time_win=5, that means each decoding process based on 5 time-points.</p></li>
<li><p><strong>time_step</strong> (<em>int. Default is 5.</em>) – The time step size for each time of decoding.</p></li>
<li><p><strong>iter</strong> (<em>int. Default is 10.</em>) – The times for iteration.</p></li>
<li><p><strong>test_size</strong> (<em>float. Default is 0.3.</em>) – The proportion of the test set.
test_size should be between 0.0 and 1.0.</p></li>
<li><p><strong>normalization</strong> (<em>boolean True</em><em> or </em><em>False. Default is False.</em>) – Normalize the data or not.</p></li>
<li><p><strong>pca</strong> (<em>boolean True</em><em> or </em><em>False. Default is True.</em>) – Apply principal component analysis (PCA).</p></li>
<li><p><strong>pca_components</strong> (<em>int</em><em> or </em><em>float. Default is 0.95.</em>) – Number of components for PCA to keep. If 0<pca_components<1, select the numbder of components such that the
amount of variance that needs to be explained is greater than the percentage specified by pca_components.</p></li>
<li><p><strong>smooth</strong> (<em>boolean True</em><em> or </em><em>False</em><em>, or </em><em>int. Default is True.</em>) – Smooth the decoding result or not.
If smooth = True, the default smoothing step is 5. If smooth = n (type of n: int), the smoothing step is n.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><strong>accuracies</strong> – The time-by-time decoding accuracies.
The shape of accuracies is [n_subs, int((n_ts-time_win)/time_step)+1].</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>array</p>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="neurora.decoding.tbyt_decoding_kfold">
<span class="sig-prename descclassname"><span class="pre">neurora.decoding.</span></span><span class="sig-name descname"><span class="pre">tbyt_decoding_kfold</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">data</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">labels</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">n</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">2</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">navg</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">5</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">time_opt</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'average'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">time_win</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">5</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">time_step</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">5</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">nfolds</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">5</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">nrepeats</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">2</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">normalization</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">pca</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">pca_components</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0.95</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">smooth</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#neurora.decoding.tbyt_decoding_kfold" title="Permalink to this definition">¶</a></dt>
<dd><p>Conduct time-by-time decoding for EEG-like data (cross validation)</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>data</strong> (<em>array</em>) – The neural data.
The shape of data must be [n_subs, n_trials, n_chls, n_ts]. n_subs, n_trials, n_chls and n_ts represent the
number of subjects, the number of trails, the number of channels and the number of time-points.</p></li>
<li><p><strong>labels</strong> (<em>array</em>) – The labels of each trial.
The shape of labels must be [n_subs, n_trials]. n_subs and n_trials represent the number of subjects and the
number of trials.</p></li>
<li><p><strong>n</strong> (<em>int. Default is 2.</em>) – The number of categories for classification.</p></li>
<li><p><strong>navg</strong> (<em>int. Default is 5.</em>) – The number of trials used to average.</p></li>
<li><p><strong>time_opt</strong> (<em>string "average"</em><em> or </em><em>"features". Default is "average".</em>) – Average the time-points or regard the time points as features for classification
If time_opt=”average”, the time-points in a certain time-window will be averaged.
If time_opt=”features”, the time-points in a certain time-window will be used as features for classification.</p></li>
<li><p><strong>time_win</strong> (<em>int. Default is 5.</em>) – Set a time-window for decoding for different time-points.
If time_win=5, that means each decoding process based on 5 time-points.</p></li>
<li><p><strong>time_step</strong> (<em>int. Default is 5.</em>) – The time step size for each time of decoding.</p></li>
<li><p><strong>nfolds</strong> (<em>int. Default is 5.</em>) – The number of folds.
k should be at least 2.</p></li>
<li><p><strong>nrepeats</strong> (<em>int. Default is 2.</em>) – The times for iteration.</p></li>
<li><p><strong>normalization</strong> (<em>boolean True</em><em> or </em><em>False. Default is False.</em>) – Normalize the data or not.</p></li>
<li><p><strong>pca</strong> (<em>boolean True</em><em> or </em><em>False. Default is True.</em>) – Apply principal component analysis (PCA).</p></li>
<li><p><strong>pca_components</strong> (<em>int</em><em> or </em><em>float. Default is 0.95.</em>) – Number of components for PCA to keep. If 0<pca_components<1, select the numbder of components such that the
amount of variance that needs to be explained is greater than the percentage specified by pca_components.</p></li>
<li><p><strong>smooth</strong> (<em>boolean True</em><em> or </em><em>False</em><em>, or </em><em>int. Default is True.</em>) – Smooth the decoding result or not.
If smooth = True, the default smoothing step is 5. If smooth = n (type of n: int), the smoothing step is n.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><strong>accuracies</strong> – The time-by-time decoding accuracies.
The shape of accuracies is [n_subs, int((n_ts-time_win)/time_step)+1].</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>array</p>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="neurora.decoding.unidirectional_transfer_decoding">
<span class="sig-prename descclassname"><span class="pre">neurora.decoding.</span></span><span class="sig-name descname"><span class="pre">unidirectional_transfer_decoding</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">data1</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">labels1</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data2</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">labels2</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">n</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">2</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">navg</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">5</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">time_opt</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'average'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">time_win</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">5</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">time_step</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">5</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">iter</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">10</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">normalization</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">pca</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">pca_components</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0.95</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">smooth</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#neurora.decoding.unidirectional_transfer_decoding" title="Permalink to this definition">¶</a></dt>
<dd><p>Conduct unidirectional transfer decoding for EEG-like data</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>data1</strong> (<em>array</em>) – The neural data under condition1.
The shape of data must be [n_subs, n_trials, n_chls, n_ts]. n_subs, n_trials, n_chls and n_ts represent the
number of subjects, the number of trails, the number of channels and the number of time-points.</p></li>
<li><p><strong>labels1</strong> (<em>array</em>) – The labels of each trial under condition1.
The shape of labels must be [n_subs, n_trials]. n_subs and n_trials represent the number of subjects and the
number of trials.</p></li>
<li><p><strong>data2</strong> (<em>array</em>) – The neural data under condition2.</p></li>
<li><p><strong>labels2</strong> (<em>array</em>) – The labels of each trial under condition2.</p></li>
<li><p><strong>n</strong> (<em>int. Default is 2.</em>) – The number of categories for classification.</p></li>
<li><p><strong>navg</strong> (<em>int. Default is 5.</em>) – The number of trials used to average.</p></li>
<li><p><strong>time_opt</strong> (<em>string "average"</em><em> or </em><em>"features". Default is "average".</em>) – Average the time-points or regard the time points as features for classification
If time_opt=”average”, the time-points in a certain time-window will be averaged.
If time_opt=”features”, the time-points in a certain time-window will be used as features for classification.</p></li>
<li><p><strong>time_win</strong> (<em>int. Default is 5.</em>) – Set a time-window for decoding for different time-points.
If time_win=5, that means each decoding process based on 5 time-points.</p></li>
<li><p><strong>time_step</strong> (<em>int. Default is 5.</em>) – The time step size for each time of decoding.</p></li>
<li><p><strong>iter</strong> (<em>int. Default is 10.</em>) – The times for iteration.</p></li>
<li><p><strong>normalization</strong> (<em>boolean True</em><em> or </em><em>False. Default is False.</em>) – Normalize the data or not.</p></li>
<li><p><strong>pca</strong> (<em>boolean True</em><em> or </em><em>False. Default is True.</em>) – Apply principal component analysis (PCA).</p></li>
<li><p><strong>pca_components</strong> (<em>int</em><em> or </em><em>float. Default is 0.95.</em>) – Number of components for PCA to keep. If 0<pca_components<1, select the numbder of components such that the
amount of variance that needs to be explained is greater than the percentage specified by pca_components.</p></li>
<li><p><strong>smooth</strong> (<em>boolean True</em><em> or </em><em>False</em><em>, or </em><em>int. Default is True.</em>) – Smooth the decoding result or not.
If smooth = True, the default smoothing step is 5. If smooth = n (type of n: int), the smoothing step is n.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><strong>accuracies</strong> – The unidirectional transfer decoding accuracies.
The shape of accuracies is [n_subs, int((n_ts1-time_win)/time_step)+1, int((n_ts2-time_win)/time_step)+1].</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>array</p>
</dd>
</dl>
</dd></dl>
</section>
</section>
<div class="clearer"></div>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<div>
<h3><a href="index.html">Table of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">Conduct Classification-based EEG Decoding</a><ul>
<li><a class="reference internal" href="#module-neurora.decoding">neurora.decoding module</a></li>
</ul>
</li>
</ul>
</div>
<div>
<h4>Previous topic</h4>
<p class="topless"><a href="ctrsa.html"
title="previous chapter">Cross-Temporal Representational Similarity Analysis (CTRSA)</a></p>
</div>
<div>
<h4>Next topic</h4>
<p class="topless"><a href="stats_cal.html"
title="next chapter">Statistical Analysis</a></p>
</div>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="sources/decoding.rst.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
<input type="submit" value="Go" />
</form>
</div>
</div>
<script>$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="stats_cal.html" title="Statistical Analysis"
>next</a> |</li>
<li class="right" >
<a href="ctrsa.html" title="Cross-Temporal Representational Similarity Analysis (CTRSA)"
>previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">NeuroRA 1.1.6.8 documentation</a> »</li>
<li class="nav-item nav-item-this"><a href="">Conduct Classification-based EEG Decoding</a></li>
</ul>
</div>
<div class="footer" role="contentinfo">
© Copyright 2021, Zitong Lu.
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 4.4.0.
</div>
</body>
</html>