Loading...
Perform a single Stochastic Gradient Descent update step.
In SGD, parameters are updated using gradients and a learning rate α (alpha):
W=W−α⋅dW
This simple rule moves parameters in the direction that reduces the loss.
Write a function sgd_update(weights, gradients, learning_rate) that performs a single SGD update on a list of weights.
Return a list of updated weights. Round each value to 4 decimal places.
weights=[1.0], gradients=[0.5], learning_rate=0.1
[0.95]
1.0 - (0.1×0.5) = 1.0 - 0.05 = 0.95