-
Chapter_06_요약_summarization.ipynbtransformer 2024. 8. 7. 16:09
출처
https://product.kyobobook.co.kr/detail/S000200330771트랜스포머를 활용한 자연어 처리 | 루이스 턴스톨 - 교보문고
트랜스포머를 활용한 자연어 처리 | 챗GPT처럼 자연어를 찰떡같이 알아듣는 트랜스포머 완벽 해부트랜스포머는 우리 주변에 가득하다! 트랜스포머 아키텍처는 순식간에 자연어 처리 분야를 지
product.kyobobook.co.kr
아래그림 설명
출처:
[NLP] N-gram 언어 모델의 개념, 종류, 한계점
📚 목차 1. N-gram 개념 2. N-gram 등장 배경 3. N-gram 종류 4. N-gram 기반 단어 예측 5. N-gram의 한계점 1. N-gram 개념 언어 모델(Language Model)은 문장 내 앞서 등장한 단어를 기반으로 이어서 등장할 적절한
heytech.tistory.com
BLEU
출처: https://wikidocs.net/31695
14-03 BLEU Score(Bilingual Evaluation Understudy Score)
앞서 언어 모델(Language Model)의 성능 측정을 위한 평가 방법으로 펄플렉서티(perplexity, PPL)를 소개한 바 있습니다. 기계 번역기에도 PPL을 평가에 사…
wikidocs.net
BLEU
모델의 out에서 n-gram으로 따져봤을때 정답에 얼마나 많이 포함되있느냐를 precision의 개념
모델이 생성한 candidate에서의 ngram들이 reference에서 얼마나 많이 포함되있느냐를 precision의 개념
수치적으로 정확도계산
번역이나 요약을 했을때 평가할수 있는 지표
y=e^x
아래그림)
candidate = prediction
reference = 정답
모델이 내놓은 prediction 의 너무 짧으면(the the the the 가아니고 the하나만 있으면 너무짧음) 안되니까 BP를 곱함
penalty를 곱함
import pandas as pd import numpy as np bleu_metric.add( prediction="the the the the the the", reference=["the cat is on the mat"]) results = bleu_metric.compute(smooth_method="floor", smooth_value=0) results["precisions"] = [np.round(p, 2) for p in results["precisions"]] pd.DataFrame.from_dict(results, orient="index", columns=["Value"])
아래그림
bigram일때 candidate의 on mat이 reference에 없으니까
bigram일때
prediction : the cat, cat is, is on , on mat (연속된 두개) ->4개 total
이중 reference에 들어간것은 the cat, cat is, is on -> 3개 counts
precision: 3/4 = 0.75
아래그림
BLEU, ROUGE차이
출처: https://jrc-park.tistory.com/273
BLEU Score의 소개와 계산하는 방법 (Python)
Last Updated on July 23, 2021 Bilingual Evaluation Understudy (BLEU) 딥러닝의 발달로 텍스트를 생성하는 Generative Model은 챗봇, 문서 요약등 다양한 분야에서 사용되고 있습니다. Generated Sentence를 평가하는 방식
jrc-park.tistory.com
BLEU - 번역작업에 많이 쓰고
- candidate가 reference에 있는갯수
ROUGE - 요약에 많이쓰임
- reference가 candidate에 있는갯수
아래그림)
gpt2는 요약작업에서 pretrain만 되어있어서 finetuning된 bart, pegasus 가 훨씬 요약 잘해서 rouge score 가 높다.
아래그림)
batch size로 제일 긴 max length를 정해서 짧은건 패딩붙이고 기준보다 긴거는 자른다.
'transformer' 카테고리의 다른 글
Chapter_08_요약_model-compression.ipynb (0) 2024.08.26 Chapter_07_요약_question-answering_v2.ipynb (0) 2024.08.16 Chapter_05_요약_text-generation.ipynb (0) 2024.07.31 Chapter_04_요약_multilingual-ner.ipynb (0) 2024.07.26 Chapter_03_요약_transformer 파해치기 https://nlpinkorean.github.io/illustrated-transformer/ (0) 2024.07.12