evaluate 지표 사용하기
고객 지원 상호작용을 분류하는 LLM을 평가해 볼 시간이에요. 미세 조정한 모델에서 이어서, 이제는 새로운 검증 데이터셋으로 모델의 성능을 평가해 보겠습니다.
일부 상호작용과 그에 해당하는 레이블은 validate_text와 validate_labels로 미리 로드되어 있어요. model과 tokenizer도 준비되어 있습니다.
이 연습은 강의의 일부입니다
Python으로 배우는 LLM 입문
연습 안내
outputs에 있는 모델 logits에서 예측 레이블을 추출하세요.- 실제 레이블(
validate_labels)과 예측 레이블을 비교하여 로드된 네 가지 지표를 계산하세요.
실습형 인터랙티브 연습
이 예제를 이 샘플 코드를 완성하여 풀어보세요.
accuracy = evaluate.load("accuracy")
precision = evaluate.load("precision")
recall = evaluate.load("recall")
f1 = evaluate.load("f1")
# Extract the new predictions
predicted_labels = ____
# Compute the metrics by comparing real and predicted labels
print(____(____=____, predictions=predicted_labels))
print(____(____=____, predictions=predicted_labels))
print(____(____=____, predictions=predicted_labels))
print(____(____=____, predictions=predicted_labels))