完整互动讲义Complete interactive guide

9 册 · 27 主课单元 · 中英双语9 volumes · 27 source lessons · bilingual

别先追模型。先学会证明它真的有用。Do not chase models first. Learn to prove they help.

这套讲义逐项覆盖当前官方目录中的 27 个主课文件。每课都用同一个“岗位匹配实验室”解释输入、过程、错误与验收,让零基础读者看到模型如何进入真实项目。

This guide maps every one of the 27 primary lesson files currently in the official tree. A running Job Match Lab exposes inputs, process, errors, and acceptance so beginners can see how models enter real projects.

9volumes
27units
54个例子examples
58个术语terms

学完能做什么Observable outcomes

不是“看懂了”,而是能解释、能判断、能交付Not just recognition: explain, judge, and deliver

能定义问题Frame the problem

写清预测被谁用于什么决定、错误成本和不用模型的条件。

State who uses the prediction, for what decision, the error costs, and when not to use ML.

能做实验Run experiments

建立无泄漏切分、基线、Pipeline、交叉验证和错误分析。

Build leakage-safe splits, baselines, Pipelines, cross-validation, and error analysis.

能跨任务判断Judge across tasks

理解回归、分类、聚类、NLP、时间序列与强化学习的反馈差异。

Distinguish feedback across regression, classification, clustering, NLP, time series, and RL.

能负责任交付Deliver responsibly

提供模型卡、群体切片、监控、复核与回滚,而非只交一个模型文件。

Deliver model cards, cohort slices, monitoring, review, and rollback—not only a model file.

30 分钟快速路径30-minute fast path

先搭地图,再回到完整路线Build the map, then take the full route

快速路径先串起问题、公平、环境、数据、回归、分类、聚类、文本、时间、奖励和上线。完整学习时按册做贯穿项目。

The fast path connects framing, fairness, environment, data, regression, classification, clustering, text, time, reward, and deployment. Use the full path to build the running project.

边界提醒Boundary

官方仓库简介仍写 26 lessons,但当前主目录实际有 27 个非 solution 主课 README;本讲义以 2026-07-20 可核验目录为准。内容为原创双语教学重构,不是官方逐句翻译。

The repository tagline still says 26 lessons, while the current main tree contains 27 non-solution primary lesson READMEs. This guide follows the verifiable tree on 2026-07-20. It is an original bilingual teaching reconstruction, not an official line-by-line translation.

第一册 · 第 1–4 课Volume 1 · Lessons 1–4

先选对问题,再选算法Choose the problem before the algorithm

建立范式、公平与历史边界。

Build boundaries around paradigms, fairness, and history.

本册作品里程碑Portfolio milestone

完成问题卡、范式地图和负责任使用卡。

Complete the problem card, paradigm map, and responsible-use card.

01

第 1 课Lesson 1

机器学习到底适合解决什么问题Introduction to machine learning

先回答一个白话问题Start with a plain question

机器学习从历史样本中归纳可用于新样本的模式。 这节课不从算法名开始,而是先判断这个能力解决什么决策问题。

Machine learning infers patterns from historical examples and applies them to new cases. This lesson starts with the decision the capability supports, not an algorithm name.

类比桥梁Analogy bridge

像根据过去航班延误记录估计新航班风险,而不是把每条天气规则都手写出来。

It is like estimating a new flight’s delay risk from past flights instead of hand-writing every weather rule.

类比边界:类比只帮助识别关系;真正系统仍由数据、代码、接口和运行环境决定。Where it breaks: The analogy only exposes relationships; the real system is determined by data, code, interfaces, and its runtime.

工程上到底发生什么What it means in engineering

先定义输入、目标、决策、可接受错误和简单基线;只有规则难以维护且数据能代表问题时才考虑模型。

Define inputs, target, decision, acceptable errors, and a simple baseline first. Use a model only when rules are brittle and data represents the problem.

例子 1 · 规则还是模型Example 1 · Rules or model
输入Input
十条固定禁词Ten fixed banned words
过程Process
写透明规则并统计误报Write a transparent rule and count false positives
结果 / 验收Result / check
规则已足够,不训练模型The rule is sufficient; no model is trained
例子 2 · 岗位优先级Example 2 · Job priority
输入Input
历史岗位、人工优先标签Past jobs and human priority labels
过程Process
先做多数类和打分规则基线Build majority and scoring-rule baselines first
结果 / 验收Result / check
模型必须超过基线且错误可接受The model must beat baselines with acceptable errors
常见误区Common misconception

把“数据很多”当成“应该用机器学习”。大量脏数据只会让错误更稳定。

Treating “lots of data” as proof that ML is appropriate. Large dirty data only makes errors more systematic.

作品任务Portfolio task

为“岗位匹配实验室”写一页问题卡:谁在何时用预测做什么决定,错判各有什么代价。

Write a one-page problem card for the Job Match Lab: who uses the prediction, when, for what decision, and the cost of each error.

验收:Acceptance: 一位不了解项目的人能指出目标、基线、禁止用途与放弃模型的条件。A newcomer can identify the target, baseline, prohibited use, and the condition for abandoning ML.

自测:如果模型指标变高,但“机器学习到底适合解决什么问题”对应的真实决策没有改善,能否宣布成功?为什么?Self-check: If a model metric improves but the real decision behind “Introduction to machine learning” does not, can you claim success? Why?

不能。先核对数据切分、基线、错误类型和使用场景,再用“一位不了解项目的人能指出目标、基线、禁止用途与放弃模型的条件。”这样的可观察结果验收;指标只是证据之一。

No. Recheck the split, baseline, error types, and use context, then verify an observable outcome such as: A newcomer can identify the target, baseline, prohibited use, and the condition for abandoning ML. A metric is only one piece of evidence.

02

第 2 课Lesson 2

用历史看清机器学习的能力边界History of machine learning

先回答一个白话问题Start with a plain question

机器学习的发展是数据、算力、算法和评估共同演进的结果。 这节课不从算法名开始,而是先判断这个能力解决什么决策问题。

ML progress comes from the joint evolution of data, compute, algorithms, and evaluation. This lesson starts with the decision the capability supports, not an algorithm name.

类比桥梁Analogy bridge

像摄影进步不只因为镜头,还因为胶片、传感器、存储和观看方式一起变化。

Photography advanced not just through lenses, but through film, sensors, storage, and ways of viewing images.

类比边界:类比只帮助识别关系;真正系统仍由数据、代码、接口和运行环境决定。Where it breaks: The analogy only exposes relationships; the real system is determined by data, code, interfaces, and its runtime.

工程上到底发生什么What it means in engineering

历史案例用于识别反复出现的模式:能力被夸大、数据偏差被忽略、演示效果被误当成部署可靠性。

History exposes recurring patterns: overstated capability, ignored data bias, and demos mistaken for deployment reliability.

例子 1 · 垃圾邮件过滤Example 1 · Spam filtering
输入Input
带时间戳的邮件Time-stamped email
过程Process
按时间回放旧规则和新模型Replay old rules and a new model over time
结果 / 验收Result / check
概念漂移会让旧方法失效Concept drift breaks old methods
例子 2 · 招聘自动化Example 2 · Hiring automation
输入Input
历史录用记录Historical hiring records
过程Process
检查记录是否继承过去偏见Inspect whether records encode old bias
结果 / 验收Result / check
历史成功不自动等于公平目标Historical success is not automatically a fair target
常见误区Common misconception

把最新算法视作必然更好,忽略数据、指标和部署条件不同。

Assuming the newest algorithm is inherently better while ignoring changes in data, metrics, and deployment.

作品任务Portfolio task

制作一条四节点时间线,每个节点写“当时解决了什么、留下了什么新风险”。

Create a four-node timeline; for each node, state what it solved and what new risk it introduced.

验收:Acceptance: 时间线能把算法进步与数据、算力和社会影响联系起来。The timeline connects algorithmic progress with data, compute, and social impact.

自测:如果模型指标变高,但“用历史看清机器学习的能力边界”对应的真实决策没有改善,能否宣布成功?为什么?Self-check: If a model metric improves but the real decision behind “History of machine learning” does not, can you claim success? Why?

不能。先核对数据切分、基线、错误类型和使用场景,再用“时间线能把算法进步与数据、算力和社会影响联系起来。”这样的可观察结果验收;指标只是证据之一。

No. Recheck the split, baseline, error types, and use context, then verify an observable outcome such as: The timeline connects algorithmic progress with data, compute, and social impact. A metric is only one piece of evidence.

03

第 3 课Lesson 3

负责任 AI 与公平性不是上线后的装饰Building ML solutions with responsible AI

先回答一个白话问题Start with a plain question

模型会把数据收集与标签规则中的不平等带进预测。 这节课不从算法名开始,而是先判断这个能力解决什么决策问题。

Models can carry inequities from data collection and labeling into predictions. This lesson starts with the decision the capability supports, not an algorithm name.

类比桥梁Analogy bridge

像一把按成年男性手型设计的工具,对其他人“同样使用”也可能并不公平。

A tool designed around one adult male hand may be used equally yet still work unfairly for others.

类比边界:类比只帮助识别关系;真正系统仍由数据、代码、接口和运行环境决定。Where it breaks: The analogy only exposes relationships; the real system is determined by data, code, interfaces, and its runtime.

工程上到底发生什么What it means in engineering

按群体和场景拆分误差,记录敏感属性用途,加入申诉、人类复核、隐私和持续监控。

Slice errors by group and context, document sensitive-attribute use, and add appeal, human review, privacy, and monitoring.

例子 1 · 总体准确率陷阱Example 1 · Aggregate accuracy trap
输入Input
总体 92% 的模型A model with 92% overall accuracy
过程Process
按地区拆分召回率Slice recall by region
结果 / 验收Result / check
某小地区只有 55%,平均数掩盖伤害One small region has 55%; the average hid harm
例子 2 · 标签不是事实Example 2 · Labels are not facts
输入Input
主管给的“潜力”评分Manager-rated “potential”
过程Process
审计评分一致性与申诉记录Audit consistency and appeals
结果 / 验收Result / check
标签含主观偏差,不能直接当真值Labels contain subjective bias and are not ground truth
常见误区Common misconception

删除敏感属性就认为模型不会歧视;邮编、学校等代理变量仍可能重建它。

Believing that removing a sensitive field removes discrimination; proxies such as postcode or school can reconstruct it.

作品任务Portfolio task

为岗位分类器写负责任使用卡:受影响人群、关键错误、复核与申诉路径。

Write a responsible-use card for the job classifier: affected groups, critical errors, review, and appeal paths.

验收:Acceptance: 至少有一个分组指标、一个禁止自动化决策和一个真实复核入口。It contains at least one sliced metric, one prohibited automated decision, and one real review route.

自测:如果模型指标变高,但“负责任 AI 与公平性不是上线后的装饰”对应的真实决策没有改善,能否宣布成功?为什么?Self-check: If a model metric improves but the real decision behind “Building ML solutions with responsible AI” does not, can you claim success? Why?

不能。先核对数据切分、基线、错误类型和使用场景,再用“至少有一个分组指标、一个禁止自动化决策和一个真实复核入口。”这样的可观察结果验收;指标只是证据之一。

No. Recheck the split, baseline, error types, and use context, then verify an observable outcome such as: It contains at least one sliced metric, one prohibited automated decision, and one real review route. A metric is only one piece of evidence.

04

第 4 课Lesson 4

监督、无监督、半监督与强化学习地图Techniques of Machine Learning

先回答一个白话问题Start with a plain question

不同学习范式的根本差异在于系统获得什么反馈。 这节课不从算法名开始,而是先判断这个能力解决什么决策问题。

Learning paradigms differ primarily in the feedback available to the system. This lesson starts with the decision the capability supports, not an algorithm name.

类比桥梁Analogy bridge

有答案练习是监督学习,自由分组材料是无监督学习,试错得分是强化学习。

Exercises with answers resemble supervised learning, free grouping resembles unsupervised learning, and trial-and-reward resembles reinforcement learning.

类比边界:类比只帮助识别关系;真正系统仍由数据、代码、接口和运行环境决定。Where it breaks: The analogy only exposes relationships; the real system is determined by data, code, interfaces, and its runtime.

工程上到底发生什么What it means in engineering

先问是否有可靠标签、是否只需发现结构、反馈是否延迟,再选择范式;算法名排在后面。

Ask whether labels are reliable, whether structure discovery is enough, and whether feedback is delayed before choosing a paradigm.

例子 1 · 岗位类别Example 1 · Job categories
输入Input
人工标注的岗位类型Human-labeled job types
过程Process
训练分类器预测新岗位Train a classifier for new jobs
结果 / 验收Result / check
这是监督分类This is supervised classification
例子 2 · 技能群落Example 2 · Skill clusters
输入Input
只有技能向量,无类别Skill vectors without categories
过程Process
聚类后人工解释每组Cluster then interpret groups
结果 / 验收Result / check
这是无监督探索,不是发现真理This is unsupervised exploration, not truth discovery
常见误区Common misconception

把“没有标签”理解为“没有任何人工判断”;特征、距离和簇命名仍含选择。

Treating “unlabeled” as “free of human judgment”; features, distance, and cluster names still encode choices.

作品任务Portfolio task

把五个求职问题分别映射到范式,并为每个写出可获得的反馈。

Map five job-search questions to learning paradigms and state the feedback available for each.

验收:Acceptance: 每个映射都能由反馈类型解释,而不是靠关键词猜算法。Each mapping is justified by feedback type rather than algorithm-name guessing.

自测:如果模型指标变高,但“监督、无监督、半监督与强化学习地图”对应的真实决策没有改善,能否宣布成功?为什么?Self-check: If a model metric improves but the real decision behind “Techniques of Machine Learning” does not, can you claim success? Why?

不能。先核对数据切分、基线、错误类型和使用场景,再用“每个映射都能由反馈类型解释,而不是靠关键词猜算法。”这样的可观察结果验收;指标只是证据之一。

No. Recheck the split, baseline, error types, and use context, then verify an observable outcome such as: Each mapping is justified by feedback type rather than algorithm-name guessing. A metric is only one piece of evidence.

第二册 · 第 5–8 课Volume 2 · Lessons 5–8

回归:从数据到概率Regression: from data to probability

用同一验证协议理解连续预测与逻辑回归。

Use one validation protocol to understand continuous prediction and logistic regression.

本册作品里程碑Portfolio milestone

交付可复现回归管线、残差报告和阈值面板。

Deliver a reproducible regression pipeline, residual report, and threshold panel.

05

第 5 课Lesson 5

用 Python 与 scikit-learn 建第一条可复现管线Get started with Python and Scikit-learn for regression models

先回答一个白话问题Start with a plain question

工具环境和数据管线决定实验能否被复现。 这节课不从算法名开始,而是先判断这个能力解决什么决策问题。

The environment and data pipeline determine whether an experiment can be reproduced. This lesson starts with the decision the capability supports, not an algorithm name.

类比桥梁Analogy bridge

实验环境像烘焙配方:版本、份量和步骤缺一项,别人烤不出同一结果。

An experiment environment is like a baking recipe: versions, quantities, and steps are all required for reproduction.

类比边界:类比只帮助识别关系;真正系统仍由数据、代码、接口和运行环境决定。Where it breaks: The analogy only exposes relationships; the real system is determined by data, code, interfaces, and its runtime.

工程上到底发生什么What it means in engineering

隔离环境、固定随机种子、记录依赖,并把预处理与模型放进同一 Pipeline。

Isolate the environment, fix seeds, record dependencies, and place preprocessing and the model in one Pipeline.

例子 1 · 环境漂移Example 1 · Environment drift
输入Input
两台电脑的依赖版本Dependency versions on two machines
过程Process
重建环境并运行同一 notebookRebuild and run the same notebook
结果 / 验收Result / check
结果差异可定位到版本和种子Differences trace to versions and seeds
例子 2 · 预处理遗漏Example 2 · Lost preprocessing
输入Input
训练时标准化的数据Data standardized during training
过程Process
把标准化放入 Pipeline 再预测Put scaling inside the Pipeline before prediction
结果 / 验收Result / check
线上不会忘记相同步骤Serving cannot omit the same step
常见误区Common misconception

把 notebook 从头跑通当成可复现,却没有清空状态或锁定依赖。

Calling a notebook reproducible without clearing hidden state or pinning dependencies.

作品任务Portfolio task

建立 env、requirements、seed 和 smoke test,训练一个均值基线 Pipeline。

Create the environment, requirements, seed, and smoke test, then train a mean-baseline Pipeline.

验收:Acceptance: 从空环境按 README 一次完成安装、训练和预测。A clean environment can install, train, and predict by following the README once.

自测:如果模型指标变高,但“用 Python 与 scikit-learn 建第一条可复现管线”对应的真实决策没有改善,能否宣布成功?为什么?Self-check: If a model metric improves but the real decision behind “Get started with Python and Scikit-learn for regression models” does not, can you claim success? Why?

不能。先核对数据切分、基线、错误类型和使用场景,再用“从空环境按 README 一次完成安装、训练和预测。”这样的可观察结果验收;指标只是证据之一。

No. Recheck the split, baseline, error types, and use context, then verify an observable outcome such as: A clean environment can install, train, and predict by following the README once. A metric is only one piece of evidence.

对应来源单元:Source unit: 官方课程 · 2-Regression / 1-ToolsOfficial lesson · 2-Regression / 1-Tools
06

第 6 课Lesson 6

回归前先准备、观察和质疑数据Prepare and visualize data for regression

先回答一个白话问题Start with a plain question

回归模型只能学习你给它的数值表示和样本范围。 这节课不从算法名开始,而是先判断这个能力解决什么决策问题。

A regression model can only learn from the numeric representation and sample range it receives. This lesson starts with the decision the capability supports, not an algorithm name.

类比桥梁Analogy bridge

像量体裁衣:尺子单位错了、只量一种身材,再好的裁缝也会做错。

It is like tailoring: wrong units or one body type will defeat even a skilled tailor.

类比边界:类比只帮助识别关系;真正系统仍由数据、代码、接口和运行环境决定。Where it breaks: The analogy only exposes relationships; the real system is determined by data, code, interfaces, and its runtime.

工程上到底发生什么What it means in engineering

审计分布、单位、缺失、异常、重复与采样偏差;可视化用于发现问题,不用于挑好看的相关性。

Audit distributions, units, missingness, outliers, duplicates, and sampling bias. Visualize to find problems, not attractive correlations.

例子 1 · 单位混用Example 1 · Mixed units
输入Input
月薪与年薪同列Monthly and annual salaries in one column
过程Process
统一单位并保留原始字段Normalize units and preserve the raw field
结果 / 验收Result / check
分布不再出现假异常The distribution loses fake outliers
例子 2 · 幸存者偏差Example 2 · Survivorship bias
输入Input
只含已投递岗位Only applied-to jobs
过程Process
比较全部收藏与已投递样本Compare all saved and applied jobs
结果 / 验收Result / check
发现数据漏掉被主动放弃的岗位Data omitted jobs deliberately skipped
常见误区Common misconception

删除所有异常值会让数据更“干净”,也可能删掉最值得解释的真实情况。

Removing every outlier may clean the data while deleting the most informative real cases.

作品任务Portfolio task

为岗位薪资数据写数据字典和审计报告,列出三项不能由图表确认的假设。

Write a data dictionary and audit report for salary data, including three assumptions plots cannot confirm.

验收:Acceptance: 每列有单位、来源、缺失策略;清洗前后行数和分布可比较。Every column has units, source, and missingness policy; row counts and distributions are comparable before and after cleaning.

自测:如果模型指标变高,但“回归前先准备、观察和质疑数据”对应的真实决策没有改善,能否宣布成功?为什么?Self-check: If a model metric improves but the real decision behind “Prepare and visualize data for regression” does not, can you claim success? Why?

不能。先核对数据切分、基线、错误类型和使用场景,再用“每列有单位、来源、缺失策略;清洗前后行数和分布可比较。”这样的可观察结果验收;指标只是证据之一。

No. Recheck the split, baseline, error types, and use context, then verify an observable outcome such as: Every column has units, source, and missingness policy; row counts and distributions are comparable before and after cleaning. A metric is only one piece of evidence.

对应来源单元:Source unit: 官方课程 · 2-Regression / 2-DataOfficial lesson · 2-Regression / 2-Data
07

第 7 课Lesson 7

用四种回归看清关系、误差与过拟合Regression four ways

先回答一个白话问题Start with a plain question

回归是在明确损失下估计连续结果,不是寻找绝对因果规律。 这节课不从算法名开始,而是先判断这个能力解决什么决策问题。

Regression estimates a continuous outcome under a defined loss; it does not discover absolute causal laws. This lesson starts with the decision the capability supports, not an algorithm name.

类比桥梁Analogy bridge

像用不同弯曲程度的尺子贴合散点;越能弯不一定越能预测新点。

It is like fitting rulers with different flexibility to scattered points; more bend does not guarantee better prediction.

类比边界:类比只帮助识别关系;真正系统仍由数据、代码、接口和运行环境决定。Where it breaks: The analogy only exposes relationships; the real system is determined by data, code, interfaces, and its runtime.

工程上到底发生什么What it means in engineering

比较线性、多项式、决策树/森林等方法,使用留出集和残差判断偏差与方差。

Compare linear, polynomial, tree, and forest approaches; use holdout data and residuals to assess bias and variance.

例子 1 · 均值基线Example 1 · Mean baseline
输入Input
训练集薪资Training salaries
过程Process
所有样本预测训练中位数Predict the training median for every case
结果 / 验收Result / check
任何复杂模型先超过它Every complex model must beat it
例子 2 · 多项式过拟合Example 2 · Polynomial overfit
输入Input
少量经验—薪资点Few experience-salary points
过程Process
逐步提高次数并看验证误差Raise degree and inspect validation error
结果 / 验收Result / check
训练更好、验证变坏时停止Stop when training improves but validation worsens
常见误区Common misconception

把回归系数写成“经验每增加一年一定涨薪”,忽略混杂因素和样本范围。

Reading a coefficient as “one year of experience causes this raise,” ignoring confounding and sample range.

作品任务Portfolio task

训练三个回归基线,画残差,并为最差的十个预测逐条写原因。

Train three regression baselines, plot residuals, and explain the ten worst predictions.

验收:Acceptance: 报告同时给 MAE、基线、残差模式和外推边界。The report includes MAE, baseline, residual pattern, and extrapolation boundary.

自测:如果模型指标变高,但“用四种回归看清关系、误差与过拟合”对应的真实决策没有改善,能否宣布成功?为什么?Self-check: If a model metric improves but the real decision behind “Regression four ways” does not, can you claim success? Why?

不能。先核对数据切分、基线、错误类型和使用场景,再用“报告同时给 MAE、基线、残差模式和外推边界。”这样的可观察结果验收;指标只是证据之一。

No. Recheck the split, baseline, error types, and use context, then verify an observable outcome such as: The report includes MAE, baseline, residual pattern, and extrapolation boundary. A metric is only one piece of evidence.

对应来源单元:Source unit: 官方课程 · 2-Regression / 3-LinearOfficial lesson · 2-Regression / 3-Linear
08

第 8 课Lesson 8

逻辑回归为什么名字有回归却常做分类Logistic regression to predict categories

先回答一个白话问题Start with a plain question

逻辑回归把线性分数压成概率,再用阈值做类别决定。 这节课不从算法名开始,而是先判断这个能力解决什么决策问题。

Logistic regression maps a linear score to a probability, then uses a threshold for a class decision. This lesson starts with the decision the capability supports, not an algorithm name.

类比桥梁Analogy bridge

像风险温度计先给连续刻度,是否报警由业务阈值决定。

It is like a risk gauge with a continuous scale; the business threshold decides when to raise an alarm.

类比边界:类比只帮助识别关系;真正系统仍由数据、代码、接口和运行环境决定。Where it breaks: The analogy only exposes relationships; the real system is determined by data, code, interfaces, and its runtime.

工程上到底发生什么What it means in engineering

特征缩放、概率校准、阈值和类别权重都会改变实际错误;不要只看默认 0.5。

Scaling, calibration, thresholds, and class weights change real errors; do not rely blindly on 0.5.

例子 1 · 阈值权衡Example 1 · Threshold trade-off
输入Input
岗位匹配概率Job-match probabilities
过程Process
比较 0.3/0.5/0.7 的混淆矩阵Compare confusion matrices at 0.3/0.5/0.7
结果 / 验收Result / check
按漏掉好岗位的代价选阈值Choose based on the cost of missing good jobs
例子 2 · 概率校准Example 2 · Probability calibration
输入Input
100 个约 0.8 的预测100 predictions near 0.8
过程Process
统计实际正例比例Measure observed positives
结果 / 验收Result / check
若只有 50% 则概率不可信If only 50% are positive, probabilities are unreliable
常见误区Common misconception

把 0.51 与 0.99 都写成“正类”,丢失置信差异和复核优先级。

Reducing both 0.51 and 0.99 to “positive,” losing confidence and review priority.

作品任务Portfolio task

做可调阈值面板,展示精确率、召回率和待人工复核数量如何变化。

Build a threshold panel showing changes in precision, recall, and human-review volume.

验收:Acceptance: 用户能根据书面错误成本选择阈值,不被单一准确率牵着走。A user can select a threshold from written error costs rather than one accuracy number.

自测:如果模型指标变高,但“逻辑回归为什么名字有回归却常做分类”对应的真实决策没有改善,能否宣布成功?为什么?Self-check: If a model metric improves but the real decision behind “Logistic regression to predict categories” does not, can you claim success? Why?

不能。先核对数据切分、基线、错误类型和使用场景,再用“用户能根据书面错误成本选择阈值,不被单一准确率牵着走。”这样的可观察结果验收;指标只是证据之一。

No. Recheck the split, baseline, error types, and use context, then verify an observable outcome such as: A user can select a threshold from written error costs rather than one accuracy number. A metric is only one piece of evidence.

对应来源单元:Source unit: 官方课程 · 2-Regression / 4-LogisticOfficial lesson · 2-Regression / 4-Logistic

第三册 · 第 9 课Volume 3 · Lesson 9

模型不是产品A model is not a product

把模型接入有校验、有版本的最小 Web 应用。

Connect the model to a validated, versioned web app.

本册作品里程碑Portfolio milestone

做出只读预测演示和训练—线上一致性测试。

Build a read-only demo and training-serving parity test.

09

第 9 课Lesson 9

把训练好的模型接进最小 Web 应用Build a Web App to use an ML Model

先回答一个白话问题Start with a plain question

模型文件只是组件,产品还需要输入校验、预处理、接口和反馈。 这节课不从算法名开始,而是先判断这个能力解决什么决策问题。

A model artifact is only a component; a product still needs validation, preprocessing, an interface, and feedback. This lesson starts with the decision the capability supports, not an algorithm name.

类比桥梁Analogy bridge

发动机不是汽车;方向盘、刹车、仪表和维修记录同样决定能否上路。

An engine is not a car; steering, brakes, gauges, and service records also determine roadworthiness.

类比边界:类比只帮助识别关系;真正系统仍由数据、代码、接口和运行环境决定。Where it breaks: The analogy only exposes relationships; the real system is determined by data, code, interfaces, and its runtime.

工程上到底发生什么What it means in engineering

保存包含预处理的 Pipeline,定义输入 schema,拒绝越界值,记录模型版本并显示不确定性。

Save a Pipeline with preprocessing, define an input schema, reject invalid values, record the model version, and expose uncertainty.

例子 1 · 缺失预处理Example 1 · Missing preprocessing
输入Input
网页原始输入Raw form input
过程Process
与训练 Pipeline 一起预测Predict through the training Pipeline
结果 / 验收Result / check
网页与 notebook 结果一致Web and notebook results match
例子 2 · 越界输入Example 2 · Out-of-range input
输入Input
经验年限 -3Experience of -3 years
过程Process
schema 校验后返回可读错误Schema validation returns a readable error
结果 / 验收Result / check
模型不接收荒谬数值The model never receives absurd values
常见误区Common misconception

页面能显示预测就算部署成功,却没有检查训练与线上特征处理是否一致。

Calling deployment successful because a page shows a prediction, without checking training-serving feature parity.

作品任务Portfolio task

做一个只读演示页:输入岗位特征,显示预测、模型版本、范围和免责声明。

Build a read-only demo: enter job features and show the prediction, model version, scope, and disclaimer.

验收:Acceptance: 相同样本在离线测试和网页得到同一结果;无效输入不会调用模型。The same sample gives the same offline and web result; invalid inputs never reach the model.

自测:如果模型指标变高,但“把训练好的模型接进最小 Web 应用”对应的真实决策没有改善,能否宣布成功?为什么?Self-check: If a model metric improves but the real decision behind “Build a Web App to use an ML Model” does not, can you claim success? Why?

不能。先核对数据切分、基线、错误类型和使用场景,再用“相同样本在离线测试和网页得到同一结果;无效输入不会调用模型。”这样的可观察结果验收;指标只是证据之一。

No. Recheck the split, baseline, error types, and use context, then verify an observable outcome such as: The same sample gives the same offline and web result; invalid inputs never reach the model. A metric is only one piece of evidence.

对应来源单元:Source unit: 官方课程 · 3-Web-App / 1-Web-AppOfficial lesson · 3-Web-App / 1-Web-App

第四册 · 第 10–13 课Volume 4 · Lessons 10–13

分类:标签、比较、调参和交付Classification: labels, comparison, tuning, delivery

让类别边界和错误成本比排行榜更重要。

Make class boundaries and error costs more important than leaderboards.

本册作品里程碑Portfolio milestone

交付岗位分类器、标注指南、错误反馈与模型卡。

Deliver the classifier, labeling guide, correction route, and model card.

10

第 10 课Lesson 10

分类任务:类别、标签与错误成本Introduction to classification

先回答一个白话问题Start with a plain question

分类把样本分到离散类别,真正困难常在标签定义。 这节课不从算法名开始,而是先判断这个能力解决什么决策问题。

Classification assigns samples to discrete classes; the hard part is often defining the labels. This lesson starts with the decision the capability supports, not an algorithm name.

类比桥梁Analogy bridge

像邮件分拣:类别边界必须让不同分拣员大致一致。

It is like sorting mail: category boundaries must be consistent across different sorters.

类比边界:类比只帮助识别关系;真正系统仍由数据、代码、接口和运行环境决定。Where it breaks: The analogy only exposes relationships; the real system is determined by data, code, interfaces, and its runtime.

工程上到底发生什么What it means in engineering

写标注指南、测标注一致性、分层切分,并用混淆矩阵表达不同错误。

Write labeling guidance, measure agreement, stratify splits, and use a confusion matrix to express different errors.

例子 1 · 模糊标签Example 1 · Ambiguous label
输入Input
“AI 相关岗位”文本Text for “AI-related role”
过程Process
两人独立标注后比较分歧Two people label independently and compare
结果 / 验收Result / check
先修规则再扩数据Fix guidance before expanding data
例子 2 · 类别不均衡Example 2 · Class imbalance
输入Input
90% 非 AI、10% AI90% non-AI, 10% AI
过程Process
多数类基线与分层切分Majority baseline and stratified split
结果 / 验收Result / check
90% 准确率可能毫无价值90% accuracy can be useless
常见误区Common misconception

把现有文件夹名直接当标签,默认历史归档规则正确且一致。

Using existing folder names as labels and assuming historical filing rules are correct and consistent.

作品任务Portfolio task

为岗位类型写标注手册,独立标 50 条并记录分歧类型。

Write a job-type labeling guide, label 50 items independently, and record disagreement types.

验收:Acceptance: 另一位标注者能按指南达到约定一致性,无法判断项有明确出口。Another labeler reaches agreed consistency, with a clear route for undecidable cases.

自测:如果模型指标变高,但“分类任务:类别、标签与错误成本”对应的真实决策没有改善,能否宣布成功?为什么?Self-check: If a model metric improves but the real decision behind “Introduction to classification” does not, can you claim success? Why?

不能。先核对数据切分、基线、错误类型和使用场景,再用“另一位标注者能按指南达到约定一致性,无法判断项有明确出口。”这样的可观察结果验收;指标只是证据之一。

No. Recheck the split, baseline, error types, and use context, then verify an observable outcome such as: Another labeler reaches agreed consistency, with a clear route for undecidable cases. A metric is only one piece of evidence.

11

第 11 课Lesson 11

比较分类器,不靠排行榜选模型Cuisine classifiers 1

先回答一个白话问题Start with a plain question

不同分类器带着不同假设,比较必须使用同一数据与验证协议。 这节课不从算法名开始,而是先判断这个能力解决什么决策问题。

Classifiers carry different assumptions; comparison requires the same data and validation protocol. This lesson starts with the decision the capability supports, not an algorithm name.

类比桥梁Analogy bridge

像让几位医生看同一批病例、用同一诊断标准,才有公平比较。

It is like giving several doctors the same cases and diagnostic rules for a fair comparison.

类比边界:类比只帮助识别关系;真正系统仍由数据、代码、接口和运行环境决定。Where it breaks: The analogy only exposes relationships; the real system is determined by data, code, interfaces, and its runtime.

工程上到底发生什么What it means in engineering

建立 Pipeline,固定切分和指标,对逻辑回归、树、SVM 等做交叉验证与误差分析。

Build Pipelines, fix splits and metrics, and compare logistic, tree, and SVM approaches with cross-validation and error analysis.

例子 1 · 公平比较Example 1 · Fair comparison
输入Input
同一训练/验证集The same train/validation split
过程Process
每个模型各自 PipelineA Pipeline for each model
结果 / 验收Result / check
结果差来自模型而非预处理遗漏Differences come from models, not missing preprocessing
例子 2 · 小样本波动Example 2 · Small-sample variance
输入Input
一次 82% 对 84%One score of 82% vs 84%
过程Process
多折交叉验证比较分布Compare fold distributions
结果 / 验收Result / check
差异可能不稳定The difference may be unstable
常见误区Common misconception

只跑一次随机切分,0.5% 领先就宣布冠军。

Running one random split and declaring a winner from a 0.5% lead.

作品任务Portfolio task

建立模型比较表:均值、波动、训练时间、推断时间、可解释性和关键错误。

Create a comparison table covering mean, variance, train time, inference time, interpretability, and critical errors.

验收:Acceptance: 选择理由能回到项目约束,而不是只写最高分。The choice traces back to project constraints rather than the highest score alone.

自测:如果模型指标变高,但“比较分类器,不靠排行榜选模型”对应的真实决策没有改善,能否宣布成功?为什么?Self-check: If a model metric improves but the real decision behind “Cuisine classifiers 1” does not, can you claim success? Why?

不能。先核对数据切分、基线、错误类型和使用场景,再用“选择理由能回到项目约束,而不是只写最高分。”这样的可观察结果验收;指标只是证据之一。

No. Recheck the split, baseline, error types, and use context, then verify an observable outcome such as: The choice traces back to project constraints rather than the highest score alone. A metric is only one piece of evidence.

12

第 12 课Lesson 12

继续比较分类器:参数、边界与验证Cuisine classifiers 2

先回答一个白话问题Start with a plain question

调参是在既定验证协议内探索容量,不是反复偷看测试集。 这节课不从算法名开始,而是先判断这个能力解决什么决策问题。

Hyperparameter tuning explores capacity within a validation protocol; it is not repeated peeking at the test set. This lesson starts with the decision the capability supports, not an algorithm name.

类比桥梁Analogy bridge

测试集像密封期末卷;练习时反复看答案,最后分数就不再可信。

The test set is a sealed final exam; repeated peeking destroys its credibility.

类比边界:类比只帮助识别关系;真正系统仍由数据、代码、接口和运行环境决定。Where it breaks: The analogy only exposes relationships; the real system is determined by data, code, interfaces, and its runtime.

工程上到底发生什么What it means in engineering

训练/验证用于选择,测试只用于最后一次估计;搜索空间、预算和随机性要记录。

Use train/validation for selection and test once at the end; record the search space, budget, and randomness.

例子 1 · 深度调参Example 1 · Tree depth tuning
输入Input
深度 2–30Depth 2–30
过程Process
交叉验证选择后锁定Select via CV then lock it
结果 / 验收Result / check
只在最终测试一次Use the test set once
例子 2 · 搜索预算Example 2 · Search budget
输入Input
1000 组参数1,000 parameter sets
过程Process
先用学习曲线缩小范围Narrow the range with learning curves
结果 / 验收Result / check
计算预算有上限且可复现Compute budget is bounded and reproducible
常见误区Common misconception

把测试集分数反馈给下一轮调参,测试集逐渐变成训练数据。

Feeding test scores into the next tuning round until the test set becomes training data.

作品任务Portfolio task

为两个模型写有限搜索计划,并画验证分数随容量变化曲线。

Write a bounded search plan for two models and plot validation score against capacity.

验收:Acceptance: 测试集只评估锁定方案一次;搜索范围和选择规则预先写明。The test set evaluates the locked solution once; search range and selection rule are predeclared.

自测:如果模型指标变高,但“继续比较分类器:参数、边界与验证”对应的真实决策没有改善,能否宣布成功?为什么?Self-check: If a model metric improves but the real decision behind “Cuisine classifiers 2” does not, can you claim success? Why?

不能。先核对数据切分、基线、错误类型和使用场景,再用“测试集只评估锁定方案一次;搜索范围和选择规则预先写明。”这样的可观察结果验收;指标只是证据之一。

No. Recheck the split, baseline, error types, and use context, then verify an observable outcome such as: The test set evaluates the locked solution once; search range and selection rule are predeclared. A metric is only one piece of evidence.

13

第 13 课Lesson 13

交付一个分类推荐 Web 应用Build a Cuisine Recommender Web App

先回答一个白话问题Start with a plain question

分类模型变成应用后,输入体验和错误反馈会改变实际价值。 这节课不从算法名开始,而是先判断这个能力解决什么决策问题。

Once a classifier becomes an app, input UX and error feedback change its real value. This lesson starts with the decision the capability supports, not an algorithm name.

类比桥梁Analogy bridge

像把实验室测量仪交给普通人,刻度、说明和误操作保护决定能否使用。

It is like handing a lab instrument to the public; scales, instructions, and misuse protection determine usability.

类比边界:类比只帮助识别关系;真正系统仍由数据、代码、接口和运行环境决定。Where it breaks: The analogy only exposes relationships; the real system is determined by data, code, interfaces, and its runtime.

工程上到底发生什么What it means in engineering

使用模型概率和 top-k,解释输入限制,收集纠正反馈但不自动把反馈当真标签。

Use probabilities and top-k, explain input limits, and collect correction feedback without treating it automatically as ground truth.

例子 1 · Top-k 推荐Example 1 · Top-k recommendation
输入Input
一段混合技能文本Mixed-skill text
过程Process
返回前三类与概率Return top three classes and probabilities
结果 / 验收Result / check
低置信时请求人工确认Ask for confirmation at low confidence
例子 2 · 反馈回路Example 2 · Feedback loop
输入Input
用户点击“分类错了”User clicks “wrong class”
过程Process
保存原输入、预测、纠正和版本Store input, prediction, correction, and version
结果 / 验收Result / check
反馈先审查再入训练集Review feedback before training use
常见误区Common misconception

把用户每次纠正都立即加入训练,恶意或误点会污染数据。

Immediately training on every user correction, allowing mistakes or abuse to poison the data.

作品任务Portfolio task

交付分类演示页、模型卡、错误反馈入口和十条端到端验收样本。

Deliver the classification demo, model card, correction route, and ten end-to-end acceptance cases.

验收:Acceptance: 输入、预测、概率、版本和限制清楚;反馈可追溯且不会自动训练。Input, prediction, probability, version, and limits are clear; feedback is traceable and not auto-trained.

自测:如果模型指标变高,但“交付一个分类推荐 Web 应用”对应的真实决策没有改善,能否宣布成功?为什么?Self-check: If a model metric improves but the real decision behind “Build a Cuisine Recommender Web App” does not, can you claim success? Why?

不能。先核对数据切分、基线、错误类型和使用场景,再用“输入、预测、概率、版本和限制清楚;反馈可追溯且不会自动训练。”这样的可观察结果验收;指标只是证据之一。

No. Recheck the split, baseline, error types, and use context, then verify an observable outcome such as: Input, prediction, probability, version, and limits are clear; feedback is traceable and not auto-trained. A metric is only one piece of evidence.

第五册 · 第 14–15 课Volume 5 · Lessons 14–15

聚类:探索结构,不发明真相Clustering: explore structure, do not invent truth

从表示、距离、k 和稳定性理解无监督分组。

Understand unsupervised grouping through representation, distance, k, and stability.

本册作品里程碑Portfolio milestone

交付带代表样本与稳定性说明的技能簇。

Deliver skill clusters with representatives and stability notes.

14

第 14 课Lesson 14

聚类前先把距离和表示想清楚Introduction to clustering

先回答一个白话问题Start with a plain question

聚类结果来自表示、距离和算法选择,不是数据自带的天然类别。 这节课不从算法名开始,而是先判断这个能力解决什么决策问题。

Clusters arise from representation, distance, and algorithm choices; they are not natural labels embedded in data. This lesson starts with the decision the capability supports, not an algorithm name.

类比桥梁Analogy bridge

按颜色摆水果与按大小摆水果都会得到合理分组,问题决定哪种距离有用。

Grouping fruit by color or by size can both be valid; the question decides which distance matters.

类比边界:类比只帮助识别关系;真正系统仍由数据、代码、接口和运行环境决定。Where it breaks: The analogy only exposes relationships; the real system is determined by data, code, interfaces, and its runtime.

工程上到底发生什么What it means in engineering

标准化特征、可视化候选结构、检查异常与高维失真,并用业务问题解释簇。

Scale features, visualize candidate structure, inspect outliers and high-dimensional distortion, and interpret clusters through the business question.

例子 1 · 尺度支配Example 1 · Scale dominance
输入Input
薪资 10000–50000 与布尔远程Salary 10k–50k plus remote boolean
过程Process
比较标准化前后距离Compare distances before and after scaling
结果 / 验收Result / check
未缩放时薪资淹没远程信息Salary overwhelms remote status before scaling
例子 2 · 二维投影Example 2 · 2-D projection
输入Input
50 维技能向量50-D skill vectors
过程Process
用 PCA 投影仅作观察Use PCA projection for inspection only
结果 / 验收Result / check
图上重叠不等于原空间无结构Overlap in the plot does not prove no structure
常见误区Common misconception

二维散点看见三个团就确定 k=3,忽略投影失真和稳定性。

Fixing k=3 from three blobs in a 2-D plot while ignoring projection distortion and stability.

作品任务Portfolio task

用三种表示画同一岗位数据,并写出每种表示放大和丢失了什么。

Visualize the same jobs under three representations and state what each emphasizes and loses.

验收:Acceptance: 分组假设能由业务问题、尺度处理和代表样本共同解释。Grouping assumptions are supported by the question, scaling, and representative samples.

自测:如果模型指标变高,但“聚类前先把距离和表示想清楚”对应的真实决策没有改善,能否宣布成功?为什么?Self-check: If a model metric improves but the real decision behind “Introduction to clustering” does not, can you claim success? Why?

不能。先核对数据切分、基线、错误类型和使用场景,再用“分组假设能由业务问题、尺度处理和代表样本共同解释。”这样的可观察结果验收;指标只是证据之一。

No. Recheck the split, baseline, error types, and use context, then verify an observable outcome such as: Grouping assumptions are supported by the question, scaling, and representative samples. A metric is only one piece of evidence.

对应来源单元:Source unit: 官方课程 · 5-Clustering / 1-VisualizeOfficial lesson · 5-Clustering / 1-Visualize
15

第 15 课Lesson 15

K-Means:质心、k 与稳定性K-Means clustering

先回答一个白话问题Start with a plain question

K-Means 反复分配到最近质心并更新质心,适合近似球状数值簇。 这节课不从算法名开始,而是先判断这个能力解决什么决策问题。

K-Means alternates nearest-centroid assignment and centroid updates, favoring roughly spherical numeric clusters. This lesson starts with the decision the capability supports, not an algorithm name.

类比桥梁Analogy bridge

像不断移动几个集合点,让每个人走向最近点,直到大家不再换队。

It is like moving meeting points and reassigning people to the nearest one until assignments stabilize.

类比边界:类比只帮助识别关系;真正系统仍由数据、代码、接口和运行环境决定。Where it breaks: The analogy only exposes relationships; the real system is determined by data, code, interfaces, and its runtime.

工程上到底发生什么What it means in engineering

多次初始化、缩放、肘部/轮廓指标和人工解释共同选择 k;检查小簇和不稳定样本。

Use multiple initializations, scaling, elbow/silhouette measures, and human interpretation to choose k; inspect tiny and unstable clusters.

例子 1 · 随机初始化Example 1 · Random initialization
输入Input
同一数据不同 seedSame data with different seeds
过程Process
运行 20 次比较簇稳定性Run 20 times and compare stability
结果 / 验收Result / check
不稳定样本单独标记Flag unstable samples
例子 2 · 质心解释Example 2 · Centroid interpretation
输入Input
每簇平均技能权重Mean skill weights per cluster
过程Process
查看质心与代表岗位Inspect centroid and representative jobs
结果 / 验收Result / check
簇名来自证据而非编号Names come from evidence, not cluster IDs
常见误区Common misconception

把 cluster 0 叫“低端岗位”、cluster 1 叫“高端岗位”,给无序编号强加价值判断。

Calling cluster 0 “low-end” and cluster 1 “high-end,” imposing value on arbitrary IDs.

作品任务Portfolio task

为岗位技能聚类比较 k=2–8,报告稳定性、代表样本和无法解释的簇。

Compare k=2–8 for job-skill clustering and report stability, representatives, and uninterpretable clusters.

验收:Acceptance: 选择 k 的理由不只是一张肘部图,且簇名可由样本反驳。The choice of k rests on more than an elbow plot, and cluster names are falsifiable from samples.

自测:如果模型指标变高,但“K-Means:质心、k 与稳定性”对应的真实决策没有改善,能否宣布成功?为什么?Self-check: If a model metric improves but the real decision behind “K-Means clustering” does not, can you claim success? Why?

不能。先核对数据切分、基线、错误类型和使用场景,再用“选择 k 的理由不只是一张肘部图,且簇名可由样本反驳。”这样的可观察结果验收;指标只是证据之一。

No. Recheck the split, baseline, error types, and use context, then verify an observable outcome such as: The choice of k rests on more than an elbow plot, and cluster names are falsifiable from samples. A metric is only one piece of evidence.

对应来源单元:Source unit: 官方课程 · 5-Clustering / 2-K-MeansOfficial lesson · 5-Clustering / 2-K-Means

第六册 · 第 16–20 课Volume 6 · Lessons 16–20

NLP:从文本表示到错误分析NLP: representation to error analysis

把语言、标签和领域变化纳入文本模型。

Include language, labels, and domain shift in text models.

本册作品里程碑Portfolio milestone

交付中英文本预处理契约、压力集和错误卡。

Deliver a bilingual preprocessing contract, stress set, and error cards.

16

第 16 课Lesson 16

自然语言处理:文本怎样变成可计算表示Introduction to natural language processing

先回答一个白话问题Start with a plain question

NLP 把语言任务转成可评估的表示与预测问题。 这节课不从算法名开始,而是先判断这个能力解决什么决策问题。

NLP turns language tasks into evaluable representation and prediction problems. This lesson starts with the decision the capability supports, not an algorithm name.

类比桥梁Analogy bridge

像图书馆先分词编目,再按索引查找;索引帮助定位,却不等于完整理解。

It is like tokenizing and cataloging a library before retrieval; the index helps locate but is not full understanding.

类比边界:类比只帮助识别关系;真正系统仍由数据、代码、接口和运行环境决定。Where it breaks: The analogy only exposes relationships; the real system is determined by data, code, interfaces, and its runtime.

工程上到底发生什么What it means in engineering

定义文本单位、规范化、词表、特征与标签;语言、领域和时间变化都会影响结果。

Define text units, normalization, vocabulary, features, and labels; language, domain, and time shifts all matter.

例子 1 · 分词差异Example 1 · Tokenization differences
输入Input
“C++/C# 开发”“C++/C# developer”
过程Process
比较空格切分与领域 tokenizerCompare whitespace and domain tokenizers
结果 / 验收Result / check
空格法破坏技能名Whitespace breaks skill names
例子 2 · 领域迁移Example 2 · Domain shift
输入Input
酒店评论训练集Hotel-review training set
过程Process
直接预测招聘文本情感Predict sentiment on job text
结果 / 验收Result / check
词义不同导致性能崩溃Different meanings cause failure
常见误区Common misconception

把“文本转成数字”当成中性步骤,忽略分词和词表会决定哪些差异可见。

Treating text-to-number conversion as neutral while tokenization and vocabulary decide which distinctions are visible.

作品任务Portfolio task

为中英混合岗位文本写预处理契约,并保留三条会被普通分词破坏的样本。

Write a preprocessing contract for mixed Chinese-English job text and keep three adversarial tokenization samples.

验收:Acceptance: 同一文本每次得到相同 tokens;技能符号、否定和空文本都有测试。The same text yields the same tokens; skill symbols, negation, and empty text are tested.

自测:如果模型指标变高,但“自然语言处理:文本怎样变成可计算表示”对应的真实决策没有改善,能否宣布成功?为什么?Self-check: If a model metric improves but the real decision behind “Introduction to natural language processing” does not, can you claim success? Why?

不能。先核对数据切分、基线、错误类型和使用场景,再用“同一文本每次得到相同 tokens;技能符号、否定和空文本都有测试。”这样的可观察结果验收;指标只是证据之一。

No. Recheck the split, baseline, error types, and use context, then verify an observable outcome such as: The same text yields the same tokens; skill symbols, negation, and empty text are tested. A metric is only one piece of evidence.

17

第 17 课Lesson 17

常见 NLP 任务与选择路线Common NLP tasks and techniques

先回答一个白话问题Start with a plain question

分类、实体抽取、摘要、翻译和生成有不同输出与评估方式。 这节课不从算法名开始,而是先判断这个能力解决什么决策问题。

Classification, entity extraction, summarization, translation, and generation have different outputs and evaluations. This lesson starts with the decision the capability supports, not an algorithm name.

类比桥梁Analogy bridge

像文书团队有分拣员、摘录员、翻译员和撰稿员,不能用同一验收表。

A document team has sorters, extractors, translators, and writers; one checklist cannot evaluate all roles.

类比边界:类比只帮助识别关系;真正系统仍由数据、代码、接口和运行环境决定。Where it breaks: The analogy only exposes relationships; the real system is determined by data, code, interfaces, and its runtime.

工程上到底发生什么What it means in engineering

先写输入输出 schema 和失败示例,再选择规则、传统 ML 或生成模型。

Write the input/output schema and failure cases before choosing rules, classic ML, or generative models.

例子 1 · 实体抽取Example 1 · Entity extraction
输入Input
岗位描述Job description
过程Process
抽取技能、地点、薪资并保留原文跨度Extract skill, location, salary with source spans
结果 / 验收Result / check
字段可验证且可追溯Fields are verifiable and traceable
例子 2 · 摘要Example 2 · Summarization
输入Input
2000 字职位说明2,000-word posting
过程Process
压缩为职责/要求/待遇Compress into duties/requirements/benefits
结果 / 验收Result / check
不得虚构缺失待遇Missing benefits must not be invented
常见误区Common misconception

看到文本就用大模型生成答案,忽略规则或分类器可能更便宜、更可验证。

Using a generative model for every text task while rules or classifiers may be cheaper and more verifiable.

作品任务Portfolio task

为五类 NLP 需求写输入、输出、自动指标和人工检查,选最简单可行方案。

For five NLP needs, define input, output, automatic metric, and human check, then choose the simplest viable approach.

验收:Acceptance: 每个任务的输出结构和关键错误不同,方案选择有成本与风险理由。Each task has distinct output and critical errors, with cost/risk justification for the method.

自测:如果模型指标变高,但“常见 NLP 任务与选择路线”对应的真实决策没有改善,能否宣布成功?为什么?Self-check: If a model metric improves but the real decision behind “Common NLP tasks and techniques” does not, can you claim success? Why?

不能。先核对数据切分、基线、错误类型和使用场景,再用“每个任务的输出结构和关键错误不同,方案选择有成本与风险理由。”这样的可观察结果验收;指标只是证据之一。

No. Recheck the split, baseline, error types, and use context, then verify an observable outcome such as: Each task has distinct output and critical errors, with cost/risk justification for the method. A metric is only one piece of evidence.

对应来源单元:Source unit: 官方课程 · 6-NLP / 2-TasksOfficial lesson · 6-NLP / 2-Tasks
18

第 18 课Lesson 18

翻译与情感分析:语言转换不等于语义不变Translation and sentiment analysis with ML

先回答一个白话问题Start with a plain question

翻译会改变词形和语境,情感标签又依赖领域与文化。 这节课不从算法名开始,而是先判断这个能力解决什么决策问题。

Translation changes wording and context, while sentiment labels depend on domain and culture. This lesson starts with the decision the capability supports, not an algorithm name.

类比桥梁Analogy bridge

像把笑话翻译成另一种语言:字面正确也可能失去语气。

It is like translating a joke: literal correctness can still lose tone.

类比边界:类比只帮助识别关系;真正系统仍由数据、代码、接口和运行环境决定。Where it breaks: The analogy only exposes relationships; the real system is determined by data, code, interfaces, and its runtime.

工程上到底发生什么What it means in engineering

保留原文与译文,按语言分组评估,检查否定、讽刺与领域词;不要用一次翻译制造伪标签。

Keep source and translation, evaluate by language, inspect negation, sarcasm, and domain terms; do not create pseudo-labels from one translation pass.

例子 1 · 否定翻转Example 1 · Negation flip
输入Input
“并非不推荐”“not unrecommended”
过程Process
检查翻译后否定范围Inspect translated negation scope
结果 / 验收Result / check
情感不能只数正负词Sentiment cannot be word counting
例子 2 · 领域语义Example 2 · Domain sentiment
输入Input
“挑战很大”出现在职位介绍“highly challenging” in a job post
过程Process
与酒店评论中的同词比较Compare with the phrase in hotel reviews
结果 / 验收Result / check
同词在不同领域标签不同The same phrase has different labels by domain
常见误区Common misconception

先自动翻译全部数据再训练,默认翻译噪声不会改变标签分布。

Auto-translating all data before training and assuming translation noise preserves label distribution.

作品任务Portfolio task

建 30 条中英对照压力集,覆盖否定、程度、讽刺和职位领域术语。

Build a 30-item bilingual stress set covering negation, intensity, sarcasm, and job-domain terms.

验收:Acceptance: 报告原文与译文分别的错误;至少一个类别显示翻译造成的变化。Errors are reported separately for source and translation, with at least one translation-induced shift identified.

自测:如果模型指标变高,但“翻译与情感分析:语言转换不等于语义不变”对应的真实决策没有改善,能否宣布成功?为什么?Self-check: If a model metric improves but the real decision behind “Translation and sentiment analysis with ML” does not, can you claim success? Why?

不能。先核对数据切分、基线、错误类型和使用场景,再用“报告原文与译文分别的错误;至少一个类别显示翻译造成的变化。”这样的可观察结果验收;指标只是证据之一。

No. Recheck the split, baseline, error types, and use context, then verify an observable outcome such as: Errors are reported separately for source and translation, with at least one translation-induced shift identified. A metric is only one piece of evidence.

19

第 19 课Lesson 19

情感项目第一步:先处理数据Sentiment analysis with hotel reviews — processing the data

先回答一个白话问题Start with a plain question

文本模型的上限常被标签质量、重复和数据切分决定。 这节课不从算法名开始,而是先判断这个能力解决什么决策问题。

Text-model ceilings are often set by label quality, duplicates, and data splitting. This lesson starts with the decision the capability supports, not an algorithm name.

类比桥梁Analogy bridge

像餐厅点评统计,复制粘贴的同一条评论不能既进练习卷又进考试卷。

In review analysis, duplicate text must not appear in both practice and exam sets.

类比边界:类比只帮助识别关系;真正系统仍由数据、代码、接口和运行环境决定。Where it breaks: The analogy only exposes relationships; the real system is determined by data, code, interfaces, and its runtime.

工程上到底发生什么What it means in engineering

审计重复、长度、语言、标签分布和同源泄漏;先按实体/时间分组再切分。

Audit duplicates, length, language, label balance, and source leakage; split by entity or time before modeling.

例子 1 · 重复泄漏Example 1 · Duplicate leakage
输入Input
同一岗位被多个聚合站转载The same job reposted by aggregators
过程Process
规范化文本并按来源分组切分Normalize text and split by source group
结果 / 验收Result / check
近重复不会跨训练测试Near-duplicates do not cross train/test
例子 2 · 标签代理Example 2 · Proxy label
输入Input
用星级生成情感标签Stars used as sentiment labels
过程Process
抽查文字与星级冲突Inspect text-star conflicts
结果 / 验收Result / check
标签规则及噪声率被记录Label rule and noise rate are recorded
常见误区Common misconception

随机按行切分文本,近重复内容让测试分数虚高。

Random row splitting lets near-duplicate text inflate test performance.

作品任务Portfolio task

为岗位文本建立数据审计 notebook:重复组、长度、语言、标签和切分检查。

Create a job-text audit notebook for duplicate groups, length, language, labels, and split checks.

验收:Acceptance: 训练与测试近重复交集为零;每个删除或合并步骤有数量记录。Train/test near-duplicate overlap is zero, and every deletion or merge has counts.

自测:如果模型指标变高,但“情感项目第一步:先处理数据”对应的真实决策没有改善,能否宣布成功?为什么?Self-check: If a model metric improves but the real decision behind “Sentiment analysis with hotel reviews — processing the data” does not, can you claim success? Why?

不能。先核对数据切分、基线、错误类型和使用场景,再用“训练与测试近重复交集为零;每个删除或合并步骤有数量记录。”这样的可观察结果验收;指标只是证据之一。

No. Recheck the split, baseline, error types, and use context, then verify an observable outcome such as: Train/test near-duplicate overlap is zero, and every deletion or merge has counts. A metric is only one piece of evidence.

对应来源单元:Source unit: 官方课程 · 6-NLP / 4-Hotel-Reviews-1Official lesson · 6-NLP / 4-Hotel-Reviews-1
20

第 20 课Lesson 20

情感项目第二步:训练、解释和分析错误Sentiment analysis with hotel reviews

先回答一个白话问题Start with a plain question

文本分类的价值来自对真实错误的理解,不是只看一个分数。 这节课不从算法名开始,而是先判断这个能力解决什么决策问题。

Text classification gains value from understanding real errors, not one score. This lesson starts with the decision the capability supports, not an algorithm name.

类比桥梁Analogy bridge

像批改作文,分数告诉你结果,逐题错因才告诉你如何改课。

Like grading essays: a score reports the outcome, while error reasons show how to improve the lesson.

类比边界:类比只帮助识别关系;真正系统仍由数据、代码、接口和运行环境决定。Where it breaks: The analogy only exposes relationships; the real system is determined by data, code, interfaces, and its runtime.

工程上到底发生什么What it means in engineering

建立词袋/TF-IDF 基线,查看混淆矩阵、重要特征与代表错误,再决定是否升级模型。

Build bag-of-words/TF-IDF baselines, inspect confusion matrices, important features, and representative errors before upgrading.

例子 1 · 否定错误Example 1 · Negation error
输入Input
“不要求多年经验”“does not require years of experience”
过程Process
查看模型为何抓住“要求/经验”Inspect why the model focused on “require/experience”
结果 / 验收Result / check
加入否定压力集而非只加数据Add a negation stress set, not just more data
例子 2 · 解释误导Example 2 · Misleading importance
输入Input
公司名成为强特征Company name becomes a strong feature
过程Process
删除公司名后重测Remove company names and retest
结果 / 验收Result / check
发现模型记住来源而非语义The model memorized source, not meaning
常见误区Common misconception

高权重词看起来合理,就把它当因果解释。

Treating plausible high-weight words as causal explanations.

作品任务Portfolio task

训练 TF-IDF + 线性模型,制作 25 条错误卡并按可修复原因分组。

Train a TF-IDF linear model and create 25 error cards grouped by actionable causes.

验收:Acceptance: 改进建议来自错误组;重新训练后不仅总分,关键压力集也改善。Improvements derive from error groups, and key stress sets improve alongside the aggregate score.

自测:如果模型指标变高,但“情感项目第二步:训练、解释和分析错误”对应的真实决策没有改善,能否宣布成功?为什么?Self-check: If a model metric improves but the real decision behind “Sentiment analysis with hotel reviews” does not, can you claim success? Why?

不能。先核对数据切分、基线、错误类型和使用场景,再用“改进建议来自错误组;重新训练后不仅总分,关键压力集也改善。”这样的可观察结果验收;指标只是证据之一。

No. Recheck the split, baseline, error types, and use context, then verify an observable outcome such as: Improvements derive from error groups, and key stress sets improve alongside the aggregate score. A metric is only one piece of evidence.

对应来源单元:Source unit: 官方课程 · 6-NLP / 5-Hotel-Reviews-2Official lesson · 6-NLP / 5-Hotel-Reviews-2

第七册 · 第 21–23 课Volume 7 · Lessons 21–23

时间序列:未来只能由过去预测Time series: predict the future from the past

用回测、ARIMA 和 SVR 守住时间方向。

Preserve temporal direction with backtesting, ARIMA, and SVR.

本册作品里程碑Portfolio milestone

交付三种基线的同窗口预测报告。

Deliver a same-window forecast report for three baselines.

21

第 21 课Lesson 21

时间序列:顺序、趋势和未来不能被随机打乱Introduction to time series forecasting

先回答一个白话问题Start with a plain question

时间数据的未来与过去有方向,随机切分会把未来信息泄给模型。 这节课不从算法名开始,而是先判断这个能力解决什么决策问题。

Time data has direction from past to future; random splitting leaks future information. This lesson starts with the decision the capability supports, not an algorithm name.

类比桥梁Analogy bridge

天气预报不能拿明天温度帮助预测昨天。

A forecast cannot use tomorrow’s temperature to predict yesterday.

类比边界:类比只帮助识别关系;真正系统仍由数据、代码、接口和运行环境决定。Where it breaks: The analogy only exposes relationships; the real system is determined by data, code, interfaces, and its runtime.

工程上到底发生什么What it means in engineering

明确频率、时区、趋势、季节性和预测时点;用滚动/扩展窗口回测。

Define frequency, timezone, trend, seasonality, and forecast origin; backtest with rolling or expanding windows.

例子 1 · 随机切分泄漏Example 1 · Random-split leakage
输入Input
两年周度岗位数Two years of weekly job counts
过程Process
比较随机切分与按时间切分Compare random and chronological splits
结果 / 验收Result / check
随机分数虚高Random splitting inflates the score
例子 2 · 朴素预测Example 2 · Naive forecast
输入Input
本周岗位数This week’s job count
过程Process
预测下周等于本周或去年同期Predict next week as this week or same week last year
结果 / 验收Result / check
复杂模型先超过季节基线Complex models must beat seasonal baselines
常见误区Common misconception

把时间戳删掉后随机切分,以为模型就看不到未来。

Dropping timestamps and randomly splitting, as if future information disappears.

作品任务Portfolio task

画周度岗位序列,标缺失周和异常事件,设计三个回测窗口。

Plot weekly job counts, mark missing weeks and events, and design three backtest windows.

验收:Acceptance: 预测时点与可用特征清楚;任何特征都不来自未来。Forecast origin and available features are explicit; no feature comes from the future.

自测:如果模型指标变高,但“时间序列:顺序、趋势和未来不能被随机打乱”对应的真实决策没有改善,能否宣布成功?为什么?Self-check: If a model metric improves but the real decision behind “Introduction to time series forecasting” does not, can you claim success? Why?

不能。先核对数据切分、基线、错误类型和使用场景,再用“预测时点与可用特征清楚;任何特征都不来自未来。”这样的可观察结果验收;指标只是证据之一。

No. Recheck the split, baseline, error types, and use context, then verify an observable outcome such as: Forecast origin and available features are explicit; no feature comes from the future. A metric is only one piece of evidence.

22

第 22 课Lesson 22

ARIMA:用过去值与过去误差做预测Time series forecasting with ARIMA

先回答一个白话问题Start with a plain question

ARIMA 通过差分处理趋势,并组合自回归与移动平均结构。 这节课不从算法名开始,而是先判断这个能力解决什么决策问题。

ARIMA differences trends and combines autoregressive and moving-average structure. This lesson starts with the decision the capability supports, not an algorithm name.

类比桥梁Analogy bridge

像根据最近几次偏高或偏低的预测,既看历史水平也修正过去误差。

It is like using recent levels while correcting a history of over- and under-prediction.

类比边界:类比只帮助识别关系;真正系统仍由数据、代码、接口和运行环境决定。Where it breaks: The analogy only exposes relationships; the real system is determined by data, code, interfaces, and its runtime.

工程上到底发生什么What it means in engineering

检查平稳性、选择 p/d/q、诊断残差,并与朴素基线在同一回测窗口比较。

Check stationarity, choose p/d/q, diagnose residuals, and compare with naive baselines on identical backtests.

例子 1 · 差分Example 1 · Differencing
输入Input
持续上升的岗位数A rising job-count series
过程Process
对相邻值做差后建模Model adjacent differences
结果 / 验收Result / check
趋势被转为变化量Trend becomes change
例子 2 · 残差诊断Example 2 · Residual diagnostics
输入Input
ARIMA 回测误差ARIMA backtest errors
过程Process
检查自相关与时段偏差Check autocorrelation and period bias
结果 / 验收Result / check
有结构残差说明模型漏了信息Structured residuals reveal missing information
常见误区Common misconception

自动搜索得到某组 p/d/q 就停止,未检查残差和业务断点。

Stopping after auto-search returns p/d/q without inspecting residuals or business breaks.

作品任务Portfolio task

对技能需求周序列做 ARIMA 回测,报告参数、残差与朴素基线。

Backtest ARIMA on weekly skill demand and report parameters, residuals, and naive baseline.

验收:Acceptance: 模型只在多个窗口稳定优于基线时保留;失效时段有解释。Keep the model only if it consistently beats baselines across windows; explain failure periods.

自测:如果模型指标变高,但“ARIMA:用过去值与过去误差做预测”对应的真实决策没有改善,能否宣布成功?为什么?Self-check: If a model metric improves but the real decision behind “Time series forecasting with ARIMA” does not, can you claim success? Why?

不能。先核对数据切分、基线、错误类型和使用场景,再用“模型只在多个窗口稳定优于基线时保留;失效时段有解释。”这样的可观察结果验收;指标只是证据之一。

No. Recheck the split, baseline, error types, and use context, then verify an observable outcome such as: Keep the model only if it consistently beats baselines across windows; explain failure periods. A metric is only one piece of evidence.

对应来源单元:Source unit: 官方课程 · 7-TimeSeries / 2-ARIMAOfficial lesson · 7-TimeSeries / 2-ARIMA
23

第 23 课Lesson 23

用支持向量回归预测时间序列Time Series Forecasting with Support Vector Regressor

先回答一个白话问题Start with a plain question

SVR 可以拟合非线性关系,但时间信息必须被构造成合法特征。 这节课不从算法名开始,而是先判断这个能力解决什么决策问题。

SVR can fit nonlinear relationships, but time information must be engineered into valid features. This lesson starts with the decision the capability supports, not an algorithm name.

类比桥梁Analogy bridge

像用可弯曲但受约束的管子穿过数据点,容忍管道内的小误差。

It is like fitting a flexible but constrained tube through points, tolerating small errors inside the tube.

类比边界:类比只帮助识别关系;真正系统仍由数据、代码、接口和运行环境决定。Where it breaks: The analogy only exposes relationships; the real system is determined by data, code, interfaces, and its runtime.

工程上到底发生什么What it means in engineering

构造滞后、滚动统计和日历特征,缩放后训练;所有滚动值只使用预测时点之前的数据。

Create lag, rolling, and calendar features, scale them, and ensure every rolling value uses only data before the forecast origin.

例子 1 · 滞后特征Example 1 · Lag features
输入Input
t-1、t-4 周岗位数Counts at t-1 and t-4
过程Process
按时间移位并删除不可用首行Shift chronologically and drop unavailable leading rows
结果 / 验收Result / check
预测行不含当前/未来目标Prediction rows contain no current/future target
例子 2 · 缩放敏感Example 2 · Scaling sensitivity
输入Input
数值跨度不同的滞后与月份Lags and month numbers on different scales
过程Process
Pipeline 中标准化后调 C/gammaScale in Pipeline then tune C/gamma
结果 / 验收Result / check
比较不缩放的反例Compare an unscaled counterexample
常见误区Common misconception

先在全数据上计算滚动均值再切分,测试期信息已经进入特征。

Computing rolling means on all data before splitting, leaking test-period information.

作品任务Portfolio task

构建泄漏安全的 lag Pipeline,对比 SVR、ARIMA 和季节朴素基线。

Build a leakage-safe lag Pipeline and compare SVR, ARIMA, and seasonal naive baselines.

验收:Acceptance: 特征生成有时间单元测试;比较使用同一窗口、同一指标。Feature generation has temporal unit tests; all models share windows and metrics.

自测:如果模型指标变高,但“用支持向量回归预测时间序列”对应的真实决策没有改善,能否宣布成功?为什么?Self-check: If a model metric improves but the real decision behind “Time Series Forecasting with Support Vector Regressor” does not, can you claim success? Why?

不能。先核对数据切分、基线、错误类型和使用场景,再用“特征生成有时间单元测试;比较使用同一窗口、同一指标。”这样的可观察结果验收;指标只是证据之一。

No. Recheck the split, baseline, error types, and use context, then verify an observable outcome such as: Feature generation has temporal unit tests; all models share windows and metrics. A metric is only one piece of evidence.

对应来源单元:Source unit: 官方课程 · 7-TimeSeries / 3-SVROfficial lesson · 7-TimeSeries / 3-SVR

第八册 · 第 24–25 课Volume 8 · Lessons 24–25

强化学习:奖励会塑造行为Reinforcement learning: rewards shape behavior

从状态、动作、奖励、环境和多随机种子理解策略学习。

Understand policy learning through states, actions, rewards, environments, and multiple seeds.

本册作品里程碑Portfolio milestone

