'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
The epochs.
y : list or ndarray of int, shape (n_samples,) or None, optional
To-be-fitted model values. If None, y = epochs.events[:, 2].
Returns
self : GeneralizationAcrossTime
Returns fitted GeneralizationAcrossTime object.
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.'

def fit(self, epochs, y=None):

    from sklearn.base import clone
    for att in ['picks_', 'ch_names', 'y_train_', 'cv_', 'train_times_', 'estimators_', 'test_times_', 'y_pred_', 'y_true_', 'scores_', 'scorer_']:
        if hasattr(self, att):
            delattr(self, att)
    n_jobs = self.n_jobs
    (X, y, self.picks_) = _check_epochs_input(epochs, y, self.picks)
    self.ch_names = [epochs.ch_names[p] for p in self.picks_]
    (self.cv_, self._cv_splits) = _set_cv(self.cv, self.clf, X=X, y=y)
    self.y_train_ = y
    self.train_times_ = _sliding_window(epochs.times, self.train_times, epochs.info['sfreq'])
    (parallel, p_func, n_jobs) = parallel_func(_fit_slices, n_jobs)
    n_chunks = min(len(self.train_times_['slices']), n_jobs)
    time_chunks = np.array_split(self.train_times_['slices'], n_chunks)
    out = parallel((p_func(clone(self.clf), X[..., np.unique(np.concatenate(time_chunk))], y, time_chunk, self._cv_splits) for time_chunk in time_chunks))
    self.estimators_ = sum(out, list())
    return self
