【2025版李宏毅机器学习系列课程】CH2 机器学习 Training Guide

作业流程

General Guide

  • model bias:增加模型的flexibility,比如激活函数、更多层数等
  • model bias 还是 optimization ?
    • comparison
    • Start from shallower network (or other models), which are easier to optimize
    • If deeper networks do not obtain smaller loss on training data, then there is optimization issue.
  • Overfitting:flexibility太大,training data不够多导致的
    • more training data:
      • data augmentation 数据增强,对现有数据进行各种变换来生成更多数据,要合理变换
    • less flexibility , constrained model:
      • Less parameters:less神经元、less层数
      • sharing parameters:CNN
      • Less features
      • Early stopping
      • Regularization
      • Dropout

Bias-Complexity Trade-off

  • benchmark corpora:基准测试语料库
  • how to select the best one?
    • 不建议的做法:直接比较model 在 public testing set的分数来选择。WHY?类比猴子敲出莎士比亚,如果test很多遍,即使是很废模型,还是有可能拿到好分数
    • testing set分public和private:public one 可以看成是训练时会用的,private one可以理解为实际放出来给大众用的,在public testing set上表现好可能是用了某些手段导致在此过拟合,但是在private testing set的表现不好
    • 建议的做法:cross validation,用validation set 来选model,少看public testing set的结果
    • n-fold cross validation

Mismatch

  • training and testing data have different distribution

critical point:local minima、saddle point

  • gradient为0的点统称critical point:比如local minima、saddle point
  • 判断critical point的类型:Hessian
  • saddle point:可以沿着负特征值的特征向量去更新参数
  • local minima:When you have lots of parameters, perhaps local minima is rare
    可能在高维空间只是个saddle point
  • 经验上看,其实local minima其实不常见,多数是saddle point

Batch

  • shuffle after each epoch

  • Why batch? 如果不用batch,那就是整个training set一起训练,相当于batch size = training set size,即极端情况的large batch

    • Small Batch v.s. Large Batch

      • large batch:Long time for cool down, but powerful(稳定)
      • small batch:Short time for cool down, but powerful but noisy
    • 时间上,large batch 跑完一个epoch的时间反而短,因为GPU并行运算的能力

    • 但noisy反而会有利于training

    • 而且 Small batch is better on testing data,大的batch size会让我们倾向于走到峡谷里面

  • 总结:Batch size is a hyperparameter you have to decide

相关推荐
小真zzz5 小时前
2026年GEO监测工具深度横评:谁在AI时代守护品牌心智?
人工智能·百度·重构
ZFSS5 小时前
Localization Translate API 集成与使用指南
java·服务器·数据库·人工智能·mysql·ai编程
天行健,君子而铎5 小时前
合规对标·低误报漏报·稳定运行——知源-AI数据分类分级系统金融行业解决方案
人工智能·金融·分类
视觉&物联智能5 小时前
【杂谈】-游戏生成数据:人工智能训练中极易被低估的核心资源
人工智能·游戏·ai·chatgpt·openai·agi·deepseek
扫地的小何尚5 小时前
NVIDIA Vera Rubin 平台如何解决 Agentic AI 的 Scale-up 难题
大数据·人工智能·机器学习
莞凰6 小时前
昇腾CANN的“灵脉根基“:Runtime仓库探秘
android·人工智能·transformer
5201-6 小时前
ops-conv:卷积算子从 CPU 到昇腾 NPU 的优化之路
人工智能·深度学习
HIT_Weston7 小时前
92、【Agent】【OpenCode】edit 工具提示词
人工智能·agent·opencode
Shan12057 小时前
机器学习评价指标之基础指标与综合指标
人工智能·机器学习
硅谷秋水7 小时前
智体Harness工程:综述(下)
人工智能·深度学习·机器学习·语言模型