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

Regenerate Prompt Technique Citations Graph #159

Closed
wants to merge 4 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -330,12 +330,12 @@ def visualize_graph(self, paper_references, technique_to_title):
)

plt.axis("off")

# plt.show()
plt.savefig("network_graph.png", format="png", dpi=300)

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())
Expand All @@ -344,25 +344,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.figure(figsize=(15, 6))
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()

Expand Down Expand Up @@ -422,6 +419,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__":
Expand Down Expand Up @@ -533,4 +534,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)


Loading