All problems
Early Stopping Patience for Policy Evaluation
Problem
Check whether early stopping should trigger.
Return True when the number of evaluations since the best score is at least patience. An empty history returns False.
Hint
Patience counts evaluations without a new best, not total evaluations.
Test cases
case 1
in: [[1,2,3,2,2,2],3]
expected: true
case 2
in: [[1,3,2,2],3]
expected: false
case 3
in: [[1,2],0]
expected: true
case 4
in: [[],1]
expected: false
Starter codePython
def early_stopping_patience(scores, patience):
# Your code here
pass4 test cases · run your code against them in the editor