Commit ebb3d4b1 authored by Alessia Marcolini's avatar Alessia Marcolini
Browse files

Compute best metrics given DAP result metrics

parent 9794d893
#%%
from IPython import get_ipython
get_ipython().run_line_magic('HN_env', '')
#%%
import os
PATH = os.path.abspath(os.path.curdir)
#%%
import numpy as np
import pandas as pd
#%%
EXPERIMENT_NAME = 'predictions'
DAP_EXPERIMENT_NAME = 'kfold_radiomics_features_CT_F_SVC_Locoregional_DAPSVMClassifier'
#%%
all_train = pd.read_csv(f'{PATH}/{EXPERIMENT_NAME}/{DAP_EXPERIMENT_NAME}/CI_All_train.csv')
all_train.rename({'Unnamed: 0': 'metric'}, axis=1, inplace=True)
best_metrics_train = pd.DataFrame()
# %%
metrics = ['ACC', 'AUC', 'DOR', 'MCC', 'NPV', 'PPV', 'SENS', 'SPEC']
# %%
for metric in metrics:
tmp_metric_df = all_train.loc[all_train['metric'].str.startswith(metric)]
max_tmp_metric_df = tmp_metric_df.iloc[np.where(tmp_metric_df['Mean'].max() == tmp_metric_df)[0][0]]
best_metrics_train = best_metrics_train.append(max_tmp_metric_df, ignore_index=True)
# %%
best_metrics_train.to_csv(f'{PATH}/{EXPERIMENT_NAME}/{DAP_EXPERIMENT_NAME}/CI_All_train_best_metrics.csv', index=False)
# %%
Supports Markdown
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