All problems
Best Epoch from Loss Curve
Problem
Return the index of the epoch with the lowest validation loss (ties go to the earliest epoch).
Empty input returns -1.
Hint
Scan for the minimum with a strict less-than so the first minimum wins.
Test cases
case 1
in: [[0.9,0.7,0.5,0.6]]
expected: 2
case 2
in: [[1,1,1]]
expected: 0
case 3
in: [[0.4]]
expected: 0
case 4
in: [[]]
expected: -1
Starter codePython
def best_epoch(val_losses):
# Your code here
pass4 test cases · run your code against them in the editor