Learning Hub / Unit 4

Unit 4 of 6 · Round S-04 · target day 2026-11-28

What did I know before sealing? Calibration with a straight line

If you peek at the answer and then "predict", it is not a prediction. This unit sorts information by when it became available, then upgrades last unit's constant correction to a straight-line correction fitted by least squares (M5), adds a second input (M6), and proves with a leak test that neither model reads the future.

看过答案再「预测」,就不叫预测。本单元先按「什么时候能拿到」给资料分类,再把上单元的常数修正升级为用最小二乘拟合的直线修正(M5),加入第二个输入(M6),并用泄漏测试证明两个模型都没有读到未来。

60-minute lesson + 20-minute round touchReal data: Boston Logan, 47 daysInformation pack and versions are SYNTHETIC

Goals and exit evidence

  • Tell apart four times: when weather happened, when data were published, when the server received your forecast, and the target window.
  • Fit observed = a × forecast + b by least squares and explain what a and b mean.
  • Find one future-information leak and explain why a late revision is kept but not scored.

Exit evidence: an available-information table, a hand-fitted a and b compared with the page, and one correction note.

  • 区分四种时间:天气发生的时间、资料发布的时间、服务器收到你预测的时间、目标区间。
  • 用最小二乘拟合 实测 = a × 预报 + b,并说明 a、b 的含义。
  • 找出一处未来信息泄漏,说明晚交修订为什么保留但不计分。

出口证据:一张可用信息表、一组手算的 a 与 b(与页面对照)、一条更正记录。

Story hook

An AI tool proudly reports: "My model beat the forecast easily." You look closer. To train it, the tool used every day of data, including the very days it was then tested on. Of course it looked good: it had seen the answers. Today we build a correction that only uses what was known at the cutoff, and we test it so we would notice if it ever cheated.

一个 AI 工具得意地报告:「我的模型轻松胜过预报。」细看才发现,它训练时用了全部日子的数据,包括随后拿来测试的那些天。当然好看:它看过答案。今天我们做一个只用截止时已知信息的修正,并加一道测试,一旦它作弊我们就能发现。

Concepts

1 · Four times

Observed: when the weather happened. Published: when anyone could get the value. Received: when the server got your forecast. Target: the future window. A value whose day has ended but which is published after the cutoff could not be used.

观察时间:天气发生的区间。发布时间:别人能拿到数值的时刻。接收时间:服务器收到你预测的时刻。目标时间:要预测的未来区间。某天虽已结束,但数值在截止后才发布,当时也不能用。

2 · Least squares

Draw observed (y) against forecast (x). Choose the line y = a·x + b that makes the sum of squared vertical distances smallest: a = Σ(x − x̄)(y − ȳ) / Σ(x − x̄)², b = ȳ − a·x̄. a below 1 means the forecast spreads too much; b shifts the whole line.

以预报为 x、实测为 y 画散点。选出让所有点到线的竖直距离平方和最小的直线 y = a·x + b:a = Σ(x − x̄)(y − ȳ) / Σ(x − x̄)²,b = ȳ − a·x̄。a 小于 1 说明预报的起伏偏大;b 让整条线上下平移。

3 · More inputs, more risk

M6 adds the last complete day's high as a second input. With few days, an extra input can just fit noise: more complex is not automatically more accurate. With fewer than 10 past pairs M5 falls back to the raw forecast; that is honesty, not laziness.

M6 再加入最后一个完整日的最高温作第二个输入。日子少时,多一个输入可能只是拟合了噪声:更复杂不等于更准。历史不足 10 对时 M5 退回预报原值,这是诚实,不是偷懒。

Worked example with real Boston data: the scatter

Each dot is one of the 47 days: forecast on the horizontal axis, observed on the vertical axis, both °F. The dashed diagonal is "forecast was exactly right". Count dots above and below it; the page counts too.

每个点是 47 天中的一天:横轴预报,纵轴实测,单位 °F。虚线对角线表示「预报完全正确」。数一数线上方和下方各有几个点;页面也会数。

…

Activity A · Fit the line yourself

Move a and b. The page shows the sum of squared errors (SSE) and the MAE of your corrected forecast on the same 47 pairs. Try to make SSE as small as you can, then press the button to see the least-squares answer. (This fits on all 47 days to learn the idea; the real M5 in Activity B only uses past days.)

移动 a 和 b。页面显示你的修正预报在这 47 对上的平方误差和(SSE)与 MAE。尽量把 SSE 调小,再按按钮看最小二乘的答案。(这里用全部 47 天来理解思路;活动 B 里真正的 M5 只用过去的日子。)

Activity B · Walk forward, then try to cheat

Part 1: compare the raw forecast (M2) with M5 and M6, each fitted only on days up to D−2 before every target day.

第 1 部分:比较预报原值(M2)与 M5、M6;每个目标日都只用 D−2 及以前的日子拟合。

LinenMAE °Fbias °F

Part 2, the leak test: pick a target day. The page adds +100 °F to the observed high of that day and every later day (including D−1, which is not complete at the cutoff) and recomputes. An honest model's prediction must not move. A "leaky" fit that also trains on the target day is shown for contrast.

第 2 部分,泄漏测试:选一个目标日。页面把这一天及之后每一天(包括截止时尚未完整的 D−1)的实测最高温都加 100 °F 再重算。诚实模型的预测不应改变。作为对照,也显示一个把目标日也拿去训练的「泄漏」拟合。

Modelpredictionafter +100verdict

Check for understanding

Questions 1 to 4 use the SYNTHETIC information pack.

ItemCoversPublishedContent
A30 Nov1 Dec 02:00high 8 °C
B1 Dec2 Dec 02:00high 10 °C
C2–4 Dec1 Dec 15:00model forecast 9, 12, 11 °C
D2 Dec3 Dec 02:00high 12 °C

1. Which of A–D could be used at the shared cutoff?A–D 哪些可在共同截止时使用?

Answer

A and C. B and D cannot: B's day had partly happened, but the complete value was published after the cutoff.

A、C 可以;B、D 不可以。B 那天虽然已发生一部分,但完整日值在截止后才发布。

2. Later the three days were observed at 12, 14 and 13 °C. Persistence uses A (8, 8, 8); the sealed forecast was 9, 12, 11. Find both MAEs and the difference.后来三天实测为 12、14、13 °C。持续性用 A(8、8、8);封存预测为 9、12、11。求两个 MAE 及差值。

Hint 1: persistence errors are 12 − 8, 14 − 8, 13 − 8.提示 1:持续性误差是 12 − 8、14 − 8、13 − 8。
Hint 2: the forecast errors are 3, 2, 2. Divide each sum by 3.提示 2:预测误差为 3、2、2。两组各自总和除以 3。
Answer

Baseline (4 + 6 + 5)/3 = 5 °C. Sealed forecast (3 + 2 + 2)/3 = 7/3 ≈ 2.33 °C. Difference 8/3 ≈ 2.67 °C, for this sample only.

基准 (4 + 6 + 5)/3 = 5 °C;封存预测 (3 + 2 + 2)/3 = 7/3 ≈ 2.33 °C;差 8/3 ≈ 2.67 °C,只针对这组样本。

3. Which version counts? V1 received 1 Dec 16:20 EST (8, 10, 10); V2 1 Dec 17:55 EST (9, 12, 11); V3 3 Dec 03:00 EST (12, 14, 13).哪个版本计分?V1 于 12 月 1 日 16:20 EST 收到(8、10、10);V2 于 12 月 1 日 17:55 EST(9、12、11);V3 于 12 月 3 日 03:00 EST(12、14、13)。

Answer

V2, the on-time complete version with the highest server sequence number. V3 is kept as a late learning revision. Importing files in a different order or turning a wall clock back does not change this.

V2:合格完整版中服务器序号最大者。V3 作为晚交学习修订保留。换导入顺序或拨回墙钟都不改变结果。

4. An AI write-up says: "I used the complete 1 Dec high (10 °C) as the baseline and my model won significantly." Find two problems.一段 AI 说明:「我用完整的 12 月 1 日最高温 10 °C 作基准,模型显著胜出。」找出两个问题。

Answer

First, the complete 1 Dec value was not available at the cutoff. Second, three days cannot support "significant". Fix: freeze the list of legal inputs, recompute on the same window and lead time, and report only this sample.

一是完整 12 月 1 日值在截止时还拿不到;二是三天数据不足以说「显著」。修正:冻结合法资料清单,在同窗口、同提前量下重算,只报告该样本。

5. If every temperature (forecast and observed) is raised by 10 °F, how do a and b change? And if you switch everything from °F to °C?若所有温度(预报与实测)都加 10 °F,a、b 怎么变?若全部从 °F 换成 °C 呢?

Answer

Adding 10 to both: a stays the same, b changes (by 10 × (1 − a)). Switching units: a stays the same (it is a ratio of like units); b is converted along with the unit change.

