中级Intermediate可打印Printable点子Idea

满分之后:模型真的学会了吗?

After Full Marks: Did the Model Really Learn?

练习题全对,不代表新题也会。用一个小数据表分清训练、验证和测试,再找出准确率藏住的错误。

Perfect practice scores do not guarantee new answers. Separate training, validation and test data, then find mistakes hidden by accuracy.

试教点子:已提供活动、学习单和双语指南,尚未标为 Verified。可按学生情况分两次完成。

Teaching idea: activities, worksheets and bilingual guides are available. It is not yet marked Verified; split it into two sessions if helpful.

一个只会说“不是猫”的模型,在 10 张图上答对了 9 张。它会认猫了吗?先别庆祝:看看那一张猫怎么样了。

A model that always says “not a cat” gets 9 of 10 pictures right. Can it recognize cats? Before celebrating, look at the one cat.

开始之前Before you start

分别统计猫的漏报和非猫的误报,并在调参前封存测试集。

Count missed cats and false cat alarms separately, and reserve test data before tuning.

先做感知机和训练数据课;会算分数和百分比。

Complete the perceptron and training-data lessons; use fractions and percentages.

一步一步试试看Try it step by step

  1. 先猜:模型永远说“非猫”,它在 1 猫 9 非猫的数据上几分?先算总分,再只看猫。Predict: a model always says not-cat. Score it on one cat and nine non-cats, then score just the cat.
  2. 动手:使用第二组 6 个样本:真值 猫猫非非非非,预测 猫非猫非非非。把每一格分到 TP、FN、FP、TN。Try: six truths are cat,cat,no,no,no,no; predictions are cat,no,cat,no,no,no. Assign every example to TP, FN, FP or TN.
  3. 观察:先分三个信封。训练用来学权重,验证用来挑门槛或模型;最终测试在选择结束后才打开一次。Observe: split into three envelopes first. Train weights on training data, choose thresholds/models with validation data and open final test data after selection.
  4. 挑战:把同一幅原图的复制件分别放训练和测试,讨论为什么不是独立新题;按来源分组后重分。Challenge: put copies of one original picture in training and test. Explain why this is not an independent new problem, then split by source.

一起算一个例子Work through one example

永远说非猫:准确率 9/10=90%,但猫的召回率 0/1=0%。第二组 TP=1、FN=1、FP=1、TN=3,准确率 4/6。

Always not-cat gives 9/10=90% accuracy but cat recall 0/1=0%. The second set has TP=1,FN=1,FP=1,TN=3 and accuracy 4/6.

先想一想,再看答案Think first, then check

看过测试结果,再反复调门槛直到测试高分,还能把它当作一次独立期末考试吗?

After repeatedly tuning a threshold against test results, is that still an independent final exam?

查看参考答案Show the expected answer

不能;测试信息已参与选择,需要新的独立测试。第二组 precision=1/(1+1)=50%,recall=1/(1+1)=50%;总分 4/6≈66.7%。样本很少,只作练习,不说明真实部署水平。 挑战:9 猫 1 非猫、全报猫,TP=9、FP=1、FN=0、TN=0;非猫召回率为 0/1,或说非猫全部被误报。重复图应按来源整体分在同一集合,不能跨训练和测试。门槛在验证集上选择。

No; test information has influenced selection, so a new independent test is needed. Second set: precision=1/(1+1)=50%, recall=1/(1+1)=50%, accuracy=4/6≈66.7%. This tiny exercise is not a deployment-performance estimate. Challenge: nine cats, one non-cat, always cat gives TP=9,FP=1,FN=0,TN=0. Non-cat recall is 0/1: every non-cat is a false alarm. Keep duplicate/source-related images together in one split. Choose thresholds with validation data.

这个实验说明了什么What this experiment shows

准确率、精确率和召回率回答不同问题,没有单一指标适合所有场景;分母为 0 时必须标明未定义。

Accuracy, precision and recall answer different questions. No single metric suits every use; a zero denominator must be marked undefined.

学习单Worksheets

学习单用英文,可打印给孩子。教师指南随页面语言下载:当前为中文版。

Print the English worksheets for the children. The guide follows the page language: English is selected.

Practice: predict, then try
练习:先猜再试Practice: predict, then try
Challenge: make a puzzle
挑战:出题考一考Challenge: make a puzzle

下载学习单(PDF)Download worksheets (PDF)教师指南(中文 PDF)Teacher guide (English PDF)

视频与文章Videos and reading

接着学Keep going