Apply one gradient-descent update to the Python lists values and gradients:
θi′=θi−ηgi.Here i indexes coordinates, θi is the original value, gi is its gradient, η is learning_rate, and θi′ is the updated value. The predicted first-order objective change is
ΔLpred=i∑gi(θi′−θi).Here ΔLpred is a local prediction, not a measured change in loss. Empty input lists produce an empty updated list and 0.0. Return a two-item tuple: a fresh list of updated Python floats, followed by the predicted change as a Python float.
Input: values=[2.0,-3.0,10.0], gradients=[-3.0,2.0,1.0], learning_rate=0.1
Output: ([2.3,-3.2,9.9],-1.4)
Explanation: Each value moves opposite its gradient, and the local prediction is -0.1 times the squared gradient norm.
Input: values=[1.0,-2.0], gradients=[0.0,0.0], learning_rate=0.5
Output: ([1.0,-2.0],0.0)
Input: values=[1.5,-4.0], gradients=[2.0,-3.0], learning_rate=0.0
Output: ([1.5,-4.0],0.0)
np.asarray with dtype=np.float64 prepares vectors for elementwise arithmetic.
np.dot reduces the gradient and update vector to a scalar.
Accepts: array
Accepts: array
Accepts: number
Apply one gradient-descent update to the Python lists values and gradients:
θi′=θi−ηgi.Here i indexes coordinates, θi is the original value, gi is its gradient, η is learning_rate, and θi′ is the updated value. The predicted first-order objective change is
ΔLpred=i∑gi(θi′−θi).Here ΔLpred is a local prediction, not a measured change in loss. Empty input lists produce an empty updated list and 0.0. Return a two-item tuple: a fresh list of updated Python floats, followed by the predicted change as a Python float.
Input: values=[2.0,-3.0,10.0], gradients=[-3.0,2.0,1.0], learning_rate=0.1
Output: ([2.3,-3.2,9.9],-1.4)
Explanation: Each value moves opposite its gradient, and the local prediction is -0.1 times the squared gradient norm.
Input: values=[1.0,-2.0], gradients=[0.0,0.0], learning_rate=0.5
Output: ([1.0,-2.0],0.0)
Input: values=[1.5,-4.0], gradients=[2.0,-3.0], learning_rate=0.0
Output: ([1.5,-4.0],0.0)
np.asarray with dtype=np.float64 prepares vectors for elementwise arithmetic.
np.dot reduces the gradient and update vector to a scalar.
Accepts: array
Accepts: array
Accepts: number