def train_encoder(X, y, fold_count, encoder):
kf = StratifiedKFold(n_splits=fold_count, shuffle=True, random_state=<NUM_LIT>)<EOL>encoder = deepcopy(encoder)  <EOL>imputer = SimpleImputer(strategy='<STR_LIT>')<EOL>scaler = StandardScaler()<EOL>folds = []<EOL>fit_encoder_time = <NUM_LIT:0><EOL>score_encoder_time = <NUM_LIT:0><EOL>for train_index, test_index in kf.split(X, y):<EOL><INDENT>X_train, X_test = X.iloc[train_index, :].reset_index(drop=True), X.iloc[test_index, :].reset_index(drop=True)<EOL>y_train, y_test = y[train_index].reset_index(drop=True), y[test_index].reset_index(drop=True)<EOL>start_time = time.time()<EOL>X_train = encoder.fit_transform(X_train, y_train)<EOL>fit_encoder_time += time.time() - start_time<EOL>X_train = imputer.fit_transform(X_train)<EOL>X_train = scaler.fit_transform(X_train)<EOL>start_time = time.time()<EOL>X_test = encoder.transform(X_test)<EOL>score_encoder_time += time.time() - start_time<EOL>X_test = imputer.transform(X_test)<EOL>X_test = scaler.transform(X_test)<EOL>folds.append([X_train, y_train, X_test, y_test])<EOL><DEDENT>return folds, fit_encoder_time/fold_count, score_encoder_time/fold_count<EOL>
Defines folds and performs the data preprocessing (categorical encoding, NaN imputation, normalization)
Returns a list with {X_train, y_train, X_test, y_test}, average fit_encoder_time and average score_encoder_time

Note: We normalize all features (not only numerical features) because otherwise SVM would
    get stuck for hours on ordinal encoded cylinder.bands.arff dataset due to presence of
    unproportionally high values.

Note: The fold count is variable because there are datasets, which have less than 10 samples in the minority class.

Note: We do not use pipelines because of:
    https://github.com/scikit-learn/scikit-learn/issues/11832