All problems
Normalized Descent Direction
Problem
The steepest descent direction is -grad / ||grad||.
Given a nonzero gradient vector, return the unit descent direction.
Hint
Negate and divide by the Euclidean norm.
Test cases
case 1
in: [[3,4]]
expected: [-0.6,-0.8]
case 2
in: [[1,0,0]]
expected: [-1,0,0]
case 3
in: [[0,-2]]
expected: [0,1]
Starter codePython
def normalized_descent_direction(grad):
# Your code here
pass3 test cases · run your code against them in the editor