minor fix
This commit is contained in:
parent
dd80f72b31
commit
77a1e13c8f
11
1.py
11
1.py
@ -8,22 +8,25 @@ import pandas as pd
|
|||||||
# example usage one arg python 1.py model_cv_1_0_preds.csv
|
# example usage one arg python 1.py model_cv_1_0_preds.csv
|
||||||
# example usage mulitple args python 1.py model_cv_1_0_preds.csv model_cv_1_1_preds.csv model_cv_1_2_preds.csv
|
# example usage mulitple args python 1.py model_cv_1_0_preds.csv model_cv_1_1_preds.csv model_cv_1_2_preds.csv
|
||||||
|
|
||||||
PREDICTED_COLUMN_NAME = 'query_annot'
|
# PREDICTED_COLUMN_NAME = 'query_annot'
|
||||||
LABEL_COLUMN_NAME = 'target_annot'
|
# LABEL_COLUMN_NAME = 'target_annot'
|
||||||
|
# COLUMN_SEPARATOR = '\t'
|
||||||
PREDICTED_COLUMN_NAME = 'plm_names'
|
PREDICTED_COLUMN_NAME = 'plm_names'
|
||||||
LABEL_COLUMN_NAME = 'targets'
|
LABEL_COLUMN_NAME = 'targets'
|
||||||
COLUMN_SEPARATOR = ','
|
COLUMN_SEPARATOR = ','
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
predicted_all_splits = list()
|
predicted_all_splits = list()
|
||||||
label_all_splits = list()
|
label_all_splits = list()
|
||||||
|
|
||||||
bleu = BLEU(effective_order=True)
|
bleu = BLEU()
|
||||||
|
bleu_one_sentence = BLEU(effective_order=True)
|
||||||
chrf = CHRF()
|
chrf = CHRF()
|
||||||
def get_statistics(r):
|
def get_statistics(r):
|
||||||
metrics = dict()
|
metrics = dict()
|
||||||
r['score_bleu'] = r.apply(
|
r['score_bleu'] = r.apply(
|
||||||
lambda row: round(bleu.sentence_score(row[PREDICTED_COLUMN_NAME], [row[LABEL_COLUMN_NAME]]).score, 2), axis=1)
|
lambda row: round(bleu_one_sentence.sentence_score(row[PREDICTED_COLUMN_NAME], [row[LABEL_COLUMN_NAME]]).score, 2), axis=1)
|
||||||
r['score_chrf'] = r.apply(
|
r['score_chrf'] = r.apply(
|
||||||
lambda row: round(chrf.sentence_score(row[PREDICTED_COLUMN_NAME], [row[LABEL_COLUMN_NAME]]).score, 2), axis=1)
|
lambda row: round(chrf.sentence_score(row[PREDICTED_COLUMN_NAME], [row[LABEL_COLUMN_NAME]]).score, 2), axis=1)
|
||||||
r['score_exact_match'] = r.apply(lambda row: 1 if row[PREDICTED_COLUMN_NAME] == row[LABEL_COLUMN_NAME] else 0,
|
r['score_exact_match'] = r.apply(lambda row: 1 if row[PREDICTED_COLUMN_NAME] == row[LABEL_COLUMN_NAME] else 0,
|
||||||
|
Loading…
Reference in New Issue
Block a user