MCPcopy
hub / github.com/mne-tools/mne-python / fit

Method fit

mne/decoding/xdawn.py:171–194  ·  view source on GitHub ↗

Fit Xdawn spatial filters. Parameters ---------- X : array, shape (n_epochs, n_channels, n_samples) The target data. y : array, shape (n_epochs,) | None The target labels. If None, Xdawn fit on the average evoked. Returns ----

(self, X, y=None)

Source from the content-addressed store, hash-verified

169 _validate_type(self.info, (Info, None), "info")
170
171 def fit(self, X, y=None):
172 """Fit Xdawn spatial filters.
173
174 Parameters
175 ----------
176 X : array, shape (n_epochs, n_channels, n_samples)
177 The target data.
178 y : array, shape (n_epochs,) | None
179 The target labels. If None, Xdawn fit on the average evoked.
180
181 Returns
182 -------
183 self : Xdawn instance
184 The Xdawn instance.
185 """
186 X, y = self._check_data(X, y=y, fit=True, return_y=True)
187 # For test purposes
188 if y is None:
189 y = np.ones(len(X))
190 self._validate_params(X)
191
192 super().fit(X, y)
193
194 return self
195
196 def transform(self, X):
197 """Transform data with spatial filters.

Callers 3

test_XdawnTransformerFunction · 0.95
test_xdawn_save_loadFunction · 0.95

Calls 2

_validate_paramsMethod · 0.95
_check_dataMethod · 0.45

Tested by 3

test_XdawnTransformerFunction · 0.76
test_xdawn_save_loadFunction · 0.76