当前位置: 首页 > news >正文

Machine Learning HW2 report:语音辨识(Hongyi Lee)

任务要求:分类音素。
注意:原代码shift函数存在问题

优化思路

  1. 增加dropout layers,并测试不同dropout rates
  2. 标准化 Batch Normalization
  3. 增加layer和parameter,比较“narrower and deeper”和“wider and shallower”的效果
  4. 增加concat_nframes
  5. 增加epoch数量

结果

实验过程

  1. 第一次,没有任何修改,训练结果 acc 0.49579
  2. 第二次,发现原代码shift函数存在问题,shift函数是用于移动数据,便于concat_nframes,但原代码在n< 0时,right的逻辑有误,shift前后x零维的大小改变为2n的绝对值。所以把相应代码改为如下所示,但奇怪的是和第一次结果没有任何差别,怀疑是concat_nframes为3,太小了,所以恰好无影响。
right = x[:x.size(0) + n]
  1. 第三次,保持上述改动,将concat_nframes从3增加到11(增加前后五段),best accuracy: 0.58330,Kaggle得分0.58611(private)
  2. 将上述改动改回来,即使用原来的shift函数,best accuracy: 0.58461更高,Kaggle得分0.58652。非常奇怪的是比第三次效果好,但是原函数确实有逻辑问题,短期内可能“表现更好”,但其逻辑错误会导致不可预测的行为,尤其在部署时可能失败。所以后续全部采用修改的shift函数
  3. 增加参数数量,神经网络结构调整如下。best accuracy: 0.67552,似乎存在过拟合问题:最后一次Train Acc: 0.7988,Kaggle:0.67780
hidden_layers = 2          # the number of hidden layershidden_dim = 1700           # the hidden dim
  1. 调整神经网络,使总参数量与第五次(wider and shallower)一致,此次narrower and deeper。best accuracy: 0.66733,Kaggle:0.67016
