Neural Sync Active
Gradient Descent and Optimization
Registry Synced
Gradient Descent and Optimization
105 words
1 min read
Reading compass
Now · 4.1 Gradient Descent
Gradient Descent and Optimization
4.1 Gradient Descent
β(t+1)=β(t)−η∇L(β(t))pythonimport numpy as np def gradient_descent(X, y, lr=0.01, epochs=1000): n, p = X.shape beta = np.zeros(p) for epoch in range(epochs): grad = -2/n * X.T @ (y - X @ beta) beta -= lr * grad return beta
4.2 Stochastic Gradient Descent
Update using a single observation at a time — much faster for large datasets.
4.3 Newton-Raphson
β(t+1)=β(t)−H−1∇L(β(t))Where H is the Hessian matrix. Faster convergence but O(p3) per iteration.
Join Discord
PreviousCross-ValidationNextSGD Variants