Skip to content
DeepForgeby svx
All problems

Trust Region Step Size

Problem

Compute the TRPO trust-region step size sqrt(2 * delta / quadratic), where quadratic is the quadratic form g^T H g of the natural-gradient direction. Return 0.0 when delta or quadratic is non-positive.

Hint

The step size shrinks as the curvature in the natural-gradient direction grows.

Test cases

case 1
in: [0.01,4]
expected: 0.07071067811865475
case 2
in: [1,0]
expected: 0
case 3
in: [0,1]
expected: 0
case 4
in: [0.5,2]
expected: 0.7071067811865476
Starter codePython
import math
def trust_region_step_size(delta, quadratic):
    # Your code here
    pass

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