Explore Library
Code QuizAdvanced

Model Performance Monitoring in Production

Fix the sliding-window monitor that discards the wrong sample.

Codepython
window = []

def monitor(prediction, label, size=100):
    window.append(prediction == label)
    if len(window) > size:
        window.pop()  # keep only the most recent `size` results
    return sum(window) / len(window)

What is the bug in this rolling accuracy monitor?