Skip to content
DeepForgeby svx
All problems
EasyOptimizationop-147

Linear Rate Factor

Problem

Compute the contraction factor of a linearly convergent method.

Return (1 - mu / L) ** t for strong convexity modulus mu, smoothness L, and t iterations. Return 0.0 when L is not positive.

Hint

The condition number mu / L controls how fast the gap shrinks.

Test cases

case 1
in: [1,4,5]
expected: 0.2373046875
case 2
in: [2,10,10]
expected: 0.10737418240000006
case 3
in: [1,1,3]
expected: 0
case 4
in: [3,4,1]
expected: 0.25
Starter codePython
def linear_rate_factor(mu, L, t):
    # Your code here
    pass

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