mirror of
https://github.com/marvinscham/masterthesis-playground.git
synced 2025-12-06 18:20:53 +01:00
Restructure
This commit is contained in:
25
bertopic/bertopic_autotune_sorter.py
Normal file
25
bertopic/bertopic_autotune_sorter.py
Normal file
@@ -0,0 +1,25 @@
|
||||
import json
|
||||
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
with open("history.json", "r") as f:
|
||||
history = json.load(f)
|
||||
|
||||
history = sorted(history, key=lambda x: x["metrics"]["combined_score"], reverse=True)
|
||||
|
||||
with open("history_sorted.json", "w") as f:
|
||||
json.dump(history, f, indent=2)
|
||||
|
||||
|
||||
# Extract combined scores
|
||||
scores = [item["metrics"]["coherence"] for item in history]
|
||||
|
||||
# Plot histogram
|
||||
plt.hist(scores, bins=20, edgecolor="black")
|
||||
plt.title("Distribution of Combined Scores")
|
||||
plt.xlabel("Combined Score")
|
||||
plt.ylabel("Frequency")
|
||||
plt.grid(True)
|
||||
plt.tight_layout()
|
||||
plt.savefig("combined_score_distribution.png")
|
||||
plt.close()
|
||||
Reference in New Issue
Block a user