Aktualizovat graph/graph_lora.py

This commit is contained in:
Tetiana Mohorian 2025-05-20 09:58:56 +00:00
parent 9e3c32ba38
commit 7e09a03f7c
2 changed files with 29 additions and 27 deletions

View File

@ -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()

29
graph/graph_lora.py Normal file
View File

@ -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