def _fit_slices(clf, x_chunk, y, slices, cv_splits):
 from sklearn.base import clone
 n_epochs = len(x_chunk)
 estimators = list()
 values = np.unique([val for sl in slices for val in sl])
 for t_slice in slices:
  t_slice = np.array([np.where((ii == values))[0][0] for ii in t_slice])
  X = x_chunk[..., t_slice]
  X = X.reshape(n_epochs, np.prod(X.shape[1:]))
  estimators_ = list()
  for (fold, (train, test)) in enumerate(cv_splits):
   clf_ = clone(clf)
   clf_.fit(X[train, :], y[train])
   estimators_.append(clf_)
  estimators.append(estimators_)
 return estimators

def _fit_slices ( clf , x_chunk , y , slices , cv_splits ) : from sklearn . base import clone n_epochs = len ( x_chunk ) estimators = list ( ) values = np . unique ( [ val for sl in slices for val in sl ] ) for t_slice in slices : t_slice = np . array ( [ np . where ( ( ii == values ) ) [ 0 ] [ 0 ] for ii in t_slice ] ) X = x_chunk [ ... , t_slice ] X = X . reshape ( n_epochs , np . prod ( X . shape [ 1 : ] ) ) estimators_ = list ( ) for ( fold , ( train , test ) ) in enumerate ( cv_splits ) : clf_ = clone ( clf ) clf_ . fit ( X [ train , : ] , y [ train ] ) estimators_ . append ( clf_ ) estimators . append ( estimators_ ) return estimators
aux function of generalizationacrosstime .