Deeper Learning

BLEU (Bilingual Evaluation Understudy Score) 본문

AI/Deep Learning

BLEU (Bilingual Evaluation Understudy Score)

Dlaiml 2020. 12. 24. 20:11

Why BLEU?

기계번역의 결과의 품질을 평가하기 위한 지표로 품질은 인간이 번역한 결과와 모델의 번역의 일치하는 정도와 같다.

 

X: Le chat est sur le tapis

Y1: The cat is on the mat

Y2: There is a cat on the mat

 

pred1: the the the the the the the

pred2: Cat on the mat

pred3: The cat the cat on the mat

 

위의 예시에서 보면 output의 길이가 다르고 pred1처럼 반복적인 단어의 sequence가 output일 경우 기존의 metrics의 사용이 힘들다.

 

BLEU

Bigrams BLEU를 먼저 예시로 들겠다.

 

pred3: The cat the cat on the mat를 Bigrams을 적용하여 나누면 

The cat / cat the / cat on / on the / the mat  총 5개의 token이 생성된다.

각 token을 pred에서 찾아 count하면 [2, 1, 1, 1, 1]이다.

각 token을 Y1에서 찾아 count하면 [1, 0, 0, 1, 1], Y2에서 찾으면 [0, 0, 1, 1, 1]로 최댓값을 찾으면 [1, 0, 1, 1, 1]이 된다.

 

pred에서 찾은 token의 합을 분모로하고 가능한 모든 Y에서 찾은 token의 최댓값의 합을 분자로 하면 Bigrams BLEU를 계산할 수 있다.

 

 

Combined BLEU score

1-gram, 2-gram, 3-gram, 4-gram의 값을 모두 더하여 Combined BLEU score 위와 같이 구할 수 있다. ($P_{n}$은 n-gram token으로 계산한 BLEU score)

Brevity Penalty

BP는 Brevity Penalty로 위와 같이 길이가 짧은 output에 대해 Penalty를 부과한다.

 

Reference

Andrew ng, coursera sequence models

Matt Post. (2018). 'A Call for Clarity in Reporting BLEU Scores'. arXiv:1804.08771

 

 

 

'AI > Deep Learning' 카테고리의 다른 글

Text similarity Model (CNN, MaLSTM)  (0) 2020.12.30
Deep Convolutional Generative Adversarial Networks (DCGAN)  (0) 2020.12.28
Beam Search  (0) 2020.12.24
Glove  (0) 2020.12.08
Word2Vec  (0) 2020.12.06
Comments