<jupyter_start><jupyter_text>Merge times and answer results<jupyter_code>def mergeTimesAndResults():
    df_original = pd.read_csv('../data/eval-quant-out.csv')
    df_topone = pd.read_csv('../data/eval-quant-out-topone.csv')
    df_original[['ft_span_topone', 'kg_topone','ft_wiki_topone', 'ft_wiki_top3', 'ft_nernel_topone', 'ft_nernel_top3']] = df_topone[['ft_span_topone', 'kg_topone','ft_wiki_topone', 'ft_wiki_top3', 'ft_nernel_topone', 'ft_nernel_top3']]
    df_original.drop(['ft_answer', 'kg_answer'], inplace=True, axis=1)
    return df_original
df_final = mergeTimesAndResults()
df_final.to_csv('../data/eval-quant-out-final.csv')<jupyter_output><empty_output><jupyter_text>Compute performances<jupyter_code>df = pd.read_csv('../data/eval-quant-out-final.csv')
def countAnswers(df):
    return {
        'kg_topone': df['kg_topone'].value_counts().sort_index(ascending=True),
        'ft_span_topone': df['ft_span_topone'].value_counts().sort_index(ascending=True),
        'ft_wiki_topone': df['ft_wiki_topone'].value_counts().sort_index(ascending=True),
        'ft_wiki_top3': df['ft_wiki_top3'].value_counts().sort_index(ascending=True),
        'ft_nernel_topone': df['ft_nernel_topone'].value_counts().sort_index(ascending=True),
        'ft_nernel_top3': df['ft_nernel_top3'].value_counts().sort_index(ascending=True)
    }

def getAvgs(df):
    return {
        'kg_topone': df['kg_topone'].mean(),
        'ft_span_topone': df['ft_span_topone'].mean(),
        'ft_wiki_topone': df['ft_wiki_topone'].mean(),
        'ft_wiki_top3': df['ft_wiki_top3'].mean(),
        'ft_nernel_topone': df['ft_nernel_topone'].mean(),
        'ft_nernel_top3': df['ft_nernel_top3'].mean()
    }

def getTimes(df):
    return {
        'kg': df['kg_time'].mean(),
        'ft_span': df['ft_time'].mean(),
        'ft_wiki': df['ft_wiki_time'].mean(),
        'ft_nernel': df['ft_nernel_time'].mean(),
    }

def percentages(df):
    value_counts = countAnswers(df)
    percentages = dict()
    for key, value in value_counts.items():
        percentages[key] = {}
        for index, n in enumerate(value.values):
            s = np.sum(value.values)
            perc = n/s * 100
            percentages[key][index] = round(perc, 1)
            if len(value.values) < 3 and index == len(value.values)-1:
                percentages[key][index + 1] = 0
    return percentages

def getAcceptable(df):
    value_counts = countAnswers(df)
    perc = percentages(df)
    acceptable = dict()
    for key, value in value_counts.items():
        n = 0
        if 1 in value:
            n = value[1] + value[2]
        acceptable[key] = {'n': n, 'percentage': round(perc[key][1] + perc[key][2], 1)}
    return acceptable
getAvgs(df)
getTimes(df)
percentages(df)
getAcceptable(df)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.16488222698072805, 'fraction_numerical': 0.009992862241256246, 'mean_word_length': 3.9261862917398944, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '262993', 'license': 'MIT', 'n_tokens_mistral': 1053, 'n_tokens_neox': 1033, 'n_words': 143, 'path': 'evaluation/quant_eval.ipynb', 'repo_name': 'rpo19/AIQuestionAnswering', 'size': '2802'}