'Get predictions of classifiers on each specified testing time slice.
.. note::
This function sets the ``y_pred_`` and ``test_times_`` attributes.
Parameters
epochs : instance of Epochs
The epochs. Can be similar to fitted epochs or not. See
predict_mode parameter.
Returns
y_pred : list of lists of arrays of floats, shape (n_train_t, n_test_t, n_epochs, n_prediction_dims)
The single-trial predictions at each training time and each testing
time. Note that the number of testing times per training time need
not be regular; else
``np.shape(y_pred_) = (n_train_time, n_test_time, n_epochs)``.'

def predict(self, epochs):

    if (not hasattr(self.clf, self.predict_method)):
        raise NotImplementedError(('%s    does    not    have    "%s"' % (self.clf, self.predict_method)))
    if (not hasattr(self, 'estimators_')):
        raise RuntimeError('Please    fit    models    before    trying    to    predict')
    if (self.predict_mode not in ['cross-validation', 'mean-prediction']):
        raise ValueError('predict_mode    must    be    a    str,    "mean-prediction"    or    "cross-validation"')
    if (self.predict_mode == 'cross-validation'):
        n_est_cv = [len(estimator) for estimator in self.estimators_]
        heterogeneous_cv = (len(set(n_est_cv)) != 1)
        mismatch_cv = (n_est_cv[0] != len(self._cv_splits))
        mismatch_y = (len(self.y_train_) != len(epochs))
        if (heterogeneous_cv or mismatch_cv or mismatch_y):
            raise ValueError('When    predict_mode    =    "cross-validation",    the    training    and    predicting    cv    schemes    must    be    identical.')
        test_idx = [ii for (_, test) in self._cv_splits for ii in test]
        if sum([(sum((np.array(test_idx) == idx)) > 1) for idx in test_idx]):
            raise ValueError('cv    must    be    a    partition    if    predict_mode    is    "cross-validation".')
    for att in ['y_pred_', 'test_times_', 'scores_', 'scorer_', 'y_true_']:
        if hasattr(self, att):
            delattr(self, att)
    _warn_once.clear()
    (X, y, _) = _check_epochs_input(epochs, None, self.picks_)
    if (not np.all([len(test) for (train, test) in self._cv_splits])):
        warn('Some    folds    do    not    have    any    test    epochs.')
    if (self.test_times == 'diagonal'):
        test_times = _DecodingTime()
        test_times['slices'] = [[s] for s in self.train_times_['slices']]
        test_times['times'] = [[s] for s in self.train_times_['times']]
    elif isinstance(self.test_times, dict):
        test_times = copy.deepcopy(self.test_times)
    else:
        raise ValueError('test_times    must    be    a    dict    or    "diagonal"')
    if ('slices' not in test_times):
        if ('length' not in self.train_times_.keys()):
            ValueError('Need    test_times["slices"]    with    adhoc    train_times.')
        test_times['length'] = test_times.get('length', self.train_times_['length'])
        slices_list = list()
        for _ in range(len(self.train_times_['slices'])):
            test_times_ = _sliding_window(epochs.times, test_times, epochs.info['sfreq'])
            slices_list += [test_times_['slices']]
        test_times = test_times_
        test_times['slices'] = slices_list
    test_times['times'] = [_set_window_time(test, epochs.times) for test in test_times['slices']]
    for (train, tests) in zip(self.train_times_['slices'], test_times['slices']):
        if (not np.all([(len(test) == len(train)) for test in tests])):
            raise ValueError('train_times    and    test_times    must    have    identical    lengths')
    self.test_times_ = test_times
    (n_orig_epochs, _, n_times) = X.shape
    test_epochs = []
    if (self.predict_mode == 'cross-validation'):
        test_idxs = [ii for (train, test) in self._cv_splits for ii in test]
        start = 0
        for (_, test) in self._cv_splits:
            n_test_epochs = len(test)
            stop = (start + n_test_epochs)
            test_epochs.append(slice(start, stop, 1))
            start += n_test_epochs
        X = X[test_idxs]
    (parallel, p_func, n_jobs) = parallel_func(_predict_slices, self.n_jobs)
    n_test_slice = max((len(sl) for sl in self.test_times_['slices']))
    n_chunks = min(n_test_slice, n_jobs)
    chunks = [np.array_split(slices, n_chunks) for slices in self.test_times_['slices']]
    chunks = map(list, zip(*chunks))
    y_pred = parallel((p_func(estimators=self.estimators_, cv_splits=self._cv_splits, predict_mode=self.predict_mode, predict_method=self.predict_method, n_orig_epochs=n_orig_epochs, test_epochs=test_epochs, **dict(zip(['X', 'train_times'], _chunk_data(X, chunk)))) for chunk in chunks))
    n_tests = [len(sl) for sl in self.test_times_['slices']]
    if (len(set(n_tests)) == 1):
        self.y_pred_ = np.concatenate(y_pred, axis=1)
    else:
        self.y_pred_ = [[test for chunk in train for test in chunk] for train in map(list, zip(*y_pred))]
    return self.y_pred_
