""" Generates a tex file containing the Latex table setup with all the relevant results. """ import input_data as data import rene.analyse_results as rene_ar import rouen.analyse_results as rouen_ar import sherbrooke.analyse_results as sherb_ar import stmarc.analyse_results as stmarc_ar global_result_path_name = 'global_result/experimental_results_2.tex' data.make_dir_if_new(global_result_path_name) # Global result with open(global_result_path_name, 'w') as global_result_file: global_result_file.write(r'\documentclass{article}' + '\n\n') global_result_file.write(r'\usepackage{multirow}' + '\n') global_result_file.write(r'\begin{document}' + '\n\n') global_result_file.write(r'\begin{table}' + '\n') global_result_file.write(r'\centering' + '\n') global_result_file.write(r'\caption{Results obtained by applying the trained model on the corresponding samples.}' \ r'\label{tab2}' + '\n') global_result_file.write(r'\begin{tabular}{c|c|c|c||c|c|c|c|c|c|c|c}' + '\n') global_result_file.write( r'\multicolumn{4}{c}{} & \multicolumn{8}{c}{Method (\%)} \\ \cline{5-12}' + '\n') global_result_file.write(r'\multicolumn{4}{c}{} & \multicolumn{2}{|c|}{OC-SVM} & \multicolumn{2}{c|}{IF} & ' \
# Generate abnormal data abnormal_data = adg.generate_abnormal_data(n_objects=20, generate_graph=False, show_graph=False) abnormal_data = abnormal_data[:, 1:] # Files setup test_score_filename = 'results/one_class_svm/test_scores.csv' summary_results_filename = test_score_filename[:test_score_filename.rfind( '/')] + '/summary_results.csv' global_summary_filename = test_score_filename[:test_score_filename.rfind( '/')] + '/global_summary.log' model_files_dir_name = 'model/one_class_svm/' data.make_dir_if_new(test_score_filename) data.make_dir_if_new(model_files_dir_name) normal_train_ratio_list = [] normal_valid_ratio_list = [] abnormal_ratio_list = [] for i in range(aeu.repeat_number): print('======================== Iteration {} ========================'. format(i)) # Shuffle the data by row only # and get the seed in order to reproduce the random sequence train_data, validation_data, random_shuffle_seed = data.split_dataset_uniformly( dataset) # The trained model will be saved
abnormal_data_2 = np.genfromtxt(abnormal_file_path_2, delimiter=',') input_size_2 = len(normal_data_2[0, 1:]) best_layer_type_2 = (256, 128, 64, 32, 16, 8) # Files containing info of the model and threshold value model_name_2 = 'new_method_v4_5_3' trained_model_path_2 = 'model/' + model_name_2 + '/' result_path_2 = 'results/' + model_name_2 + '/' global_result_name = 'ablation_study' result_path = 'results/' + global_result_name + '/' global_summary_filename = result_path + 'global_ablation_study_2.csv' data.make_dir_if_new(global_summary_filename) with open(os.path.join(dir_name, global_summary_filename), 'wb') as summary_file: summary_file.write(b'threshold,best_ADA_1,best_NDA_1,best_ae_ADA_1,best_ae_NDA_1,' b'best_ADA_2,best_NDA_2,best_ae_ADA_2,best_ae_NDA_2\n') best_ADA_list_1 = [] best_NDA_list_1 = [] best_ae_ADA_list_1 = [] best_ae_NDA_list_1 = [] best_ADA_list_2 = [] best_NDA_list_2 = [] best_ae_ADA_list_2 = [] best_ae_NDA_list_2 = []