Skip to content
DeepForgeby svx
All problems
EasyOptimizationop-337

GD Error After K Steps

Problem

For an L-smooth, mu-strongly convex quadratic, gradient descent with the optimal step shrinks the error by ((L - mu) / (L + mu))^k after k iterations.

Given the initial error, L, mu, and k, return the error estimate after k steps.

Hint

Raise the contraction ratio to the number of steps.

Test cases

case 1
in: [1,10,1,5]
expected: 0.3666478320532007
case 2
in: [2,4,2,10]
expected: 0.00003387017561686056
case 3
in: [5,3,1,0]
expected: 5
Starter codePython
def gd_error_after_k_steps(err0, l, mu, k):
    # Your code here
    pass

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