当前位置:网站首页>17. Attenuation of momentum and learning rate
17. Attenuation of momentum and learning rate
2022-07-27 05:59:00 【Pie star's favorite spongebob】
momentum
It can be understood as inertia ,
Subtracting a gradient means going in the direction of the gradient , At this point, subtract one zk, Means to zk Go in the right direction
zk Is a superposition operator , Represents the direction of the last gradient ▽w(k-1),
adam Itself is the optimization made by using momentum , There is no need to manage this variable extra .
optimizer=torch.optim.SGD(model.parameters(),args.lr,
momentum=args.momentum,
weight_decay=args.weight_decay)
scheduler=ReduceLROnPlateau(optimizer,'min')
for epoch in xrange(args.start_epoch,args.epochs):
train(train_loader,model,criteon,optimizer,epoch)
result_avg,loss_val=
validate(val_loader,model,criteon,epoch)
scheduler.step(loss_val)
learning rate tunning Attenuation of learning rate
We will force the learning rate to slowly drop to 0
programme 1:
scheduler=ReduceLROnPlateau(optimizer,'min')
loss Gentle after descent , A straight line no longer decreases , It's about reducing lr. Parameters patience,patience Next time , monitor loss, Find out loss There's no reduction , Will reduce lr, Every time lr Member reduction factor ( for example 0.5 or 0.08).
scheduler.step(loss_val)
Listen every time you call loss, Judge loss Whether it will not decrease for a long time , If it is , Reduce according to the rules lr, If not, do nothing , It only serves as a record .
programme 2:
Every provision x individual epoch, It will fade a little lr.
scheduler=StepLR(optimizer,step_size=30,gamma=0.1)
Every time 30 individual epoch,lr=lr*gamma
Usually set to 1k
边栏推荐
- Day 17.The role of news sentiment in oil futures returns and volatility forecasting
- DDD领域驱动设计笔记
- 13.逻辑回归
- leetcode系列(一):买卖股票
- Andorid detects GPU rendering speed and over rendering
- 舆情&传染病时空分析文献阅读笔记
- go通过channel获取goroutine的处理结果
- Emoji Emoji for text emotion analysis -improving sentimental analysis accuracy with Emoji embedding
- Es time query error - "caused_by": {"type": "illegal_argument_exception", "reason": "failed to parse date field
- 8.数学运算与属性统计
猜你喜欢

Day 9. Graduate survey: A love–hurt relationship

19.上下采样与BatchNorm

Digital image processing Chapter 2 fundamentals of digital image

Digital image processing Chapter 4 - frequency domain filtering

Digital image processing Chapter 5 - image restoration and reconstruction

我想不通,MySQL 为什么使用 B+ 树来作索引?

Deploy redis with docker for high availability master-slave replication

Do you really know session and cookies?

MySQL索引优化相关原理

11.感知机的梯度推导
随机推荐
Digital image processing Chapter 4 - frequency domain filtering
2021中大厂php+go面试题(2)
GBASE 8C——SQL参考6 sql语法(7)
Digital image processing Chapter 8 - image compression
数字图像处理 第二章 数字图像基础
Day 7. Towards Preemptive Detection of Depression and Anxiety in Twitter
根据文本自动生成UML时序图(draw.io格式)
Gbase 8C - SQL reference 6 SQL syntax (5)
数字图像处理——第六章 彩色图像处理
Gbase 8C - SQL reference 4 character set support
Rk3399 GPIO port how to find which GPIO port it is
9. High order operation
西瓜书学习第五章---神经网络
【并发编程系列9】阻塞队列之PriorityBlockingQueue,DelayQueue原理分析
How to not overwrite the target source data when dBSwitch data migrates data increments
Day 17.The role of news sentiment in oil futures returns and volatility forecasting
Day 9. Graduate survey: A love–hurt relationship
Uboot中支持lcd和hdmi显示不同的logo图片
Inno setup package jar + H5 + MySQL + redis into exe
GBase 8c产品简介