Prüfung der Toxizität
Du arbeitest bei einem Social-Media-Unternehmen und musst die Kommentare auswerten, die auf der Plattform hinterlassen werden, um sicherzustellen, dass die Nutzer/innen den Verhaltenskodex einhalten.
Deine Aufgabe ist es, den Giftigkeitsgrad der Kommentare von user_1
und user_2
sorgfältig zu bewerten.
Die Giftigkeitskennzahl wurde für dich als toxicity_metric
geladen.
Diese Übung ist Teil des Kurses
Einführung in LLMs in Python
Anleitung zur Übung
- Berechne die individuelle Toxizität jeder Sequenz.
- Berechne die maximale Toxizität.
- Berechne das Toxizitätsverhältnis pro Kommentar.
Interaktive Übung
Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.
# Calculate the individual toxicities
toxicity_1 = toxicity_metric.compute(predictions=____)
toxicity_2 = toxicity_metric.compute(predictions=____)
print("Toxicities (user_1):", toxicity_1['toxicity'])
print("Toxicities (user_2): ", toxicity_2['toxicity'])
# Calculate the maximum toxicities
toxicity_1_max = toxicity_metric.compute(____)
toxicity_2_max = toxicity_metric.compute(____)
print("Maximum toxicity (user_1):", toxicity_1_max['max_toxicity'])
print("Maximum toxicity (user_2): ", toxicity_2_max['max_toxicity'])
# Calculate the toxicity ratios
toxicity_1_ratio = ____(____)
toxicity_2_ratio = ____(____)
print("Toxicity ratio (user_1):", toxicity_1_ratio['toxicity_ratio'])
print("Toxicity ratio (user_2): ", toxicity_2_ratio['toxicity_ratio'])