Commit c04dcc50 authored by Joaquin Torres's avatar Joaquin Torres

checking results for DT

parent 7847bcd0
...@@ -219,8 +219,8 @@ if __name__ == "__main__": ...@@ -219,8 +219,8 @@ if __name__ == "__main__":
'FN':FN_scorer, 'FN':FN_scorer,
'FP':FP_scorer, 'FP':FP_scorer,
'TP':TP_scorer, 'TP':TP_scorer,
'AUROC': make_scorer(roc_auc_score, needs_threshold=True), # AUROC requires decision function or probability outputs 'AUROC': make_scorer(roc_auc_score), # AUROC requires decision function or probability outputs
'AUPRC': make_scorer(average_precision_score, needs_proba=True) # AUPRC requires probability outputs 'AUPRC': make_scorer(average_precision_score) # AUPRC requires probability outputs
} }
method_names = { method_names = {
0: "ORIG", 0: "ORIG",
...@@ -235,9 +235,10 @@ if __name__ == "__main__": ...@@ -235,9 +235,10 @@ if __name__ == "__main__":
scores_sheets = {} # To store score dfs as sheets in the same excel file scores_sheets = {} # To store score dfs as sheets in the same excel file
for i, group in enumerate(['pre', 'post']): for i, group in enumerate(['pre', 'post']):
# Get test dataset based on group # Get test dataset based on group
X_test = data_dic['X_test' + group] X_test = data_dic['X_test_' + group]
y_test = data_dic['y_test' + group] y_test = data_dic['y_test_' + group]
for j, method in enumerate(['', '', 'over_', 'under_']): for j, method in enumerate(['', '', 'over_', 'under_']):
print(f"{group}-{method}")
# Get train dataset based on group and method # Get train dataset based on group and method
X_train = data_dic['X_train_' + method + group] X_train = data_dic['X_train_' + method + group]
y_train = data_dic['y_train_' + method + group] y_train = data_dic['y_train_' + method + group]
...@@ -259,7 +260,7 @@ if __name__ == "__main__": ...@@ -259,7 +260,7 @@ if __name__ == "__main__":
sheet_name = f"{group}_{method_names[j]}" sheet_name = f"{group}_{method_names[j]}"
scores_sheets[sheet_name] = scores_df scores_sheets[sheet_name] = scores_df
# Write results to Excel file # Write results to Excel file
with pd.ExcelWriter('./model_selection/test_results/testing_tuned_models.xlsx') as writer: with pd.ExcelWriter('./test_results/testing_tuned_models.xlsx') as writer:
for sheet_name, data in scores_sheets.items(): for sheet_name, data in scores_sheets.items():
data.to_excel(writer, sheet_name=sheet_name) data.to_excel(writer, sheet_name=sheet_name)
# -------------------------------------------------------------------------------------------------------- # --------------------------------------------------------------------------------------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment