All problems
Trust-Region Newton 1D
Problem
Take a trust-region-clipped Newton step in 1D.
When hess > 0 the step is -grad / hess clipped to [-radius, radius]. When hess <= 0 move against the gradient by radius, or use delta = 0 when grad is 0. Return [x + delta, delta].
Hint
Negative curvature means the quadratic is unbounded below; walk to the trust boundary.
Test cases
case 1
in: [1,2,4,10]
expected: [0.5,-0.5]
case 2
in: [1,8,2,2]
expected: [-1,-2]
case 3
in: [0,-3,-1,1]
expected: [1,1]
case 4
in: [1,0,0,1]
expected: [1,0]
Starter codePython
def trust_region_newton_1d(x, grad, hess, radius):
# Returns [x_new, delta]
# Your code here
pass4 test cases · run your code against them in the editor