【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

相关推荐
JamesYoung7971几秒前
OpenClaw小龙虾如何系统性节省Token,有没有可落地的方案?
人工智能
播播资源几秒前
OpenAI2026 年 3 月 18 日最新 gpt-5.4-nano模型:AI 智能体的“神经末梢”,以极低成本驱动高频任务
大数据·人工智能·gpt
Sendingab6 分钟前
2026 年 AI 数字人口播新趋势:智能体 Agent 将如何重构短视频内容生产与营销
人工智能·重构·音视频
itwangyang52023 分钟前
AI agent 驱动的药物发现、药物设计与蛋白设计:方法进展、系统架构与未来展望
人工智能
爱吃的小肥羊1 小时前
Anthropic今天杀疯了,Claude Code用户被大规模封号,中转站也顶不住了!
人工智能
卷福同学1 小时前
【养虾日记】QClaw操作浏览器自动化发文
运维·人工智能·程序人生·自动化
dehuisun1 小时前
国安部发布:“龙虾”(OpenClaw)安全养殖手册
人工智能
Echo_NGC22371 小时前
【贝叶斯公式】从先验到后验的概率推演
人工智能·贝叶斯·概率论·扩散模型
Shining05961 小时前
AI 编译器系列(七)《(MLIR)AscendNPU IR 编译堆栈》
人工智能·架构·mlir·infinitensor·hivm·ascendnpu ir