Skip to content

Commit

Permalink
minor debugging with print statements
Browse files Browse the repository at this point in the history
  • Loading branch information
orisenbazuru committed Feb 26, 2020
1 parent 02326a5 commit aa68123
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions ddi/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,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, valid_set_portion=0.1, 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

0 comments on commit aa68123

Please sign in to comment.