Skip to content
DeepForgeby svx
All problems
MediumCalculusca-270

Descent Lemma Smoothness Bound

Problem

The descent lemma for an L-smooth function states f(y) <= f(x) + grad f(x) dot (y - x) + (L/2) * ||y - x||^2.

Given f_x = f(x), the gradient vector g at x, the points x and y, and the smoothness constant L, return the bound value.

Hint

The quadratic term rewards smaller steps; the linear term uses the local gradient.

Test cases

case 1
in: [1,[0,0],[0,0],[1,1],2]
expected: 3
case 2
in: [2,[1,1],[0,0],[1,0],1]
expected: 3.5
case 3
in: [0,[1,-1],[1,1],[1,1],4]
expected: 0
case 4
in: [3,[0,0],[2,2],[2,2],5]
expected: 3
Starter codePython
def descent_lemma_bound(f_x, g, x, y, L):
    # Your code here
    pass

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