레이블된 리뷰 데이터로 모델 비교하기
이제 대량의 감정 분석 분류를 할 수 있으니, 팀에서는 어떤 모델이 더 신뢰할 수 있는지 평가하고 싶어 합니다. 더 큰 규모의 레이블된 리뷰 데이터셋으로 두 모델을 비교하고 정확도를 측정해 보세요.
texts 리스트와 해당 true_labels가 미리 로드되어 있습니다.
이 연습은 강의의 일부입니다
Python으로 배우는 Natural Language Processing (NLP)
실습형 인터랙티브 연습
이 예제를 이 샘플 코드를 완성하여 풀어보세요.
from transformers import pipeline
from sklearn.metrics import accuracy_score
# Load sentiment analysis models
pipe_a = pipeline(task="sentiment-analysis", ____)
pipe_b = pipeline(task="sentiment-analysis", ____)
# Generate predictions
preds_a = [____ for res in pipe_a(texts)]
preds_b = [____ for res in pipe_b(texts)]