深度学习基本模块
·
深度学习基本模块
Optimization
SGD
公式
while True:
dx = compute_gradient(x)
x -= learning_rate * dx
SGD+Momentum
公式:
vx = 0
while True:
dx = compute_gradient(x)
vx = rho*vx+dx
x -= learning_rate * vx
AdaGrad
AdaGrad就是在sgd的基础上除以一个项,使得在梯度变化快的地方减慢速度,在梯度变化慢的地方加快速度。但是随着梯度累加,速度会越来越慢,因此RMSProp被提出
grad_squared = 0
while True:
dx = compute_gradient(x)
grad_squared += dx*dx
x -= learning_rate * dx / (np.sqrt(grad_squared) + 1e-7)
RMSProp
grad_squared = 0
while True:
dx = compute_gradient(x)
grad_squared = decay_rate * grad_squared + (1 - decay_rate)*dx*dx
x -= learning_rate * dx/(np.sqrt(grad_squared)+1e-7)
Adam:Momentum+RMSProp
first_moment = 0
second_moment = 0
while True:
dx = compute_gradient(x)
first_moment = beta1 * first_moment + (1-beta1)*dx
second_moment = beta2 * second_moment + (1-beta2)*dx*dx
x -= learning_rate*first_moment /(np.sqrt(second_moment)+1e-7)
Batchnorm


魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐


所有评论(0)