From 91e76b0fbd31d44db4cc1cbad0dbf25f93193159 Mon Sep 17 00:00:00 2001 From: AayushGupta16 Date: Mon, 20 May 2024 12:01:16 -0500 Subject: [PATCH 1/3] Added Bar Chart Code --- .../experiments/graph_internal_references.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/prompt_systematic_review/experiments/graph_internal_references.py b/src/prompt_systematic_review/experiments/graph_internal_references.py index a464bee..0e13fa9 100644 --- a/src/prompt_systematic_review/experiments/graph_internal_references.py +++ b/src/prompt_systematic_review/experiments/graph_internal_references.py @@ -328,7 +328,6 @@ def visualize_graph(self, paper_references, technique_to_title): ) plt.axis("off") - plt.show() plt.savefig('network_graph.png', format='png', dpi=300) @@ -421,6 +420,10 @@ def visualize_graph(self, technique_to_title): with open("cleaned_complete_paper_references.json", "r") as json_file: paper_references = json.load(json_file) self.graph_visualizer.visualize_graph(paper_references, technique_to_title) + def visualize_chart(self, technique_to_title): + with open("cleaned_complete_paper_references.json", "r") as json_file: + paper_references = json.load(json_file) + self.graph_visualizer.visualize_citation_counts(paper_references, technique_to_title) if __name__ == "__main__": @@ -532,4 +535,7 @@ def visualize_graph(self, technique_to_title): # main.process_additional_papers(titles) # main.merge_paper_references() # main.clean_paper_references() - main.visualize_graph(technique_to_title) + # main.visualize_graph(technique_to_title) + main.visualize_chart(technique_to_title) + + From b160bc99b23c0f4612d58215725f44ab30892de0 Mon Sep 17 00:00:00 2001 From: AayushGupta16 Date: Wed, 22 May 2024 11:23:34 -0500 Subject: [PATCH 2/3] Updated Graph Title and Axis --- .../experiments/graph_internal_references.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/prompt_systematic_review/experiments/graph_internal_references.py b/src/prompt_systematic_review/experiments/graph_internal_references.py index 0e13fa9..3796e38 100644 --- a/src/prompt_systematic_review/experiments/graph_internal_references.py +++ b/src/prompt_systematic_review/experiments/graph_internal_references.py @@ -333,7 +333,6 @@ def visualize_graph(self, paper_references, technique_to_title): def visualize_citation_counts(self, paper_references, title_to_technique): citation_counts = {} - for title, technique in title_to_technique.items(): paper_id = self.semantic_scholar_api.query_paper_id(title) citation_count = sum(paper_id in refs for refs in paper_references.values()) @@ -342,25 +341,22 @@ def visualize_citation_counts(self, paper_references, title_to_technique): sorted_citations = sorted( citation_counts.items(), key=lambda x: x[1], reverse=True ) - sorted_techniques, sorted_counts = zip(*sorted_citations) plt.figure(figsize=(30, 12)) plt.bar( - sorted_techniques, sorted_counts, color=(45 / 255, 137 / 255, 145 / 255, 1) + sorted_techniques, + sorted_counts, + color=(45 / 255, 137 / 255, 145 / 255, 1) ) - plt.yscale("log") - plt.xticks(rotation=45, ha="right") - ax = plt.gca() ax.spines["top"].set_visible(False) ax.spines["right"].set_visible(False) - - plt.ylabel("Number of References") - plt.xlabel("Technique") - + plt.ylabel("Citation Counts") + plt.xlabel("Prompting Techniques") + plt.title("Citation Counts of Prompting Techniques") plt.tight_layout() plt.show() From 1e6d7754ef1cdb5173b08b98560f530936f48660 Mon Sep 17 00:00:00 2001 From: AayushGupta16 Date: Wed, 22 May 2024 11:46:41 -0500 Subject: [PATCH 3/3] Updated Graph Title and Axis --- .../experiments/graph_internal_references.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/prompt_systematic_review/experiments/graph_internal_references.py b/src/prompt_systematic_review/experiments/graph_internal_references.py index 3796e38..fb86690 100644 --- a/src/prompt_systematic_review/experiments/graph_internal_references.py +++ b/src/prompt_systematic_review/experiments/graph_internal_references.py @@ -343,7 +343,7 @@ def visualize_citation_counts(self, paper_references, title_to_technique): ) sorted_techniques, sorted_counts = zip(*sorted_citations) - plt.figure(figsize=(30, 12)) + plt.figure(figsize=(15, 6)) plt.bar( sorted_techniques, sorted_counts,