← Lesson
Supervised Learning
Joeven
Run
Reset
Python loads on first run
# 0 = search, 1 = sql, 2 = finish clean = [ ("weather", 0), ("docs", 0), ("revenue", 1), ("users", 1), ("done", 2), ("thanks", 2), ] def keywords(text): t = text.lower() if t in {"revenue", "users", "select"}: return 1 if t in {"done", "thanks"}: return 2 return 0 def acc(rows): return sum(keywords(x) == y for x, y in rows) / len(rows) noisy = list(clean) noisy[0] = ("weather", 1) # wrong on purpose print("clean acc", round(acc(clean), 2)) print("noisy acc", round(acc(noisy), 2)) print("the policy did not get worse — the labels did")
Run to execute this in your browser. Nothing is sent to a server.