Datasets:

Languages:
English
Size:
< 1K
ArXiv:
Libraries:
Datasets
License:
relentless / experiments /summary_main.py
asahi417's picture
init
1bb8d13
raw
history blame
1.71 kB
import pandas as pd
maps = {"is competitor/rival of": "Rival", "is friend/ally of": "Ally", "is influenced by": "Inf", "is known for": "Know", "is similar to": "Sim"}
def to_latex(df):
df.columns = [maps[x] if x in maps else x for x in df.columns]
df['Avg'] = df.pop("average")
df = (100 * df).round(1)
tmp = df.to_latex(escape=False)
tmp = tmp.replace("{lrrrrrr}", "{@{}l@{\hspace{7pt}}c@{\hspace{7pt}}c@{\hspace{7pt}}c@{\hspace{7pt}}c@{\hspace{7pt}}c@{\hspace{7pt}}c@{}}")
return tmp
# Main table
df_oracle = pd.read_csv("experiments/results/oracle.csv", index_col=0)
df_ft_pair = pd.read_csv("experiments/results/word_embedding/fasttext.csv", index_col=0)
df_ft_word = pd.read_csv("experiments/results/word_embedding/fasttext_zeroshot.csv", index_col=0)
df_rel = pd.read_csv("experiments/results/relbert/relbert.csv", index_col=0)
table = to_latex(df_oracle)
table = table.split(r"\bottomrule")[0]
df_vector = pd.concat([df_ft_pair, df_ft_word, df_rel])
table_vector = to_latex(df_vector)
table_vector = table_vector.split(r"\bottomrule")[0].split(r"\midrule")[1]
table = table + "\midrule " + "\multicolumn{7}{@{}l}{* \emph{Embedding Models}} \\\\" + table_vector
df_lm = pd.read_csv("experiments/results/lm_lc/lm.csv", index_col=0)
table_lm = to_latex(df_lm)
table_lm = table_lm.split(r"\bottomrule")[0].split(r"\midrule")[1]
table = table + "\midrule " + "\multicolumn{7}{@{}l}{* \emph{LM (LC template)}} \\\\" + table_lm
df_lm = pd.read_csv("experiments/results/lm_qa/lm.csv", index_col=0)
table_lm = to_latex(df_lm)
table_lm = table_lm.split(r"\midrule")[1]
table = table + "\midrule " + "\multicolumn{7}{@{}l}{* \emph{LM (QA template)}} \\\\" + table_lm
print(table)