Skip to content

Commit

Permalink
Merge branch 'attn_model' of github.com-orisenbazuru:uzh-dqbm-cmi/sid…
Browse files Browse the repository at this point in the history
…e-effects into attn_model
  • Loading branch information
orisenbazuru committed Jun 15, 2020
2 parents addf902 + aa68123 commit 0d6dc4e
Show file tree
Hide file tree
Showing 16 changed files with 7,119 additions and 707 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Similarity,AUC,AUPR,F-measure,Recall,Precision
chem,0.514,0.368,0.137,0.152,0.551
target,0.634,0.527,0.494,0.453,0.561
transporter,0.605,0.484,0.427,0.358,0.558
enzyme,0.615,0.497,0.459,0.431,0.537
pathway,0.618,0.505,0.467,0.429,0.529
indication,0.681,0.596,0.567,0.555,0.581
sideeffect,0.604,0.551,0.41,0.418,0.606
offsideeffect,0.66,0.647,0.51,0.502,0.657
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Similarity,AUC,AUPR,F-measure,Recall,Precision
chem,0.512,0.385,0.111,0.094,0.426
target,0.643,0.535,0.51,0.48,0.559
transporter,0.594,0.474,0.4,0.328,0.556
enzyme,0.614,0.491,0.452,0.418,0.537
pathway,0.625,0.507,0.483,0.461,0.524
indication,0.685,0.607,0.572,0.558,0.591
sideeffect,0.618,0.581,0.443,0.436,0.612
offsideeffect,0.638,0.655,0.465,0.46,0.669
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Similarity,AUC,AUPR,F-measure,Recall,Precision
chem,0.0,0.0,0.0,0.0,0.0
target,0.0,0.0,0.0,0.0,0.0
transporter,0.0,0.0,0.0,0.0,0.0
enzyme,0.0,0.0,0.0,0.0,0.0
pathway,0.0,0.0,0.0,0.0,0.0
indication,0.0,0.0,0.0,0.0,0.0
sideeffect,0.0,0.0,0.0,0.0,0.0
offsideeffect,0.0,0.0,0.0,0.0,0.0
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
Similarity,AUC,AUPR,F-measure,Recall,Precision
chem,0.0,0.0,0.0,0.0,0.0
target,0.0,0.0,0.0,0.0,0.0
transporter,0.0,0.0,0.0,0.0,0.0
enzyme,0.0,0.0,0.0,0.0,0.0
pathway,0.0,0.0,0.0,0.0,0.0
indication,0.0,0.0,0.0,0.0,0.0
sideeffect,0.0,0.0,0.0,0.0,0.0
offsideeffect,0.0,0.0,0.0,0.0,0.0
chem,0.514,0.368,0.137,0.152,0.551
target,0.634,0.527,0.494,0.453,0.561
transporter,0.605,0.484,0.427,0.358,0.558
enzyme,0.615,0.497,0.459,0.431,0.537
pathway,0.618,0.505,0.467,0.429,0.529
indication,0.681,0.596,0.567,0.555,0.581
sideeffect,0.604,0.551,0.41,0.418,0.606
offsideeffect,0.66,0.647,0.51,0.502,0.657
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
Similarity,AUC,AUPR,F-measure,Recall,Precision
chem,0.501,0.379,0.018,0.009,0.625
target,0.731,0.72,0.621,0.572,0.707
transporter,0.639,0.563,0.48,0.409,0.614
enzyme,0.671,0.63,0.535,0.487,0.643
pathway,0.706,0.691,0.587,0.56,0.66
indication,0.781,0.788,0.692,0.672,0.74
sideeffect,0.556,0.549,0.218,0.253,0.555
offsideeffect,0.661,0.678,0.469,0.443,0.699
chem,0.512,0.385,0.111,0.094,0.426
target,0.643,0.535,0.51,0.48,0.559
transporter,0.594,0.474,0.4,0.328,0.556
enzyme,0.614,0.491,0.452,0.418,0.537
pathway,0.625,0.507,0.483,0.461,0.524
indication,0.685,0.607,0.572,0.558,0.591
sideeffect,0.618,0.581,0.443,0.436,0.612
offsideeffect,0.638,0.655,0.465,0.46,0.669
4 changes: 4 additions & 0 deletions ddi/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,14 @@ def preprocess_labels(interaction_fpath):
def create_setvector_features(X, num_sim_types):
"""reshape concatenated features from every similarity type matrix into set of vectors per ddi example"""
e = X[np.newaxis, :, :]
# print('e.shape', e.shape)
f = np.transpose(e, axes=(0, 2, 1))
# print('f.shape', f.shape)
splitter = 2*num_sim_types
g = np.concatenate(np.split(f, splitter, axis=1), axis=0)
# print('g.shape', g.shape)
h = np.transpose(g, axes=(2,0, 1))
# print('h.shape', h.shape)
return h

def get_stratified_partitions(ddi_datatensor, num_folds=5, random_state=42):
Expand Down
4 changes: 3 additions & 1 deletion ddi/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ def get_performance_results(similarity_type, target_dir, num_folds, dsettype):
'fold_{}'.format(fold_num))

score_file = os.path.join(fold_dir, 'score_{}.pkl'.format(dsettype))
# print(score_file)
if os.path.isfile(score_file):
mscore = ReaderWriter.read_data(score_file)
perf_dict[0]['fold{}'.format(fold_num)] = mscore.s_auc
Expand All @@ -63,8 +64,9 @@ def build_performance_dfs(similarity_types, target_dir, num_folds, dsettype):
aupr_df = pd.DataFrame()
f1_df = pd.DataFrame()
target_dir = create_directory(target_dir)
print(target_dir)
for sim_type in similarity_types:
s_auc , s_aupr, s_f1 = get_performance_results(sim_type, target_dir, num_folds, dsettype)
s_auc, s_aupr, s_f1 = get_performance_results(sim_type, target_dir, num_folds, dsettype)
auc_df = pd.concat([auc_df, s_auc], sort=True)
aupr_df = pd.concat([aupr_df, s_aupr], sort=True)
f1_df = pd.concat([f1_df, s_f1], sort=True)
Expand Down
Loading

0 comments on commit 0d6dc4e

Please sign in to comment.