mne.decoding.
TimeDecoding
(picks=None, cv=5, clf=None, times=None, predict_mode='cross-validation', scorer=None, n_jobs=1)¶Train and test a series of classifiers at each time point to obtain a score across time.
Parameters: | picks : array-like of int | None
cv : int | object
clf : object | None
times : dict | None
predict_mode : {‘cross-validation’, ‘mean-prediction’}
scorer : object | None
n_jobs : int
|
---|---|
Attributes: | picks_ : array-like of int | None
ch_names : list, array-like, shape (n_channels,)
y_train_ : ndarray, shape (n_samples,)
times_ : dict
cv_ : CrossValidation object
estimators_ : list of list of scikit-learn.base.BaseEstimator subclasses.
y_pred_ : ndarray, shape (n_times, n_epochs, n_prediction_dims)
y_true_ : list | ndarray, shape (n_samples,)
scorer_ : object
scores_ : list of float, shape (n_times,)
|
See also
Notes
The function is equivalent to the diagonal of GeneralizationAcrossTime()
New in version 0.10.
Methods
fit (epochs[, y]) |
Train a classifier on each specified time slice. |
plot ([title, xmin, xmax, ymin, ymax, ax, ...]) |
Plotting function |
predict (epochs) |
Test each classifier on each specified testing time slice. |
score ([epochs, y]) |
Score Epochs |
__init__
(picks=None, cv=5, clf=None, times=None, predict_mode='cross-validation', scorer=None, n_jobs=1)¶fit
(epochs, y=None)¶Train a classifier on each specified time slice.
Note. This function sets the picks_
, ch_names
, cv_
,
y_train
, train_times_
and estimators_
attributes.
Parameters: | epochs : instance of Epochs
y : list or ndarray of int, shape (n_samples,) or None, optional
|
---|---|
Returns: | self : TimeDecoding
|
Notes
If X and y are not C-ordered and contiguous arrays of np.float64 and X is not a scipy.sparse.csr_matrix, X and/or y may be copied.
If X is a dense array, then the other methods will not support sparse matrices as input.
plot
(title=None, xmin=None, xmax=None, ymin=None, ymax=None, ax=None, show=True, color=None, xlabel=True, ylabel=True, legend=True, chance=True, label='Classif. score')¶Plotting function
Predict each classifier. If multiple classifiers are passed, average prediction across all classifiers to result in a single prediction per classifier.
Parameters: | title : str | None
xmin : float | None, optional,
xmax : float | None, optional,
ymin : float
ymax : float
ax : object | None
show : bool
color : str
xlabel : bool
ylabel : bool
legend : bool
chance : bool | float. Defaults to None
label : str
|
---|---|
Returns: | fig : instance of matplotlib.figure.Figure
|
predict
(epochs)¶Test each classifier on each specified testing time slice.
Note
This function sets the y_pred_
and test_times_
attributes.
Parameters: | epochs : instance of Epochs
|
---|---|
Returns: | y_pred : list of lists of arrays of floats, shape (n_times, n_epochs, n_prediction_dims)
|
score
(epochs=None, y=None)¶Score Epochs
Estimate scores across trials by comparing the prediction estimated for each trial to its true value.
Calls predict()
if it has not been already.
Note. The function updates the scorer_
, scores_
, and
y_true_
attributes.
Parameters: | epochs : instance of Epochs | None, optional
y : list | ndarray, shape (n_epochs,) | None, optional
|
---|---|
Returns: | scores : list of float, shape (n_times,)
|