Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
C
covid_analysis
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
COMPARA
covid_analysis
Commits
d2b4d7a6
Commit
d2b4d7a6
authored
Jun 05, 2024
by
Joaquin Torres
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed test results
parent
e6fc4387
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
0 deletions
+30
-0
model_selection/fixing_fp_fn/fixing_metrics.py
model_selection/fixing_fp_fn/fixing_metrics.py
+0
-0
model_selection/fixing_fp_fn/fixing_test_results.py
model_selection/fixing_fp_fn/fixing_test_results.py
+30
-0
model_selection/output_test/testing_tuned_models_fixed.xlsx
model_selection/output_test/testing_tuned_models_fixed.xlsx
+0
-0
No files found.
model_selection/fixing_fp_fn/fixing_metrics.py
0 → 100644
View file @
d2b4d7a6
model_selection/fixing_fp_fn/fixing_test_results.py
0 → 100644
View file @
d2b4d7a6
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
model_selection/output_test/testing_tuned_models_fixed.xlsx
0 → 100644
View file @
d2b4d7a6
File added
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment