Week 12:AI 项目复盘报告——实验表、Ablation、README 与 Limitations
回到总路线:USTC 统计 AI / 量化 20 周成长计划
本周目标对应计划中的 Week 12:让 AI 比赛或深度学习项目能被老师、面试官和未来的自己看懂。
本教程默认你使用 CachyOS + fish shell + VS Code + uv + Python + Git。所有命令默认是 fish。本周不再只是“跑模型”,而是把 Week 10 / Week 11 的项目整理成一份有证据、有对比、有局限性的复盘报告。
0. 本周详细教学:语法、规范、验收
本节不是追加在尾部的复习,而是本周正文的入口。先读这里,再做后面的命令和项目。
0.1 本周真正要学会什么
| 维度 | 要求 |
|---|---|
| 知识点 | ablation、failure cases、limitations、solution.md |
| 代码语法 | 能从空文件写出本周核心脚本,而不是只复制运行 |
| 程序规范 | 函数拆分、路径清楚、输入输出明确、错误能解释 |
| 交付物 | projects/ai-competition-review/solution.md |
| 验收方式 | 从 fish 终端运行命令,得到可复查的文件或指标 |
0.2 代码语法精讲
下面的代码不是最终答案,而是本周必须理解的最小骨架:
rows = [
{"experiment": "baseline", "f1": 0.71, "note": "logreg"},
{"experiment": "+cleaning", "f1": 0.75, "note": "remove leakage"},
]
for row in rows:
print(row)
读代码时按四步检查:输入从哪里来;中间变量的类型和 shape 是什么;函数或脚本输出什么;哪些错误应该显式报出来。
0.3 本周程序规范
- 所有路径用相对路径或 `pathlib.Path`,不要写死 `/home/miku/...`。
- 核心逻辑进 `src/`,notebook 只做探索和解释。
- 每个脚本能从 fish 终端运行,并在 README 写出命令。
- 输出必须落盘到 `reports/`、`figures/` 或 `outputs/`,不能只在屏幕上看。
0.4 本周练习分层
| 层级 | 任务 | 不合格表现 | 合格验收 |
|---|---|---|---|
| 最小练习 | 手写上面的最小骨架 | 只在 notebook 里运行 | 终端运行成功 |
| 标准练习 | 把逻辑拆成函数/模块 | 一个大脚本从头写到尾 | 至少 2 个函数,职责清楚 |
| 项目练习 | 生成本周交付物 projects/ai-competition-review/solution.md | 只有屏幕输出 | 文件落盘,可复查 |
| 复盘练习 | 写 3 个错误和修复 | 只写“已解决” | 写清报错、原因、修复、预防 |
0.5 本周和主线的连接
- 回到总计划:USTC AI / Quant 练习手册
- 查详细练习索引:技术练习详解
- 查质量评分:最终质量门槛
1. 本周目标
完成后,你应该拥有:
- 一份
reports/project_review.md,说明任务、数据、贡献、baseline、改进、实验、结果、失败案例和收获。 - 一张实验表,记录每次改动和指标。
- 至少一个 ablation,对比“去掉某个改动后结果如何”。
- 一个可读的
README.md,让别人知道如何复现。 - 明确的 limitations,不夸大项目结果。
本周核心能力是:用结构化证据说明你做了什么,而不是只说“我参加过 AI 比赛”。
2. 前置条件
你需要已经完成以下二者之一:
- Week 10 的 PyTorch 小项目。
- Week 11 的 AI 比赛整理项目。
你还需要有至少 2 到 3 条实验记录,例如:
baseline
baseline + feature engineering
baseline + feature engineering + tuned hyperparameters
先进入你要复盘的项目。如果还没有项目,可以新建一个复盘练习目录:
mkdir -p ~/Code/ustc-ai/week12-ai-project-review
cd ~/Code/ustc-ai/week12-ai-project-review
uv init --name week12-ai-project-review
uv venv
source .venv/bin/activate.fish
uv add pandas matplotlib
code .
3. 文件布局
如果你接着 Week 10 / Week 11 项目做,推荐补齐这些文件:
mkdir -p reports figures src
目标布局:
project-root/
├── README.md
├── solution.md
├── reports/
│ ├── experiments.csv
│ ├── experiment_table.md
│ └── project_review.md
├── figures/
│ └── accuracy_by_experiment.png
└── src/
└── summarize_experiments.py
文件职责:
| 文件 | 作用 |
|---|---|
reports/experiments.csv |
机器可读实验记录 |
reports/experiment_table.md |
可粘贴进报告或 README 的 Markdown 表格 |
figures/accuracy_by_experiment.png |
指标对比图 |
reports/project_review.md |
本周核心复盘报告 |
README.md |
项目入口说明 |
solution.md |
技术方案说明 |
4. 建立实验表
创建 reports/experiments.csv。可以先在 VS Code 里手动写:
id,date,model,change,valid_metric,public_score,notes
exp001,2026-07-26,MLP,baseline,0.921,,first clean baseline
exp002,2026-07-26,MLP,hidden_dim 128 to 256,0.934,,larger model improved validation
exp003,2026-07-26,CNN,small cnn baseline,0.958,,cnn uses image structure
exp004,2026-07-26,CNN,remove second conv layer,0.941,,ablation: second conv helps
字段解释:
| 字段 | 含义 |
|---|---|
id |
实验编号,永远不要复用 |
date |
实验日期 |
model |
模型或方法 |
change |
本次实验相对上次改了什么 |
valid_metric |
本地验证集指标 |
public_score |
如果是比赛,可填 public leaderboard 分数 |
notes |
观察和结论 |
注意:每行最好只对应一个主要变化。否则无法判断改动是否有效。
5. 生成 Markdown 表和图
创建 src/summarize_experiments.py:
from __future__ import annotationsfrom pathlib import Path
import matplotlib.pyplot as plt import pandas as pd
EXPERIMENTS_CSV = Path(“reports/experiments.csv”) TABLE_MD = Path(“reports/experiment_table.md”) FIGURE_PATH = Path(“figures/accuracy_by_experiment.png”)
def main() -> None: experiments = pd.read_csv(EXPERIMENTS_CSV) required_columns = {“id”, “model”, “change”, “valid_metric”, “notes”} missing_columns = required_columns - set(experiments.columns) if missing_columns: raise ValueError(f”missing columns: {sorted(missing_columns)}”)
plain TABLE_MD.parent.mkdir(parents=True, exist_ok=True) FIGURE_PATH.parent.mkdir(parents=True, exist_ok=True)
plain table = experiments[[“id”, “model”, “change”, “valid_metric”, “notes”]] TABLE_MD.write_text(table.to_markdown(index=False), encoding=“utf-8”)
plain plt.figure(figsize=(8, 4)) plt.plot(experiments[“id”], experiments[“valid_metric”], marker=“o”) plt.xlabel(“experiment”) plt.ylabel(“validation metric”) plt.title(“Validation metric by experiment”) plt.xticks(rotation=30, ha=“right”) plt.tight_layout() plt.savefig(FIGURE_PATH, dpi=150) plt.close()
best = experiments.sort_values("valid_metric", ascending=False).iloc[0] print(f"best_experiment={best['id']} valid_metric={best['valid_metric']}") print(f"wrote {TABLE_MD}") print(f"wrote {FIGURE_PATH}")
if name == “main”: main()
运行:
source .venv/bin/activate.fish
python src/summarize_experiments.py
如果报 Missing optional dependency 'tabulate',安装表格依赖:
uv add tabulate
python src/summarize_experiments.py
检查产物:
test -f reports/experiment_table.md; and test -f figures/accuracy_by_experiment.png
6. 什么是 ablation
Ablation 指“去掉某个模块或改动,观察结果变化”。它不是随便多跑几个实验,而是回答:这个改动是否真的有用?
例子:
| 实验 | 改动 | 指标 | 结论 |
|---|---|---|---|
| exp003 | CNN baseline with two conv layers | 0.958 | 当前最好 |
| exp004 | remove second conv layer | 0.941 | 第二个卷积层有帮助 |
写 ablation 时要避免:
- 同时改模型、学习率、数据增强,然后说某个改动有效。
- 只报告提升,不报告失败。
- 没有固定 seed,导致对比不公平。
7. 项目复盘报告结构
创建 reports/project_review.md,推荐结构如下:
# AI Competition / Deep Learning Project Review
Task
- Problem:
- Input:
- Output:
- Metric:
Dataset
- Source:
- Size:
- Features / modalities:
- Train / validation split:
- Important preprocessing:
My Contribution
- I implemented:
- I cleaned:
- I trained:
- I analyzed:
Baseline
- Model:
- Why this baseline:
- Baseline result:
Improvements
- Improvement 1:
- Improvement 2:
- Improvement 3:
Experiments
Paste or link reports/experiment_table.md here.
Ablation
- Removed component:
- Result change:
- Interpretation:
Result
- Best validation score:
- Public leaderboard score if any:
- Final selected model:
Failure Cases
- Case 1:
- Case 2:
- What these failures suggest:
Limitations
- Dataset limitation:
- Evaluation limitation:
- Model limitation:
- Engineering limitation:
What I Learned
- Technical lesson:
- Statistical lesson:
Engineering lesson:
重点不是写得华丽,而是每一段都有证据。
8. README 应该怎么写
项目根目录 README.md 是别人打开仓库最先看到的文件。它应该短、清楚、可执行。
推荐结构:
# Project Name
Summary
One paragraph explaining the task, method, and best result.
File Layout
configs/ experiment configs
src/ training and inference code
reports/ experiment table and review report
figures/ generated charts
data/raw/ local raw data, not committed
Environment
uv venv
source .venv/bin/activate.fish
uv sync
Train
python src/train.py --model mlp --epochs 20
Evaluate
python src/evaluate.py --checkpoint checkpoints/best_mlp.pt
Results
Model Validation Metric Notes baseline fill fill best fill fill
Limitations
- Limitation 1.
- Limitation 2.
Limitation 3.
如果你的 Week 11 项目使用 python -m competition_project.train,README 里的命令就写项目真实命令,不要照抄上面的 MLP 命令。
9. 如何写 limitations
Limitations 不是自我否定,而是说明你知道项目边界。
好的 limitations:
- Validation uses a single random split; cross-validation was not performed.
- The dataset is small and clean, so the result may not transfer to noisy real-world data.
- Hyperparameter search was limited to three manual trials due to CPU-only training.
- Failure cases suggest the model confuses visually similar classes.
不好的 limitations:
- My computer was bad.
- The model could be better.
- Need more time.
好的写法要具体、可验证、能引出下一步。
10. 如何写给老师或面试官看的贡献
不要只写:
I participated in the competition.
改成:
I cleaned the tabular features, built a RandomForest baseline, fixed the train / inference feature mismatch, and wrote an ablation comparing categorical encoding strategies. The final local macro-F1 improved from 0.742 to 0.781.
结构是:
我做了什么 -> 解决了什么问题 -> 指标或证据是什么
11. 练习
- 从
reports/experiments.csv里选出 best experiment,并在project_review.md中解释为什么选它。 - 至少写一个 ablation:去掉一个层、一个特征、一种增强或一个清洗步骤。
- 在
Failure Cases中放 2 个真实错误例子。如果是图像项目,可以写错分图片编号;如果是表格项目,可以写被误判样本的特征特点。 - 把 README 的运行命令复制到一个新终端里执行一遍,确认没有漏步骤。
- 给
Limitations写 3 条具体限制,每条都要能被事实支持。
12. 验收检查
在项目根目录执行:
source .venv/bin/activate.fish
test -f reports/experiments.csv; and test -f reports/project_review.md; and test -f README.md
python src/summarize_experiments.py
test -f reports/experiment_table.md; and test -f figures/accuracy_by_experiment.png
通过标准:
reports/project_review.md包含 Task、Dataset、My Contribution、Baseline、Improvements、Experiments、Result、Failure Cases、What I Learned。- 实验表中至少有 baseline、best、一个 ablation。
- README 里有环境、训练、评估或推理命令。
- Limitations 至少 3 条,并且不夸大项目结果。
- 复盘报告能让没有参加项目的人看懂你做了什么。
13. 常见错误
13.1 只写结果,不写过程
错误写法:
We achieved 0.958 accuracy.
更好的写法:
The CNN baseline achieved 0.958 validation accuracy. Compared with the MLP baseline at 0.934, the CNN improved performance by using local image structure.
13.2 实验表没有对比意义
如果每次实验都同时改很多东西,就无法得出结论。实验表应该支持类似问题:
- CNN 是否优于 MLP?
- 第二个卷积层是否有用?
- 某个特征工程是否提升指标?
13.3 README 命令不能运行
每次改 README 后,至少在新终端里检查环境命令。fish 项目应写:
source .venv/bin/activate.fish
不要把 Bash / Zsh 的激活命令混进 fish 教程里。
13.4 limitations 写得太空
“模型还可以优化”不是有效 limitation。你要写清楚受什么限制、可能影响什么、下一步怎么验证。
13.5 把复盘报告写成流水账
报告不是日记。不要按“第一天我做了什么,第二天我做了什么”写;要按 Task、Dataset、Method、Experiments、Result、Limitations 组织。
14. 下一步
进入 Week 13:时间序列基础。你会从普通机器学习项目转向有时间顺序的数据,学习 ARIMA、rolling validation,并为后续量化回测打基础。
plain
気に入ったならばコメントを残してくださいね~