Datasets:

Languages:
English
Size:
< 1K
ArXiv:
Libraries:
Datasets
License:
File size: 2,502 Bytes
1bb8d13
 
 
 
 
 
0e99aa8
1bb8d13
0e99aa8
1bb8d13
 
 
 
 
 
 
 
0e99aa8
 
1bb8d13
0e99aa8
1bb8d13
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4a89ca9
1bb8d13
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import os
import matplotlib as mpl
import matplotlib.pyplot as plt
import pandas as pd
from random import shuffle, seed

maps = {"competitor/rival of": "Rival", "friend/ally of": "Ally", "influenced by": "Inf", "known for": "Know", "similar to": "Sim", "average": "Avg"}
# Few-shots + Zero-shot
os.makedirs('figures/fewshots', exist_ok=True)
plt.rcParams.update({'font.size': 16})  # must set in top
# styles = ['o-', 'o--', 'o:', 's-', 's--', 's:', '^-', '^--', '^:', "X-", "X--", "X:"]
styles = ['o', "X", '^', 'P']
seed(1)
colors = list(mpl.colormaps['tab20b'].colors)
shuffle(colors)
for prompt in ['qa', 'lc']:
    df = pd.concat([
        pd.read_csv(f"results/lm_{prompt}_zeroshot.csv", index_col=0),
        pd.read_csv(f"results/lm_{prompt}_fewshots.csv", index_col=0)])

    df_full = pd.read_csv(f"results/lm_{prompt}/lm.csv", index_col=0)
    for r in maps:
        tmp = df[[r, "shot", "seed"]]
        tmp[r] = tmp[r] * 100
        ax = None
        for n, m in enumerate(['Flan-T5\textsubscript{XXL}', 'Flan-UL2', 'OPT\textsubscript{13B}', 'GPT-3\textsubscript{davinci}']):
            g = tmp.loc[m]
            full_shot = df_full[[r]].loc[[m]] * 100
            full_shot["shot"] = 5
            full_shot["seed"] = 0
            g = pd.concat([g, full_shot])
            if "OPT" in m:
                # m = "OPT (13B)"
                m = "OPT"
            if "Flan-T5" in m:
                # m = "Flan-T5 (XXL)"
                m = "Flan-T5"
            if "GPT-3" in m:
                # m = "GPT-3 (davinci)"
                m = "GPT-3"
            ax = g.plot.line(y=r,
                             x='shot',
                             # xlabel='Number of Prototypical Examples',
                             # xlabel='Num. of Proto. Examples',
                             # ylabel="Correlation",
                             xlabel="",
                             ylabel="",
                             ax=ax,
                             ms=8,
                             color=colors[n],
                             style=styles[n],
                             label=m,
                             figsize=(4, 5),
                             grid=True)
        ax.set_xticks([0, 1, 3, 5])
        if prompt == 'qa':
            ax.legend().remove()
        else:
            ax.legend(loc='lower right')
        plt.tight_layout()
        plt.savefig(f"figures/fewshots/{prompt}.{r.replace(' ', '_').replace('/', '-')}.fewshot.png", bbox_inches="tight", dpi=600)