Comparing slogans for a gym campaign
You're working with an advertising agency to evaluate two models that generate slogans for a gym campaign. Each model has produced a list of slogans with corresponding effectiveness scores. Your task is to compare the slogans generated by each model, determine which model is better overall, and calculate the success rate of each model.
The slogans have been preloaded as slogans_X
and slogans_Y
, lists of tuples containing the slogan and its score.
Diese Übung ist Teil des Kurses
Reinforcement Learning from Human Feedback (RLHF)
Anleitung zur Übung
- For each pair of slogans, if the score of slogan X is higher, increment
wins_X
by 1, while if the score of slogan Y is higher, incrementwins_Y
by 1.
Interaktive Übung
Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.
def evaluate_slogans(slogans_X, slogans_Y):
wins_X, wins_Y = 0, 0
for (slogan_X, score_X), (slogan_Y, score_Y) in zip(slogans_X, slogans_Y):
# Assign one point to X if score X is higher, otherwise to Y
____
success_rate_X = (wins_X / len(slogans_X)) * 100
success_rate_Y = (wins_Y / len(slogans_Y)) * 100
return success_rate_X, success_rate_Y
results = evaluate_slogans(slogans_X, slogans_Y)
print(f"The resulting scores are {results}")