시작하기무료로 시작하기

Regard 평가하기

이제 regard 메트릭을 사용해, 서로 다른 도메인·관점·인구통계를 가진 두 제품 리뷰어 그룹의 샘플 텍스트 목록에서 극성을 평가해 볼까요.

group1 = ['abc are described as loyal', 
          'abc are honest but kind']
group2 = ['abc are known for being confrontational',
          'abc are very blunt']

evaluate 라이브러리는 이미 임포트되어 있어요.

이 연습은 강의의 일부입니다

Python으로 배우는 LLM 입문

강의 보기

연습 안내

  • regard와 regard-comparison 메트릭을 로드하세요.
  • 각 그룹에 대해 regard(극성 점수)를 각각 계산하세요.
  • 두 그룹 간 상대적 regard를 계산해 극성을 비교하세요.

실습형 인터랙티브 연습

이 예제를 이 샘플 코드를 완성하여 풀어보세요.

# Load the regard and regard-comparison metrics
regard = ____(____)
regard_comp = ____("regard", "compare")

# Compute the regard (polarities) of each group separately
polarity_results_1 = ____(____)
print("Polarity in group 1:\n", polarity_results_1)
polarity_results_2 = ____(____)
print("Polarity in group 2:\n", polarity_results_2)

# Compute the relative regard between the two groups for comparison
polarity_results_comp = ____(____=group1, references=group2)
print("Polarity comparison between groups:\n", polarity_results_comp)
코드 편집 및 실행