Get startedGet started for free

Evaluating with ROUGE

ROUGE is commonly used to evaluate summarization tasks as it checks for similarities between predictions and references. You have been provided with a model-generated summary, predictions, and a references summary for validate. Calculate the scores to see how well the model performed.

The evaluate library has been loaded for you.

This exercise is part of the course

Introduction to LLMs in Python

View Course

Exercise instructions

  • Load the ROUGE metric.
  • Calculate the ROUGE scores between the predicted and reference summaries.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Load the rouge metric
rouge = ____

predictions = ["""Pluto is a dwarf planet in our solar system, located in the Kuiper Belt beyond Neptune, and was formerly considered the ninth planet until its reclassification in 2006."""]
references = ["""Pluto is a dwarf planet in the solar system, located in the Kuiper Belt beyond Neptune, and was previously deemed as a planet until it was reclassified in 2006."""]

# Calculate the rouge scores between the predicted and reference summaries
results = ____
print("ROUGE results: ", results)
Edit and Run Code