交付小环境、奖励黑客清单和失败轨迹。

Deliver a small environment, reward-hack list, and failure traces.

24

第 24 课Lesson 24

强化学习与 Q-Learning:状态、动作、奖励Introduction to Reinforcement Learning and Q-Learning

先回答一个白话问题Start with a plain question

强化学习通过与环境交互、接收延迟奖励来学习策略。 这节课不从算法名开始,而是先判断这个能力解决什么决策问题。

Reinforcement learning learns a policy through environment interaction and delayed rewards. This lesson starts with the decision the capability supports, not an algorithm name.

类比桥梁Analogy bridge

像在迷宫试路:每步看当前位置、选方向、收到代价,最终学会路线。

It is like exploring a maze: observe position, choose a move, receive a cost, and learn a route.

类比边界:类比只帮助识别关系;真正系统仍由数据、代码、接口和运行环境决定。Where it breaks: The analogy only exposes relationships; the real system is determined by data, code, interfaces, and its runtime.

工程上到底发生什么What it means in engineering

定义状态、动作、转移、奖励和终止;Q-Learning 更新状态—动作价值,并权衡探索与利用。

Define states, actions, transitions, rewards, and termination; Q-Learning updates state-action values while balancing exploration and exploitation.

例子 1 · 奖励塑形Example 1 · Reward shaping
输入Input
求职任务下一步选择Choosing the next job-search action
过程Process
奖励有效完成而非点击次数Reward valid completion, not click count
结果 / 验收Result / check
避免刷动作得分Avoid reward hacking by repeated clicks
例子 2 · 探索利用Example 2 · Explore vs exploit
输入Input
已知高分路径与新动作Known high-value path and new actions
过程Process
epsilon-greedy 逐渐降低探索Decay epsilon-greedy exploration
结果 / 验收Result / check
既学习又逐步稳定Learning continues while behavior stabilizes
常见误区Common misconception

奖励写成“投递越多越好”,系统可能鼓励无差别海投而非高质量求职。

Rewarding “more applications” can optimize spam rather than job-search quality.

作品任务Portfolio task

在纸面设计一个五状态任务环境,列出可能的奖励黑客和安全终止条件。

Design a five-state task environment on paper, listing reward hacks and safe termination conditions.

验收:Acceptance: 每个奖励都对应真实目标,且至少有一个反例证明代理指标会被钻空子。Each reward maps to the real goal, with at least one counterexample showing proxy exploitation.

自测:如果模型指标变高,但“强化学习与 Q-Learning:状态、动作、奖励”对应的真实决策没有改善,能否宣布成功?为什么?Self-check: If a model metric improves but the real decision behind “Introduction to Reinforcement Learning and Q-Learning” does not, can you claim success? Why?

不能。先核对数据切分、基线、错误类型和使用场景,再用“每个奖励都对应真实目标,且至少有一个反例证明代理指标会被钻空子。”这样的可观察结果验收;指标只是证据之一。

No. Recheck the split, baseline, error types, and use context, then verify an observable outcome such as: Each reward maps to the real goal, with at least one counterexample showing proxy exploitation. A metric is only one piece of evidence.

25

第 25 课Lesson 25

在 Gym 类环境里训练与评估策略CartPole Skating

先回答一个白话问题Start with a plain question

环境接口把观察、动作、奖励和终止组织成可重复实验。 这节课不从算法名开始,而是先判断这个能力解决什么决策问题。

An environment interface organizes observations, actions, rewards, and termination into repeatable experiments. This lesson starts with the decision the capability supports, not an algorithm name.

类比桥梁Analogy bridge

像标准化训练馆:每位运动员面对同样规则、起点分布和计分方式。

It is like a standardized gym where athletes share rules, start distributions, and scoring.

类比边界:类比只帮助识别关系;真正系统仍由数据、代码、接口和运行环境决定。Where it breaks: The analogy only exposes relationships; the real system is determined by data, code, interfaces, and its runtime.

工程上到底发生什么What it means in engineering

reset/step 循环运行 episode;区分 terminated/truncated,记录多随机种子回报与失败轨迹。

Run episodes through reset/step, distinguish terminated from truncated, and record returns and failure traces across seeds.

例子 1 · 单局好运Example 1 · One lucky episode
输入Input
一次高回报One high-return episode
过程Process
运行 100 局看均值和分布Run 100 episodes for mean and distribution
结果 / 验收Result / check
不能用单局证明策略稳定One episode cannot prove stability
例子 2 · 终止误读Example 2 · Termination confusion
输入Input
时间上限触发结束Episode ends by time limit
过程Process
区分失败终止与截断Distinguish failure termination from truncation
结果 / 验收Result / check
回报统计含正确语义Return statistics preserve meaning
常见误区Common misconception

训练环境分数高就认为现实可用,忽略模拟器与现实差距。

Treating high simulator reward as real-world readiness while ignoring the sim-to-real gap.

作品任务Portfolio task

实现最小 Q-Learning 环境循环,固定三个种子并保存失败 episode。

Implement a minimal Q-Learning loop with three fixed seeds and saved failed episodes.

验收:Acceptance: 报告回报分布、终止原因、训练预算和至少一条失败轨迹。Report return distribution, termination reasons, training budget, and at least one failure trace.

自测:如果模型指标变高,但“在 Gym 类环境里训练与评估策略”对应的真实决策没有改善,能否宣布成功?为什么?Self-check: If a model metric improves but the real decision behind “CartPole Skating” does not, can you claim success? Why?

不能。先核对数据切分、基线、错误类型和使用场景,再用“报告回报分布、终止原因、训练预算和至少一条失败轨迹。”这样的可观察结果验收;指标只是证据之一。

No. Recheck the split, baseline, error types, and use context, then verify an observable outcome such as: Report return distribution, termination reasons, training budget, and at least one failure trace. A metric is only one piece of evidence.

对应来源单元:Source unit: 官方课程 · 8-Reinforcement / 2-GymOfficial lesson · 8-Reinforcement / 2-Gym

第九册 · 第 26–27 课Volume 9 · Lessons 26–27

上线与调试:模型活在系统里Deployment and debugging: models live in systems

把漂移、反馈回路、群体错误和回滚纳入交付。

Include drift, feedback loops, cohort errors, and rollback.

本册作品里程碑Portfolio milestone

交付系统图、监控计划和负责任调试报告。

Deliver the system map, monitoring plan, and responsible debugging report.

26

第 26 课Lesson 26

现实世界中的机器学习系统Machine learning in the real world

先回答一个白话问题Start with a plain question

生产模型处在数据、用户、业务规则与反馈回路组成的系统中。 这节课不从算法名开始,而是先判断这个能力解决什么决策问题。

A production model lives inside a system of data, users, business rules, and feedback loops. This lesson starts with the decision the capability supports, not an algorithm name.

类比桥梁Analogy bridge

模型像导航算法,地图更新、司机行为、道路封闭和反馈都会改变效果。

A model is like navigation logic; map updates, driver behavior, road closures, and feedback change outcomes.

类比边界:类比只帮助识别关系;真正系统仍由数据、代码、接口和运行环境决定。Where it breaks: The analogy only exposes relationships; the real system is determined by data, code, interfaces, and its runtime.

工程上到底发生什么What it means in engineering

建立数据契约、版本、服务、监控、漂移检测、人工复核和回滚;离线分数只是上线门槛。

Add data contracts, versioning, serving, monitoring, drift detection, human review, and rollback; offline scores are only an entry gate.

例子 1 · 反馈回路Example 1 · Feedback loop
输入Input
只向用户展示模型推荐岗位Only model-recommended jobs are shown
过程Process
后续点击数据只来自已展示项Future clicks come only from shown items
结果 / 验收Result / check
训练数据越来越窄Training data narrows over time
例子 2 · 影子部署Example 2 · Shadow deployment
输入Input
新旧模型并行Old and new models run in parallel
过程Process
新模型不影响用户,只记录比较New model records comparisons without user impact
结果 / 验收Result / check
上线前发现分组退化Sliced regressions appear before launch
常见误区Common misconception

上线后只监控服务器 200,不监控输入分布、模型输出和用户后果。

Monitoring HTTP 200s after launch but not input distribution, model outputs, or user outcomes.

作品任务Portfolio task

画出岗位模型从数据进入到用户反馈的全链路,标版本、监控、审批和回滚点。

Draw the job model’s end-to-end flow from data to user feedback, marking versions, monitoring, approvals, and rollback.

验收:Acceptance: 图中至少能定位数据坏、模型坏、接口坏和使用方式坏四类故障。The diagram can locate at least four failure classes: data, model, interface, and use.

自测:如果模型指标变高,但“现实世界中的机器学习系统”对应的真实决策没有改善,能否宣布成功?为什么?Self-check: If a model metric improves but the real decision behind “Machine learning in the real world” does not, can you claim success? Why?

不能。先核对数据切分、基线、错误类型和使用场景,再用“图中至少能定位数据坏、模型坏、接口坏和使用方式坏四类故障。”这样的可观察结果验收;指标只是证据之一。

No. Recheck the split, baseline, error types, and use context, then verify an observable outcome such as: The diagram can locate at least four failure classes: data, model, interface, and use. A metric is only one piece of evidence.

27

第 27 课Lesson 27

用负责任 AI 工具调试模型Model Debugging with Responsible AI dashboards

先回答一个白话问题Start with a plain question

调试模型要回答“对谁、在哪些样本、为什么失败”,而不只看整体误差。 这节课不从算法名开始,而是先判断这个能力解决什么决策问题。

Model debugging asks who fails, on which samples, and why—not only the aggregate error. This lesson starts with the decision the capability supports, not an algorithm name.

类比桥梁Analogy bridge

像医生不能只看全院平均体温,要定位哪类病人在哪个环节出问题。

A doctor cannot rely on hospital-wide average temperature; failures must be localized by patient and process.

类比边界:类比只帮助识别关系;真正系统仍由数据、代码、接口和运行环境决定。Where it breaks: The analogy only exposes relationships; the real system is determined by data, code, interfaces, and its runtime.

工程上到底发生什么What it means in engineering

误差分析、特征重要性、反事实和群体切片提供线索;它们帮助形成假设,不自动证明因果。

Error analysis, feature importance, counterfactuals, and cohorts provide clues; they form hypotheses but do not prove causality.

例子 1 · 错误树Example 1 · Error tree
输入Input
全部验证错误All validation errors
过程Process
按语言、经验和来源递归切片Slice by language, experience, and source
结果 / 验收Result / check
发现小群体集中失败A small cohort concentrates failures
例子 2 · 反事实检查Example 2 · Counterfactual check
输入Input
同一岗位仅改变地点Same job with only location changed
过程Process
观察预测变化并复核合理性Observe prediction change and review plausibility
结果 / 验收Result / check
发现模型过度依赖地点代理Model over-relies on a location proxy
常见误区Common misconception

仪表板生成解释图就把它当最终答案;解释方法本身也有假设和不稳定性。

Treating a dashboard explanation as final truth; explanation methods have assumptions and instability.

作品任务Portfolio task

为最终模型建立三类 cohort,做误差、重要性和反事实调查,写修复/不修复决定。

Create three cohorts for the final model, investigate errors, importance, and counterfactuals, then document fix/no-fix decisions.

验收:Acceptance: 每项决定都有样本证据、影响范围、验证计划和负责任使用边界。Each decision includes sample evidence, impact scope, validation plan, and responsible-use boundary.

自测:如果模型指标变高,但“用负责任 AI 工具调试模型”对应的真实决策没有改善,能否宣布成功?为什么?Self-check: If a model metric improves but the real decision behind “Model Debugging with Responsible AI dashboards” does not, can you claim success? Why?

不能。先核对数据切分、基线、错误类型和使用场景,再用“每项决定都有样本证据、影响范围、验证计划和负责任使用边界。”这样的可观察结果验收;指标只是证据之一。

