diff --git a/model_selection/fixing_fp_fn/fixing_metrics.py b/model_selection/fixing_fp_fn/fixing_metrics.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/model_selection/fixing_fp_fn/fixing_test_results.py b/model_selection/fixing_fp_fn/fixing_test_results.py new file mode 100644 index 0000000000000000000000000000000000000000..edf945cdb6683bcf42e93adf58c102eace37a933 --- /dev/null +++ b/model_selection/fixing_fp_fn/fixing_test_results.py @@ -0,0 +1,30 @@ +import pandas as pd + +def swap_fp_fn(excel_path, output_path): + # Load the Excel file + excel_data = pd.ExcelFile(excel_path) + + # Create a Pandas ExcelWriter using openpyxl engine + with pd.ExcelWriter(output_path, engine='openpyxl') as writer: + # Iterate through each sheet in the Excel file + for sheet_name in excel_data.sheet_names: + # Read the sheet into a DataFrame + df = excel_data.parse(sheet_name) + + # Check if the columns 'FP' and 'FN' exist in the DataFrame + if 'FP' in df.columns and 'FN' in df.columns: + # Swap the 'FP' and 'FN' columns + df['FP'], df['FN'] = df['FN'].copy(), df['FP'].copy() + + # Save the modified DataFrame back to the sheet in the new Excel file + df.to_excel(writer, sheet_name=sheet_name, index=False) + + print(f"Swapped FP and FN columns in '{excel_path}' and saved to '{output_path}'.") + +# Path to your existing Excel file +input_excel_path = '../output_test/testing_tuned_models.xlsx' +# Path where the modified Excel file will be saved (can be the same as input_excel_path) +output_excel_path = '../output_test/testing_tuned_models_fixed.xlsx' + +# Call the function with the file paths +swap_fp_fn(input_excel_path, output_excel_path) \ No newline at end of file diff --git a/model_selection/output_test/testing_tuned_models_fixed.xlsx b/model_selection/output_test/testing_tuned_models_fixed.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..46c96062a2705baea44661564baa3672635bfd78 Binary files /dev/null and b/model_selection/output_test/testing_tuned_models_fixed.xlsx differ