From 7e09a03f7cd686a9d01b6673bd9bdf1416f8868b Mon Sep 17 00:00:00 2001 From: Tetiana Mohorian Date: Tue, 20 May 2025 09:58:56 +0000 Subject: [PATCH] Aktualizovat graph/graph_lora.py --- graph/graph.py | 27 --------------------------- graph/graph_lora.py | 29 +++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 27 deletions(-) delete mode 100644 graph/graph.py create mode 100644 graph/graph_lora.py diff --git a/graph/graph.py b/graph/graph.py deleted file mode 100644 index 2b3f652..0000000 --- a/graph/graph.py +++ /dev/null @@ -1,27 +0,0 @@ -import matplotlib.pyplot as plt - - -models = ["mt5_small", "mt5_base", "mt5_large", "slovak-t5-base", "slovak_t5_base_small", "SlovakBERT"] -precision = [0.4923, 0.4533, 0.4949, 0.5000, 0.5385, 0.60] -recall = [0.6400, 0.6800, 0.9800, 0.6600, 0.9800, 0.7200] -f1_score = [0.5565, 0.5440, 0.6577, 0.5690, 0.6950, 0.6545] - - -plt.figure(figsize=(10, 6)) - -plt.plot(models, precision, marker='o', label="Presnosť (Precision)", color="orange") -plt.plot(models, recall, marker='o', label="Citlivosť (Recall)", color="red") -plt.plot(models, f1_score, marker='o', label="F1-Score", color="purple") - - -plt.title("Porovnanie modelov pre rozpoznávanie nenávistnej reči", fontsize=14) -plt.xlabel("Modely", fontsize=12) -plt.ylabel("Hodnota metrík", fontsize=12) -plt.xticks(rotation=15) -plt.ylim(0.0, 1.0) -plt.grid(True, linestyle='--', alpha=0.7) -plt.legend(loc="best", fontsize=10) - - -plt.tight_layout() -plt.show() diff --git a/graph/graph_lora.py b/graph/graph_lora.py new file mode 100644 index 0000000..039f9ca --- /dev/null +++ b/graph/graph_lora.py @@ -0,0 +1,29 @@ +import matplotlib.pyplot as plt + +# Metadáta +metrics = ["Precision", "Recall", "F1-score"] +before_lora = [0.6689, 0.6082, 0.6386] # SlovakT5-base +after_lora = [0.7113, 0.7859, 0.7486] # SlovakT5-base + LoRA + +# Konfigurácia +x = range(len(metrics)) +width = 0.35 + +# Vykreslenie grafu +fig, ax = plt.subplots(figsize=(8, 6)) +ax.bar([p - width/2 for p in x], before_lora, width, label='Pred LoRA', color='red') +ax.bar([p + width/2 for p in x], after_lora, width, label='Po LoRA', color='green') + +# Popisy a štýl +ax.set_ylabel('Skóre') +ax.set_title('Výsledky modelu SlovakT5-base pred a po aplikácii LoRA') +ax.set_xticks(x) +ax.set_xticklabels(metrics) +ax.legend() +ax.set_ylim(0, 1) +plt.grid(axis='y', linestyle='--', alpha=0.7) +plt.tight_layout() + +# Zobrazenie alebo uloženie +plt.show() +plt.savefig("graf_lora_porovnanie.png") # voliteľné uloženie