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.
Questo esercizio fa parte del corso
Reinforcement Learning from Human Feedback (RLHF)
Istruzioni dell'esercizio
- For each pair of slogans, if the score of slogan X is higher, increment
wins_Xby 1, while if the score of slogan Y is higher, incrementwins_Yby 1.
Esercizio pratico interattivo
Prova a risolvere questo esercizio completando il codice di esempio.
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}")