训练集、验证集与测试集:先固定比较方式
仅在记录预测与观察证据之后允许求助。
前置要求
完成第 28 天统计;掌握预测—回顾流程。
学习目标
解释训练/验证/测试划分在评估中的作用,以及为什么测试集只读取一次;在任何调参之前先固定评估协议。
操作指引
评估回答的问题是『模型能否泛化』,使用的数据模型在训练中从未见过。训练集拟合参数;验证集指导选择(选哪个模型、哪些设置);测试集是最终的、未动过的读取。1,000 个样本按 60/20/20 划分为 600 训练、200 验证、200 测试。只有当每个候选都在同一划分上用同一指标打分时,比较才有效——先固定协议再调参,而不是看到结果之后再改。
自主演练与记录
某学习者有 1,000 个标注样本。(a) 按 60/20/20 分配训练/验证/测试。(b) 模型 M1 是在测试集上试评 40 次后选出的——指出协议违规及其后果。(c) 说明比较 M1 与 M2 得分前必须保持一致的条件。
反复读取测试集会让『测试』退化为验证——报告值乐观偏置。比较前必须相同:同一留出数据、同一指标、同一预处理。
(a) 600 训练、200 验证、200 测试。(b) 测试集被重复用于模型选择,报告分数向上偏置——违规点是『在测试集上做选择』;修复方法是用验证集做选择、测试集只读一次。(c) 同一测试划分、同一指标、同一预处理与评估代码,否则差异无法解释。
说明各划分在评估中的作用,指出测试集复用违规,并在调参前写出固定协议清单。
权威源资源与权利证明
Dive into Deep Learning (d2l.ai)
对应章节 / 时间戳: Section: Model Selection, Underfitting, and Overfitting
验证版本与日期: Current online edition (Verified: 2026-10-30)
Primary open reference tying evaluation discipline (model selection, underfitting, overfitting) and optimization algorithms (gradient descent, minibatch) to the rest of the curriculum.
Linear algebra, calculus, and probability at the Days 19-28 level.
All required formulas and worked numbers are reproduced as original explanations; the book is further reading.
对比候选资源与选型分析 (2)
Detailed treatment of optimization difficulties (chapter 8) including saddle points and plateaus; all-rights-reserved text kept as a linking-only alternative.
Strong practitioner framing, but organized around the fastai library and video lessons rather than self-contained mathematics.
Google Machine Learning Crash Course
对应章节 / 时间戳: Modules: Training and Test Sets; Validation
验证版本与日期: Current online edition (Verified: 2026-10-30)
Industrial, beginner-legible treatment of training/test splitting and overfitting; complements d2l.ai's mathematical framing.
Basic algebra; short self-contained modules.
Split discipline, leakage rules, and metric definitions are fully explained inside the lesson; the course is further reading.
对比候选资源与选型分析 (2)
Co-primary: deeper mathematical coverage of model selection, generalization, and optimization for the mathematics-track capstone.
Normative reference once learners call sklearn; kept as an alternative because these days teach evaluation protocol before library usage.