Skip to content
DeepForgeby svx
All problems
HardOptimizationop-372

Early Stopping Patience Decision

Problem

Training should stop when no new best loss has appeared for `patience` consecutive epochs. Find the earliest index of the minimum loss and check whether it is at least patience steps behind the latest epoch.

Given the loss history, patience, and min_delta (which are ignored beyond the argmin rule here), return True when the stopping criterion is met.

Hint

The count of epochs since the best value determines the decision.

Test cases

case 1
in: [[1,0.9,0.9,0.9],2,0]
expected: true
case 2
in: [[1,2,3],2,0]
expected: true
case 3
in: [[0.5,0.4,0.3,0.4,0.4],3,0.01]
expected: false
Starter codePython
def early_stopping_patience_decision(losses, patience, min_delta):
    # Your code here
    pass

3 test cases · run your code against them in the editor