Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scores on multiple task with same shuffref #84

Merged
merged 3 commits into from
Jan 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion deeplift.egg-info/PKG-INFO
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: deeplift
Version: 0.6.9.1
Version: 0.6.9.2
Summary: DeepLIFT (Deep Learning Important FeaTures)
Home-page: https://github.com/kundajelab/deeplift
License: UNKNOWN
Expand Down
41 changes: 26 additions & 15 deletions deeplift/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,21 +382,32 @@ def compute_scores_with_shuffle_seq_refs(
input_shape=tuple(input_shape)
input_data_list = [np.reshape(np.asarray(to_run_input_data_seqs),input_shape)]
input_references_list = [np.reshape(np.asarray(to_run_input_data_refs),input_shape)]
computed_scores = np.array(score_computation_function(
task_idx=task_idx,
input_data_list=input_data_list,
input_references_list=input_references_list,
batch_size=batch_size,
progress_update=progress_update))
computed_scores = np.reshape(
computed_scores,
[len(input_data_sequences),
num_refs_per_seq]
+list(input_data_list[0].shape[1:]))

#take the mean over all the refs
mean_scores = np.mean(computed_scores,axis=1)
return mean_scores
#wrap task_idx in a list if it was not in a list
# (will unwrap later)
if (hasattr(task_idx, '__iter__')) == False:
list_wrapped_task_idx = [task_idx]
else:
list_wrapped_task_idx = task_idx
the_scores = []
for a_task in list_wrapped_task_idx:
computed_scores = np.array(score_computation_function(
task_idx=a_task,
input_data_list=input_data_list,
input_references_list=input_references_list,
batch_size=batch_size,
progress_update=progress_update))
computed_scores = np.reshape(
computed_scores,
[len(input_data_sequences),
num_refs_per_seq]
+list(input_data_list[0].shape[1:]))
#take the mean over all the refs
mean_scores = np.mean(computed_scores,axis=1)
the_scores.append(mean_scores)
#unwrap the scores if task_idx was not orginally a list
if (hasattr(task_idx, '__iter__')) == False:
the_scores = the_scores[0]
return the_scores
return compute_scores_with_shuffle_seq_refs


Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
Implements the methods in "Learning Important Features Through Propagating Activation Differences" by Shrikumar, Greenside & Kundaje, as well as other commonly-used methods such as gradients, guided backprop and integrated gradients. See https://github.com/kundajelab/deeplift for documentation and FAQ.
""",
url='https://github.com/kundajelab/deeplift',
version='0.6.9.1',
version='0.6.9.2',
packages=['deeplift',
'deeplift.layers', 'deeplift.visualization',
'deeplift.conversion'],
Expand Down