ComeçarComece de graça

Evaluating regard

Time to use the regard metric to assess polarity in two lists of sample texts associated to two groups of product reviewers with different domains, perspectives, and demographics.

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

The evaluate library has been imported for you.

Este exercício faz parte do curso

Introduction to LLMs in Python

Ver curso

Instruções do exercício

  • Load the regard and regard-comparison metrics.
  • Compute the regard (polarity scores) for each group separately.
  • Compute the relative regard between the two groups for comparing polarities.

Exercício interativo prático

Experimente este exercício completando este código de exemplo.

# 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)
Editar e executar o código