All problems
Gradient Descent One Step
Problem
Take one gradient descent step on f(x, y) = a*x^2 + b*y^2 + c*x*y from the given point with learning rate lr.
The gradient is [2*a*x + c*y, 2*b*y + c*x]. Return the updated point [x - lr * gx, y - lr * gy].
Hint
Step against the gradient: new_point = point - lr * gradient.
Test cases
case 1
in: [[1,1],0.1,1,1,0]
expected: [0.8,0.8]
case 2
in: [[2,-1],0.5,1,2,1]
expected: [0.5,0]
case 3
in: [[3,-2],0,1,1,0]
expected: [3,-2]
case 4
in: [[0,0],1,1,1,1]
expected: [0,0]
Starter codePython
def gradient_descent_step(point, lr, a, b, c):
# Return the updated [x, y]
# Your code here
pass4 test cases · run your code against them in the editor