Commit 0097a83b authored by Alessia Marcolini's avatar Alessia Marcolini
Browse files

Fix reading of MCC test file

parent 8d91e54b
......@@ -111,6 +111,9 @@ for k in range_combinations:
file_metrics = os.path.join(
PATH, f'{MODE}/{layers_concat}_tr_{MODEL}_rankList_allmetrics.txt'
)
file_MCC_test = os.path.join(
PATH, MODE, f'{layers_concat}_tr_MCC_scores.txt'
)
elif MODE == 'rSNFi':
file_log = os.path.join(
......@@ -119,6 +122,9 @@ for k in range_combinations:
file_metrics = os.path.join(
PATH, f'{MODE}/{layers_concat}_ts_{MODEL}_KBest_allmetrics.txt'
)
file_MCC_test = os.path.join(
PATH, MODE, f'{layers_concat}_ts_MCC_scores.txt'
)
else:
file_log = os.path.join(
PATH, f'{MODE}/{layers_concat}_tr_{MODEL}_KBest.log'
......@@ -126,6 +132,9 @@ for k in range_combinations:
file_metrics = os.path.join(
PATH, f'{MODE}/{layers_concat}_tr_{MODEL}_KBest_allmetrics.txt'
)
file_MCC_test = os.path.join(
PATH, MODE, f'{layers_concat}_tr_MCC_scores.txt'
)
with open(file_log) as f:
log_content = f.readlines()
......@@ -141,9 +150,12 @@ for k in range_combinations:
best_feat = int(best_feat_line.split(' = ')[1][:-1])
best_feat_steps.append(best_feat)
mcc_test = float(mcc_test_line.split(' = ')[1][:-1])
with open(file_MCC_test, 'r') as f:
mcc_test = float(f.readlines()[1].split('\t')[1])
print(mcc_test)
all_test_mccs.append(mcc_test)
# %%
all_metrics = pd.read_csv(file_metrics, sep='\t')
best_idxs = np.where(all_metrics["nf"] == best_feat)[0]
......
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