Skip to content
DeepForgeby svx
All problems
EasyOptimizationop-150

Polyak Restart Check

Problem

Decide whether to restart momentum from the current iterate.

Return True when curr_loss is strictly greater than prev_loss, which signals that momentum has overshot. Otherwise return False.

Hint

Any increase in the loss triggers a restart in Polyak's scheme.

Test cases

case 1
in: [1,0.9]
expected: false
case 2
in: [0.5,0.5]
expected: false
case 3
in: [1,1.2]
expected: true
case 4
in: [2,3]
expected: true
Starter codePython
def polyak_restart_check(prev_loss, curr_loss):
    # Your code here
    pass

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