@running_timer
def train_model(epochs=10, batch_size=32, training_verbose=1, print_model_summary=False, using_validation=False, validation_split=0.2, plot_history_data=False, history_fig_name='default', plot_model_arch=False, plot_model_name='default', save_model=False, save_model_name='default'):
    num_of_faulty_type = 3
    (train_x, train_y, test_x, test_y) = load_processed_dataset('2020-03-17 15:55:22_czE4OmZzNDphczE2OmZlczI=_processed_logs', num_of_faulty_type, location='../../dataset')
    (n_timesteps, n_features) = (train_x.shape[1], train_x.shape[2])
    model = build_fdconv1d_lstm((n_timesteps, n_features), num_of_faulty_type, kernel_size=31)
    if print_model_summary:
        model.summary()
    if plot_model_arch:
        plot_model(model, to_file=plot_model_name, show_shapes=True)
    if plot_history_data:
        history = model.fit(x=[train_x, train_x], y=train_y, epochs=epochs, batch_size=batch_size, verbose=training_verbose, validation_split=validation_split)
        plot_training_history(history, 'fdconv1d-lstm', history_fig_name, '../exper_imgs')
    elif using_validation:
        es = EarlyStopping('val_categorical_accuracy', 0.0001, 3, 1, 'max')
        history = model.fit(x=[train_x, train_x], y=train_y, epochs=epochs, batch_size=batch_size, verbose=training_verbose, validation_split=validation_split, callbacks=[es])
        plot_training_history(history, 'fdconv1d-lstm', history_fig_name, '../exper_imgs')
    else:
        model.fit(x=[train_x, train_x], y=train_y, epochs=epochs, batch_size=batch_size, verbose=training_verbose)
    (_, accuracy) = model.evaluate(x=[test_x, test_x], y=test_y, batch_size=batch_size, verbose=0)
    if save_model:
        model.save(save_model_name)
        print('>>> model saved: {}'.format(save_model_name))
    print('\n>>> Accuracy on testing given testing dataset: {}'.format((accuracy * 100)))
@running_timer
def train_model(epochs=10, batch_size=32, training_verbose=1, print_model_summary=False, using_validation=False, validation_split=0.2, plot_history_data=False, history_fig_name='default', plot_model_arch=False, plot_model_name='default', save_model=False, save_model_name='default'):
    num_of_faulty_type = 3
    (train_x, train_y, test_x, test_y) = load_processed_dataset('2020-03-17 15:55:22_czE4OmZzNDphczE2OmZlczI=_processed_logs', num_of_faulty_type, location='../../dataset')
    (n_timesteps, n_features) = (train_x.shape[1], train_x.shape[2])
    model = build_fdconv1d_lstm((n_timesteps, n_features), num_of_faulty_type, kernel_size=31)
    if print_model_summary:
        model.summary()
    if plot_model_arch:
        plot_model(model, to_file=plot_model_name, show_shapes=True)
    if plot_history_data:
        history = model.fit(x=[train_x, train_x], y=train_y, epochs=epochs, batch_size=batch_size, verbose=training_verbose, validation_split=validation_split)
        plot_training_history(history, 'fdconv1d-lstm', history_fig_name, '../exper_imgs')
    elif using_validation:
        es = EarlyStopping('val_categorical_accuracy', 0.0001, 3, 1, 'max')
        history = model.fit(x=[train_x, train_x], y=train_y, epochs=epochs, batch_size=batch_size, verbose=training_verbose, validation_split=validation_split, callbacks=[es])
        plot_training_history(history, 'fdconv1d-lstm', history_fig_name, '../exper_imgs')
    else:
        model.fit(x=[train_x, train_x], y=train_y, epochs=epochs, batch_size=batch_size, verbose=training_verbose)
    (_, accuracy) = model.evaluate(x=[test_x, test_x], y=test_y, batch_size=batch_size, verbose=0)
    if save_model:
        model.save(save_model_name)
        print('>>> model saved: {}'.format(save_model_name))
    print('\n>>> Accuracy on testing given testing dataset: {}'.format((accuracy * 100)))