mne.decoding.
TimeDecoding
(picks=None, cv=5, clf=None, times=None, predict_method=’predict’, predict_mode=’crossvalidation’, scorer=None, score_mode=’meanfoldwise’, n_jobs=1)[source]¶Train and test a series of classifiers at each time point.
This will result in a score across time.
Parameters:  picks : arraylike of int  None
cv : int  object
clf : object  None
times : dict  None
predict_method : str
predict_mode : {‘crossvalidation’, ‘meanprediction’}
scorer : object  None  str
score_mode : {‘foldwise’, ‘meanfoldwise’, ‘meansamplewise’}
n_jobs : int


See also
Notes
The function is equivalent to the diagonal of GeneralizationAcrossTime()
New in version 0.10.
Attributes
picks_ 
(arraylike of int  None) The channels indices to include. 
ch_names  (list, arraylike, shape (n_channels,)) Names of the channels used for training. 
y_train_ 
(ndarray, shape (n_samples,)) The categories used for training. 
times_ 
(dict) A dictionary that configures the training times: * slices : ndarray, shape (n_clfs,) Array of time slices (in indices) used for each classifier. If not given, computed from ‘start’, ‘stop’, ‘length’, ‘step’. * times : ndarray, shape (n_clfs,) The training times (in seconds). 
cv_ 
(CrossValidation object) The actual CrossValidation input depending on y. 
estimators_ 
(list of list of scikitlearn.base.BaseEstimator subclasses.) The estimators for each time point and each fold. 
y_pred_ 
(ndarray, shape (n_times, n_epochs, n_prediction_dims)) Class labels for samples in X. 
y_true_ 
(list  ndarray, shape (n_samples,)) The categories used for scoring y_pred_ . 
scorer_ 
(object) scikitlearn Scorer instance. 
scores_ 
(list of float, shape (n_times,)) The scores (mean accuracy of self.predict(X) wrt. y.). 
Methods
__hash__ () <==> hash(x) 

fit (epochs[, y]) 
Train a classifier on each specified time slice. 
plot ([title, xmin, xmax, ymin, ymax, ax, …]) 
Plot the decoding results. 
predict (epochs) 
Test each classifier on each specified testing time slice. 
score ([epochs, y]) 
Score Epochs. 
__hash__
() <==> hash(x)¶fit
(epochs, y=None)[source]¶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 Cordered 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’)[source]¶Plot the decoding results.
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)[source]¶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)[source]¶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.
Note
If predict_mode
is ‘meanprediction’, score_mode
is
automatically set to ‘meansamplewise’.
Parameters:  epochs : instance of Epochs  None, optional
y : list  ndarray, shape (n_epochs,)  None, optional


Returns:  scores : list of float, shape (n_times,)
