def _gl_transform(estimators, X, method):
 (n_sample, n_iter) = (X.shape[0], X.shape[(-1)])
 for (ii, est) in enumerate(estimators):
  X_stack = X.transpose(np.r_[(0, (X.ndim - 1), range(1, (X.ndim - 1)))])
  X_stack = X_stack.reshape(np.r_[((n_sample * n_iter), X_stack.shape[2:])])
  transform = getattr(est, method)
  _y_pred = transform(X_stack)
  if (_y_pred.ndim == 2):
   _y_pred = np.reshape(_y_pred, [n_sample, n_iter, _y_pred.shape[1]])
  else:
   shape = np.r_[(n_sample, n_iter, _y_pred.shape[1:])].astype(int)
   _y_pred = np.reshape(_y_pred, shape)
  if (ii == 0):
   y_pred = _gl_init_pred(_y_pred, X, len(estimators))
  y_pred[:, ii, ...] = _y_pred
 return y_pred

def _gl_transform ( estimators , X , method ) : ( n_sample , n_iter ) = ( X . shape [ 0 ] , X . shape [ ( - 1 ) ] ) for ( ii , est ) in enumerate ( estimators ) : X_stack = X . transpose ( np . r_ [ ( 0 , ( X . ndim - 1 ) , range ( 1 , ( X . ndim - 1 ) ) ) ] ) X_stack = X_stack . reshape ( np . r_ [ ( ( n_sample * n_iter ) , X_stack . shape [ 2 : ] ) ] ) transform = getattr ( est , method ) _y_pred = transform ( X_stack ) if ( _y_pred . ndim == 2 ) : _y_pred = np . reshape ( _y_pred , [ n_sample , n_iter , _y_pred . shape [ 1 ] ] ) else : shape = np . r_ [ ( n_sample , n_iter , _y_pred . shape [ 1 : ] ) ] . astype ( int ) _y_pred = np . reshape ( _y_pred , shape ) if ( ii == 0 ) : y_pred = _gl_init_pred ( _y_pred , X , len ( estimators ) ) y_pred [ : , ii , ... ] = _y_pred return y_pred
transform the dataset .