-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathdraft.py
More file actions
27 lines (23 loc) · 971 Bytes
/
Copy pathdraft.py
File metadata and controls
27 lines (23 loc) · 971 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import csv
import pandas as pd
import glob
import subprocess
import os
import torchmetrics
import pandas as pd
import torch
if __name__ == '__main__':
# tot = pd.read_csv('/home/xhc/MRAN/example_total.csv')
# path_li = glob.glob('/home/xhc/data/TCGA-LUSC/*/*.svs')
# name_to_path = {i.split('/')[-1]: i for i in path_li}
# bp = 1
# for svs_i in list(tot.iloc[:, 0]):
# os.makedirs(f'/home/xhc/MRAN/WSI/{svs_i}', exist_ok=True)
# subprocess.call(f'ln {name_to_path[svs_i]} /home/xhc/MRAN/WSI/{svs_i}', shell=True)
# tot = pd.read_csv('/home/xhc/MRAN/csv/example/sheet/total.csv')
# tot.columns = ['File Name', 'Sample Type']
# tot.to_csv('/home/xhc/MRAN/csv/example/sheet/total.csv', index=False)
auc_ = torchmetrics.AUROC(pos_label=1)
df = pd.read_csv('/home/xhc/MRAN/run/2023-01-0415/predict.csv')
auc_.update(torch.tensor(list(df['p1'])), torch.tensor(list(df['label'])))
print(auc_.compute().item())