| Input: Preprocessed_train, Preprocessed_test, Train_label, Test_label |
Output: Encoded_train, Encoded_test, Train_label, Test_label |
Load processed data Preprocessed_train, Preprocessed_test |
While not reach terminating condition: n-layer autoencoder training (n = 1, 2, 3, 4) |
for Epoch in range (1, 100): |
/ complete filepath stitching / |
os.path.join() |
/ Save the model results after each epoch to filepath / |
AE_n_point = ModelCheckpoint (filepath, monitor = “val_loss”, verbose = 1, save_best_only = True, mode = “min”) |
/ Save the best model to prevent overfitting / |
AE_n_stops = EarlyStopping (monitor = “val_loss”, patience = 10, mode = “min”) |
break |
AutoEncoder_n.load_weights() |
Output the prediction result of this layer: layer_n_output, test_n_out |
End While |
Encoded_train = SAE_encoder.predict (train) |
Encoded_test = SAE_encoder.predict (test) |
/ save SAE final result / |
np.save (Encoded_train, Encoded_test, Train_label, Test_label) |
End |