BaşlayınÜcretsiz Başlayın

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.

Bu egzersiz

Reinforcement Learning from Human Feedback (RLHF)

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • 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, increment wins_Y by 1.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

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}")
Kodu Düzenle ve Çalıştır