Skip to content

Commit

Permalink
Added IMAGE_FORMAT parameter for top-k-computation
Browse files Browse the repository at this point in the history
  • Loading branch information
AndMastro committed Sep 19, 2023
1 parent bf4dfb4 commit de99b11
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion parameters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ top_k_computation:
PLOT: True #if to save top_k graph images
EXPLANATIONS_FOLDER: "results/explanations/GraphSAGE/" #folder where the explanations computed with explainer_script.py are
TOP_K_VALUES: [5,10,15,20,25] #values for the top-k edges computation
NODE_LABELS: True #if to show node labels in the top-k graph images
NODE_LABELS: False #if to show node labels in the top-k graph images
IMAGE_FORMAT: "svg" #image format for the top-k graph images



Expand Down
7 changes: 4 additions & 3 deletions top_k_computation.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

TOP_K_VALUES = args["top_k_computation"]["TOP_K_VALUES"]
NODE_LABELS = args["top_k_computation"]["NODE_LABELS"]
IMAGE_FORMAT = args["top_k_computation"]["IMAGE_FORMAT"]

AFFINITY_GROUPS = ["low affinity", "medium affinity", "high affinity"]

Expand Down Expand Up @@ -290,17 +291,17 @@ def generate_pli_dataset_dict_reduced(data_path):

nx.draw(G, pos=pos, node_size = 400, with_labels=NODE_LABELS, font_weight='bold', labels=nx.get_node_attributes(G, 'atom_type'), node_color=colors,edge_color=edges_colors, width=edges_widths, edge_cmap=plt.cm.bwr)

plt.savefig(directory + test_interaction_name + "/" + test_interaction.interaction_name + "_EdgeSHAPer_top_" + str(top_k_t) + "_edges_full_graph.png", dpi=300)
plt.savefig(directory + test_interaction_name + "/" + test_interaction.interaction_name + "_EdgeSHAPer_top_" + str(top_k_t) + "_edges_full_graph." + IMAGE_FORMAT, dpi=300)

plt.close()

#save original graph
if top_k_t == 25:
plt.figure(figsize=(10,10))

nx.draw(G, pos=pos, with_labels=True, font_weight='bold', labels=nx.get_node_attributes(G, 'atom_type'), node_color=colors)
nx.draw(G, pos=pos, with_labels=NODE_LABELS, font_weight='bold', labels=nx.get_node_attributes(G, 'atom_type'), node_color=colors)

plt.savefig(directory + test_interaction_name + "/" + test_interaction.interaction_name + "_full_interaction_graph.png", dpi=300)
plt.savefig(directory + test_interaction_name + "/" + test_interaction.interaction_name + "_full_interaction_graph." + IMAGE_FORMAT, dpi=300)

plt.close()

Expand Down

0 comments on commit de99b11

Please sign in to comment.