No. Recheck the split, baseline, error types, and use context, then verify an observable outcome such as: Each decision includes sample evidence, impact scope, validation plan, and responsible-use boundary. A metric is only one piece of evidence.

新手术语表Beginner glossary

先用自己的话说一遍,再看定义Say it in your own words before checking

机器学习Machine learning

从数据中学习可用于新样本的模式。

Learning patterns from data that generalize to new examples.

样本Sample

数据集中的一个观察对象。

One observed item in a dataset.

特征Feature

提供给模型的输入表示。

An input representation supplied to a model.

标签Label

监督学习要预测的目标。

The target predicted in supervised learning.

训练集Training set

用于拟合模型参数的数据。

Data used to fit model parameters.

验证集Validation set

用于选方案、阈值或超参数的数据。

Data used to choose models, thresholds, or hyperparameters.

测试集Test set

锁定方案后用于最终估计的数据。

Data used once after locking the solution.

基线Baseline

复杂方案必须超过的简单参考。

A simple reference a complex solution must beat.

监督学习Supervised learning

从带标签样本学习输入到目标的映射。

Learning a mapping from inputs to labeled targets.

无监督学习Unsupervised learning

在无目标标签数据中探索结构。

Exploring structure without target labels.

强化学习Reinforcement learning

通过环境交互和奖励学习策略。

Learning a policy through interaction and reward.

回归Regression

预测连续数值的任务。

A task that predicts continuous values.

分类Classification

预测离散类别的任务。

A task that predicts discrete classes.

聚类Clustering

按表示和距离把样本分组。

Grouping samples by representation and distance.

时间序列Time series

按时间顺序观察的数据。

Observations ordered in time.

预处理Preprocessing

进入模型前对数据做一致转换。

Consistent transformations before modeling.

管线Pipeline

把预处理与模型绑定为一个可复现步骤链。

A reproducible chain binding preprocessing and model.

数据切分Data split

把数据分配到训练、验证和测试。

Allocating data to train, validation, and test.

分层切分Stratified split

保持类别比例的切分方式。

A split preserving class proportions.

交叉验证Cross-validation

用多个折重复训练验证以估计波动。

Repeated folds used to estimate variation.

随机种子Random seed

复现伪随机过程起点的值。

A value that reproduces pseudorandom sequences.

欠拟合Underfitting

模型过于简单,训练和新数据都表现差。

A model too simple for both training and new data.

过拟合Overfitting

训练很好但对新数据泛化差。

Strong training fit but weak generalization.

泛化Generalization

在未见数据上保持性能的能力。

The ability to perform on unseen data.

超参数Hyperparameter

训练前选择、控制模型容量或学习过程的设置。

A pre-training setting controlling capacity or learning.

损失函数Loss function

训练时度量预测错误并被优化的函数。

The training objective measuring prediction error.

MAEMean absolute error

绝对误差的平均值。

Average absolute prediction error.

准确率Accuracy

全部样本中预测正确的比例。

Fraction of all predictions that are correct.

精确率Precision

预测为正的样本中真正为正的比例。

Fraction of predicted positives that are positive.

召回率Recall

真正为正的样本中被找出的比例。

Fraction of actual positives found.

混淆矩阵Confusion matrix

按真实与预测类别统计错误类型的表。

A table of actual versus predicted classes.

阈值Threshold

把连续分数转换为类别决定的边界。

A boundary converting a score to a class decision.

概率校准Calibration

预测概率与实际发生频率的一致程度。

Agreement between predicted probabilities and observed frequencies.

残差Residual

真实值与预测值之差。

The difference between actual and predicted value.

正则化Regularization

限制模型复杂度以改善泛化。

Constraining complexity to improve generalization.

标准化Standardization

把数值移到可比较尺度的转换。

Transforming numeric values to a comparable scale.

降维Dimensionality reduction

用较少维度保留部分结构。

Representing structure with fewer dimensions.

质心Centroid

聚类中一组样本的中心表示。

The center representation of a cluster.

词袋Bag of words

忽略顺序、按词计数的文本表示。

A text representation counting words without order.

TF-IDFTF-IDF

突出文档内重要且语料中不常见词的权重。

Weighting words frequent in a document but uncommon in the corpus.

分词Tokenization

把文本切成模型处理单位。

Splitting text into model units.

领域迁移Domain shift

训练与使用场景的语言或分布不同。

A difference between training and use domains.

概念漂移Concept drift

输入与目标关系随时间改变。

A change over time in the input-target relationship.

数据泄漏Data leakage

训练获得预测时不应知道的信息。

Training receives information unavailable at prediction time.

代理变量Proxy variable

间接编码另一属性的字段。

A field indirectly encoding another attribute.

公平性切片Fairness slice

按群体或情境拆分评估结果。

Evaluation broken down by group or context.

可解释性Interpretability

人理解模型输入、输出或行为线索的能力。

The ability to understand model inputs, outputs, or behavior.

反事实Counterfactual

只改变少量条件观察预测变化的假设样本。

A hypothetical sample changing limited conditions to inspect prediction.

回测Backtesting

按过去预测未来的方式重复模拟真实预测。

Repeatedly simulating past-to-future prediction.

滞后特征Lag feature

来自当前预测时点之前的历史值。

A historical value before the forecast origin.

策略Policy

强化学习中从状态选择动作的规则。

A rule for choosing actions from states.

奖励Reward

环境对动作结果返回的学习信号。

The learning signal returned by the environment.

探索Exploration

尝试未知动作以获得信息。

Trying unfamiliar actions to gain information.

利用Exploitation

选择当前已知价值最高的动作。

Choosing the action currently believed best.

漂移监控Drift monitoring

检查输入、输出或效果分布是否变化。

Checking for changes in input, output, or outcome distributions.

模型卡Model card

记录用途、数据、指标、限制和禁止用途。

Documentation of use, data, metrics, limits, and prohibited uses.

影子部署Shadow deployment

新模型并行运行但不影响用户决定。

Running a new model in parallel without affecting decisions.

回滚Rollback

把失败模型或服务恢复到已知可用版本。

Restoring a failed model or service to a known-good version.

来源覆盖矩阵Source coverage matrix

每个来源单元都有去处Every source unit has a destination

#讲义单元Guide unit官方来源映射Official source mapping
1机器学习到底适合解决什么问题Introduction to machine learning 官方课程 · 1-Introduction / 1-intro-to-MLOfficial lesson · 1-Introduction / 1-intro-to-ML
2用历史看清机器学习的能力边界History of machine learning 官方课程 · 1-Introduction / 2-history-of-MLOfficial lesson · 1-Introduction / 2-history-of-ML
3负责任 AI 与公平性不是上线后的装饰Building ML solutions with responsible AI 官方课程 · 1-Introduction / 3-fairnessOfficial lesson · 1-Introduction / 3-fairness
4监督、无监督、半监督与强化学习地图Techniques of Machine Learning 官方课程 · 1-Introduction / 4-techniques-of-MLOfficial lesson · 1-Introduction / 4-techniques-of-ML
5用 Python 与 scikit-learn 建第一条可复现管线Get started with Python and Scikit-learn for regression models 官方课程 · 2-Regression / 1-ToolsOfficial lesson · 2-Regression / 1-Tools
6回归前先准备、观察和质疑数据Prepare and visualize data for regression 官方课程 · 2-Regression / 2-DataOfficial lesson · 2-Regression / 2-Data
7用四种回归看清关系、误差与过拟合Regression four ways 官方课程 · 2-Regression / 3-LinearOfficial lesson · 2-Regression / 3-Linear
8逻辑回归为什么名字有回归却常做分类Logistic regression to predict categories 官方课程 · 2-Regression / 4-LogisticOfficial lesson · 2-Regression / 4-Logistic
9把训练好的模型接进最小 Web 应用Build a Web App to use an ML Model 官方课程 · 3-Web-App / 1-Web-AppOfficial lesson · 3-Web-App / 1-Web-App
10分类任务:类别、标签与错误成本Introduction to classification 官方课程 · 4-Classification / 1-IntroductionOfficial lesson · 4-Classification / 1-Introduction
11比较分类器,不靠排行榜选模型Cuisine classifiers 1 官方课程 · 4-Classification / 2-Classifiers-1Official lesson · 4-Classification / 2-Classifiers-1
12继续比较分类器:参数、边界与验证Cuisine classifiers 2 官方课程 · 4-Classification / 3-Classifiers-2Official lesson · 4-Classification / 3-Classifiers-2
13交付一个分类推荐 Web 应用Build a Cuisine Recommender Web App 官方课程 · 4-Classification / 4-AppliedOfficial lesson · 4-Classification / 4-Applied
14聚类前先把距离和表示想清楚Introduction to clustering 官方课程 · 5-Clustering / 1-VisualizeOfficial lesson · 5-Clustering / 1-Visualize
15K-Means:质心、k 与稳定性K-Means clustering 官方课程 · 5-Clustering / 2-K-MeansOfficial lesson · 5-Clustering / 2-K-Means
16自然语言处理:文本怎样变成可计算表示Introduction to natural language processing 官方课程 · 6-NLP / 1-Introduction-to-NLPOfficial lesson · 6-NLP / 1-Introduction-to-NLP
17常见 NLP 任务与选择路线Common NLP tasks and techniques 官方课程 · 6-NLP / 2-TasksOfficial lesson · 6-NLP / 2-Tasks
18翻译与情感分析:语言转换不等于语义不变Translation and sentiment analysis with ML 官方课程 · 6-NLP / 3-Translation-SentimentOfficial lesson · 6-NLP / 3-Translation-Sentiment
19情感项目第一步:先处理数据Sentiment analysis with hotel reviews — processing the data 官方课程 · 6-NLP / 4-Hotel-Reviews-1Official lesson · 6-NLP / 4-Hotel-Reviews-1
20情感项目第二步:训练、解释和分析错误Sentiment analysis with hotel reviews 官方课程 · 6-NLP / 5-Hotel-Reviews-2Official lesson · 6-NLP / 5-Hotel-Reviews-2
21时间序列:顺序、趋势和未来不能被随机打乱Introduction to time series forecasting 官方课程 · 7-TimeSeries / 1-IntroductionOfficial lesson · 7-TimeSeries / 1-Introduction
22ARIMA:用过去值与过去误差做预测Time series forecasting with ARIMA 官方课程 · 7-TimeSeries / 2-ARIMAOfficial lesson · 7-TimeSeries / 2-ARIMA
23用支持向量回归预测时间序列Time Series Forecasting with Support Vector Regressor 官方课程 · 7-TimeSeries / 3-SVROfficial lesson · 7-TimeSeries / 3-SVR
24强化学习与 Q-Learning:状态、动作、奖励Introduction to Reinforcement Learning and Q-Learning 官方课程 · 8-Reinforcement / 1-QLearningOfficial lesson · 8-Reinforcement / 1-QLearning
25在 Gym 类环境里训练与评估策略CartPole Skating 官方课程 · 8-Reinforcement / 2-GymOfficial lesson · 8-Reinforcement / 2-Gym
26现实世界中的机器学习系统Machine learning in the real world 官方课程 · 9-Real-World / 1-ApplicationsOfficial lesson · 9-Real-World / 1-Applications
27用负责任 AI 工具调试模型Model Debugging with Responsible AI dashboards 官方课程 · 9-Real-World / 2-Debugging-ML-ModelsOfficial lesson · 9-Real-World / 2-Debugging-ML-Models

来源与版权边界Source and license boundary

来源为 Microsoft《ML-For-Beginners》,MIT 许可。讲义保留课程与作者组织署名、官方链接和版本信息;教学顺序、岗位案例、误区、自测与作品验收为本讲义原创。

Source: Microsoft ML-For-Beginners under the MIT License. Course attribution, official links, and version are preserved; teaching order, job examples, misconceptions, checks, and portfolio acceptance criteria are original.

打开官方来源Open official source · retrieved 2026-07-20 · commit d0d0ea2b2d22 · MIT