bakalarka_praca/graph/graph_lora.py

30 lines
855 B
Python

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