-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot_figures.py
More file actions
62 lines (44 loc) · 1.73 KB
/
plot_figures.py
File metadata and controls
62 lines (44 loc) · 1.73 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
"""
Take a list of csv output evaluation metrics and plots features.
"""
import os
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
def load_pert_prec_recall_cor(indir, expdir):
output_dir = os.path.join(indir, expdir)
df = pd.read_csv(os.path.join(output_dir, 'pert_prec_recall_cor.csv'))
df = df[['mAP', 'label']]
df = df.drop_duplicates()
return df
def load_target_prec_recall_cor(indir, expdir):
output_dir = os.path.join(indir, expdir)
df = pd.read_csv(os.path.join(output_dir, 'target_prec_recall_cor.csv'))
df = df[['mAP', 'label']]
df = df.drop_duplicates()
return df
def load_pert_acc_NSB(indir, expdir):
output_dir = os.path.join(indir, expdir)
df = pd.read_csv(os.path.join(output_dir, 'well_metrics.csv'))
df = df[['pert_acc_NSB', 'label']]
return df
def load_target_acc_NSBP(indir, expdir):
output_dir = os.path.join(indir, expdir)
df = pd.read_csv(os.path.join(output_dir, 'well_metrics.csv'))
df = df[['target_acc_NSBP', 'label']]
return df
def plot_pert_acc_mAP (indir, expdir):
df_acc= load_pert_acc_NSB(indir, expdir)
df_mAP= load_pert_prec_recall_cor(indir, expdir)
df = pd.merge(df_acc, df_mAP, on='label')
sns.scatterplot(data=df, x='pert_acc_NSB', y='mAP', hue='label')
def plot_target_acc_mAP (indir, expdir):
df_acc= load_target_acc_NSBP(indir, expdir)
df_mAP= load_target_prec_recall_cor(indir, expdir)
df = pd.merge(df_acc, df_mAP, on='label')
sns.scatterplot(data=df, x='target_acc_NSBP', y='mAP', hue='label')
if __name__ == "__main__":
indir = "embeddings directory"
expdir = "output directory"
plot_pert_acc_mAP (indir, expdir)
#plot_target_acc_mAP (indir, expdir)