hidden_layers = 6          # the number of hidden layershidden_dim = 1024           # the hidden dim
  1. 保留wider and shallower的架构,使用 Batch Normalization,在BasicBlock中nn.Sequential神经网络中加上一行代码。best accuracy: 0.67778,Kaggle:0.67991,private分数比起没使用Normalization有一点提升。
        self.block = nn.Sequential(nn.Linear(input_dim, output_dim),nn.BatchNorm1d(output_dim), #Normalizationnn.ReLU(),)
  1. narrower and deeper架构 + Batch Normalization。best accuracy: 0.67453,Kaggle:0.67712
  2. 使用dropout layer, dropout_rate 设置为0.75。best accuracy: 0.53794。效果不好,但是训练进步速度非常快,10个epoch,每次都会更新best accuracy,从0.17涨到0.53。如果将epoch数量增加到30个,或许表现比以上的都要出色。
self.block = nn.Sequential(  nn.Linear(input_dim, output_dim),  nn.BatchNorm1d(output_dim), #batch normalization  nn.ReLU(),  nn.Dropout(dropout_rate)  # 在ReLU后添加Dropout  
)
  1. dropout_rate 设置为0.5,Total time: 11 min 8 sec,best accuracy: 0.64799
  2. dropout_rate 设置为0.25,运行时间10m 14s,best accuracy: 0.69419,Kaggle 0.69724,差一丝达到medium level,应该是不够深、参数不够多、concat_nframes还不够的问题。此外,发现运行速度并没有慢多少。
  3. dropout_rate 设置为0.25,concat_nframes改为19,Total time: 13 min 3 sec,best accuracy: 0.72252,kaggle:0.72597,达到了medium level
  4. hidden_dim = 1500,其余不变。效果很好,第一个epoch后acc 0.65176。Total time: 23 min 35 sec,best accuracy: 0.73143,kaggle:0.73478。此次训练没达到最佳效果:每一次都更新了best accuracy,只是最后两次幅度很小,应该增加epoch数量
  5. 将epoch数量改为20,并设置若连续5次没有改进,结束训练,其他不变,即使如此,也只有最后一次没有更新best accuracy。best accuracy: 0.74411,kaggle:0.74621。最后一次Train Acc: 0.78088,说明模型还不够好。
#if the model fails to improve for 5 times in a row, stop.  
if sequential_useless_epoch>=5:  print("the model fails to improve for 5 times in a row. Training stops.")  break  
else:  print("Sequential Useless Epoch: ",sequential_useless_epoch)
  1. 因为本地训练实在太慢,故把代码上传到kaggle notebook进行训练,注意需要更改训练资料地址和输出结果地址。将epoch改为30,保留早退机制,把hidden layer增加到8。20个epoch后best accuracy为0.74421,与上一次几乎没有差距,说明此时增加参数量几乎没有提升。best accuracy:0.74714。
  2. 将hidden layer改回6,把dropout rate改为0.35,连续三次未更新退出训练。20个epoch后best accuracy为 0.73881,不如dropout rate = 0.25的情况。Total time: 27 min 57 sec, best accuracy: 0.74686
  3. dropout rate改为0.2,Total time: 19 min 19 sec, best accuracy: 0.74300,Kaggle:0.74389,不如训练20个epoch,dropout rate = 0.25的模型。
  4. dropout rate = 0.3,Total time: 26 min 16 sec, best accuracy: 0.74725。Kaggle:0.74924。
  5. 最后一次,dropout rate = 0.25,concat_nframes从19增加为23。Total time: 27 min 23 sec, best accuracy: 0.75230,Kaggle:0.75371,过了strong baseline

总结

  1. narrower and deeper和wider and shallower在此次任务上差别不大,后者表现略好
  2. Colab会限额,建议在kaggle notebook上训练,后者GPU性能和分配的时间都明显好于前者。
  3. kaggle notebook上训练时,记得改训练、测试用的数据文件地址和输出文件地址
  4. kaggle notebook上训练完成后,在下载结果文件.csv前不要stop session,否则文件会被销毁!在如果要在自己电脑上运行
  5. 在增加参数或调整神经网络对结果没有明显提升时,可以考虑改变增加数据的feature
http://www.lryc.cn/news/592729.html

相关文章:

  • Glary Utilities(系统优化工具) v6.20.0.24 专业便携版
  • 【Python】一些PEP提案(三):with 语句、yield from、虚拟环境
  • [FDBUS4.2] watcher的使用
  • 利用五边形几何关系计算cos36°及推导黄金比例
  • 50天50个小项目 (Vue3 + Tailwindcss V4) ✨ | NotesApp(便签笔记组件)
  • 深入理解 Spring:事务管理与事件机制全解析
  • 如何将本地Git仓库推送到远程仓库的一个文件中并保留Commit记录
  • 借助AI学习开源代码git0.7之三git-init-db
  • RoboBrain 2.0(具身智能论文阅读)
  • Deep Multi-scale Convolutional Neural Network for Dynamic Scene Deblurring 论文阅读
  • Visual Studio C++编译器优化等级详解:配置、原理与编码实践
  • 【iOS】消息传递和消息转发
  • gitlab-runner配置问题记录
  • 洞见AI时代数据底座的思考——YashanDB亮相2025可信数据库发展大会
  • 【C++】——类和对象(中)——默认成员函数
  • LVS(Linux Virtual Server)详细笔记(实战篇)
  • 怎么判断一个对象是不是vue的实例
  • 前端自动化测试:Jest、Puppeteer
  • Rust交叉编译自动化实战
  • 车载监控录像系统:智能安全驾驶的守护者
  • 模式结构-微服务架构设计模式
  • CUPED (Controlled-experiment using Pre-Experiment Data) 论文学习笔记
  • web安全漏洞的原理、危害、利用方式及修复方法
  • AI 驱动的仪表板:从愿景到 Kibana
  • 游戏盾能否保护业务免受DDoS攻击吗?
  • 基于单片机直流电机测速中文液晶显示设计
  • 查找服务器上存在线程泄露的进程
  • 【c++】STL-容器 list 的实现
  • 【leetcode】3201. 找出有效子序列的最大长度(1)
  • C++ -- STL-- stack and queue