Implement vanilla gradient descent to minimize the one-dimensional quadratic
f(x)=ax2+bx+cStarting from x0, determine the gradient at the current value of x and apply the following update exactly steps times:
x←x−mathrmlr,mathrmgradientReturn the final value of x as a Python float. Deriving the gradient of the quadratic is part of the task.
Input: a = 1.0, b = -4.0, c = 3.0, x0 = 0.0, lr = 0.1, steps = 50
Output: 1.999971
Explanation: Repeated updates move x toward the minimum without jumping directly to it.
Input: a = 2.0, b = 8.0, c = 0.0, x0 = 10.0, lr = 0.05, steps = 200
Output: -2.0
Use a loop that performs exactly steps parameter updates.
Compute the gradient at the current x before applying the learning-rate update.
Sign in to take notes on this problem
Accepts: number
Accepts: number
Accepts: number
Accepts: number
Accepts: number
Accepts: number
Implement vanilla gradient descent to minimize the one-dimensional quadratic
f(x)=ax2+bx+cStarting from x0, determine the gradient at the current value of x and apply the following update exactly steps times:
x←x−mathrmlr,mathrmgradientReturn the final value of x as a Python float. Deriving the gradient of the quadratic is part of the task.
Input: a = 1.0, b = -4.0, c = 3.0, x0 = 0.0, lr = 0.1, steps = 50
Output: 1.999971
Explanation: Repeated updates move x toward the minimum without jumping directly to it.
Input: a = 2.0, b = 8.0, c = 0.0, x0 = 10.0, lr = 0.05, steps = 200
Output: -2.0
Use a loop that performs exactly steps parameter updates.
Compute the gradient at the current x before applying the learning-rate update.
Sign in to take notes on this problem
Accepts: number
Accepts: number
Accepts: number
Accepts: number
Accepts: number
Accepts: number