Aan de slagGa gratis aan de slag

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.

Deze oefening maakt deel uit van de cursus

Introduction to LLMs in Python

Cursus bekijken

Oefeninstructies

  • 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.

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# 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)
Code bewerken en uitvoeren