两者都加 10:a 不变,b 改变(变化量为 10 × (1 − a))。换单位:a 不变(同单位之比);b 随单位换算。

6. If you fit the line using the target day's own observation, the MAE becomes tiny. Why can that score not count?若拟合时用了目标日自己的实测,MAE 会很小。为什么这个分不能要?

Answer

Because that value did not exist at the cutoff. It is a leak; the leak test in Activity B catches exactly this.

因为截止时这个值还不存在。这就是泄漏;活动 B 的泄漏测试正是用来抓它的。

Classroom: 20-minute round touch

0–3Read the S-04 card (target 2026-11-28, cutoff 2026-11-27 18:00 EST = 23:00 UTC).读 S-04 题卡(目标日 2026-11-28,截止 2026-11-27 18:00 EST = 23:00 UTC)。
3–8List what is legally available now, with its publish time. Cross out anything published after the cutoff.列出现在合法可用的资料及其发布时间;划掉截止后才发布的。
8–13Seal: raw forecast, M3-style or M5-style correction; one sentence saying which and why.封存:原值、M3 式或 M5 式修正;一句话说明选哪个、为什么。
13–18After the reveal: compare with line M5 on the round page.揭晓后:与轮次页上的 M5 线对照。
18–20Write one line for next time's input list; do not change models yet.为下一次写一行资料清单;暂不更换模型。
Full 60-minute lesson plan
0–5"If you saw the answer first, is it still a prediction?" Then: "Does the forecast miss by the same amount on hot and cold days?" Write a guess.「看见答案再预测,还叫预测吗?」再问:「预报在热天和冷天偏得一样多吗?」先写猜测。
5–15Four times; sort A–D with three pen colours (usable then, known later, not yet verified).四种时间;用三种笔色给 A–D 分类(当时能用、后来才知道、尚未验证)。
15–30Scatter with the 45° line; hand-compute a and b for six points; compare with Activity A.带 45° 线的散点图;用 6 个点手算 a、b,与活动 A 对照。
30–40What a below 1 means; what b means; versions V1–V3.a 小于 1 意味着什么;b 是什么;版本 V1–V3。
40–50M6: why D−1 cannot be the second input; does M6 beat M5 here? Give a reason.M6:为什么第二个输入不能用 D−1;这里 M6 是否胜过 M5?说出原因。
50–60Leak test demo; exit question: "With only 10 days of data, should M5 be used?"泄漏测试演示;出门题:「只有 10 天数据时,该不该用 M5?」

Age bands

10–12

A/B/C cards and the V1/V2/V3 choice; keep 7/3 as "about 2.33". On the scatter, count dots above and below the diagonal and move b only.

做 A/B/C 资料卡与 V1/V2/V3 选版;7/3 写成「约 2.33」。在散点图上数对角线上下的点,只移动 b。

13–15

All arithmetic; convert 18:00 EST to 23:00 UTC and to your own zone; move a and b to lower SSE before pressing fit.

完成全部算术;把 18:00 EST 换算为 23:00 UTC 和自己的时区;按拟合前先手动调 a、b 降低 SSE。

16–17

Derive a and b by setting the derivatives of SSE to zero; design checks on observed_end, published_at and received_at; explain why M6 may not beat M5 on few days.

令 SSE 对 a、b 的导数为零推出公式;设计 observed_end、published_at、received_at 三个检查;解释为什么样本少时 M6 未必胜过 M5。

No-device alternative. Print the two tables and a blank scatter grid. Learners plot six real day pairs read aloud by the teacher, draw a line by eye, then compute a and b with the formula. Receipts are simulated with a teacher sign-off card clearly marked "classroom sign-off", never presented as server time.

无设备替代。打印两张表和空白散点格。教师朗读 6 对真实数据,学生描点、目测画线,再用公式算 a、b。回执用写明「课堂签收」的教师签收卡模拟,不当作服务器时间。

Five numbers (after each round)

Math map for this unit

F-L2-SLOPEINTSlope vs y-intercept
F-L2-SLOPE2PTSlope from two points, consistent direction
EE-L2-FIXEDTERMLinear modelling with a fixed term
F-L2-FUNCDEFFunction concept: one output per input
EE-L2-INEQWrite an inequality: boundary and direction

Sources: SOURCES.json · reference model bench · lesson text merged from m681 lesson 4, the L3 second-half least-squares plan, and week 4 of the spec 48 merge plan.