From 79a68a5d4f99756075e0b53f4456dda45a139882 Mon Sep 17 00:00:00 2001 From: Tetiana Mohorian Date: Tue, 20 May 2025 10:55:51 +0000 Subject: [PATCH] =?UTF-8?q?P=C5=99idat=20graph/graph.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- graph/graph.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 graph/graph.py diff --git a/graph/graph.py b/graph/graph.py new file mode 100644 index 0000000..8278917 --- /dev/null +++ b/graph/graph.py @@ -0,0 +1,31 @@ +import matplotlib.pyplot as plt +import numpy as np + +# Dáta z tabuľky +models = ["mT5-small", "mT5-base", "mT5-large", "SlovakT5-base", "SlovakT5-small"] +precision = [0.4923, 0.4533, 0.6473, 0.6689, 0.6230] +recall = [0.6400, 0.6800, 0.5903, 0.6082, 0.5748] +f1_score = [0.5662, 0.5440, 0.6188, 0.6386, 0.5989] + +# Nastavenia grafu +x = np.arange(len(models)) +width = 0.25 + +# Vykreslenie +fig, ax = plt.subplots(figsize=(10, 6)) +ax.bar(x - width, precision, width, label='Precision', color='red') +ax.bar(x, recall, width, label='Recall', color='blue') +ax.bar(x + width, f1_score, width, label='F1-score', color='green') + +# Popisy a štýl +ax.set_ylabel('Skóre') +ax.set_title('Porovnanie výkonnosti modelov (few-shot learning)') +ax.set_xticks(x) +ax.set_xticklabels(models, rotation=0, ha='center') +ax.set_ylim(0, 1) +ax.legend() +plt.grid(axis='y', linestyle='--', alpha=0.7) +plt.tight_layout() + +# Zobrazenie alebo uloženie +plt.show()