Midterm 自拟练习|B 概率
自拟练习 B 概率:英文题干,逐题折叠中文解析、英文参考答案与回查页码。
手机上宽表格可左右滑动;自测答案默认收起,点击题目下方按钮查看。
使用边界:2026-11-04 课堂期中复习,非官方材料;考试安排按讲师通知整理,正式要求以讲师通知和课堂公告为准。主体覆盖 L01–L07、Tutorial 1–5 与 Assignment 1;通知列出的课件只到 Lecture 7,L08 放在第 08 节作范围存疑附节。练习题均为自拟,不是往年真题或预测卷。
复习资料:范围与搜索 · 概率与逻辑 · 机器学习与聚类 · 神经网络与 L08 附节
先做题再看解析:A 搜索 · B 概率 · C 逻辑 · D 机器学习 · E 聚类与神经网络 · F 论文与 PyTorch
怎么做:先只看题面,用英文作答,写出公式和每一步,再展开解析核对。解析里的数值都用 python 复算过;每题末尾给回查出处,页码为 PDF 页序。
B 概率
B1 · Joint table and independence
Two binary events A and B have the joint distribution: P(A, B) = 0.12, P(A, ¬B) = 0.28, P(¬A, B) = 0.18, P(¬A, ¬B) = 0.42.
(a) Compute P(A), P(B) and P(A|B). (b) Are A and B independent? Justify with a calculation.
B1 · 查看答案与解析
推理过程:边缘概率把对应行相加,条件概率用定义。
- P(A) = 0.12 + 0.28 = 0.4
- P(B) = 0.12 + 0.18 = 0.3
- P(A|B) = P(A, B)/P(B) = 0.12/0.3 = 0.4
答案:P(A)P(B) = 0.4 × 0.3 = 0.12,正好等于 P(A, B),所以 A 与 B 独立。也可以看 P(A|B) = P(A) = 0.4。
English: A and B are independent because P(A, B) = P(A)P(B); equivalently, knowing B does not change the probability of A.
易错点:分母是 P(B),要把 B 为真的两行加起来,不是查表里的单个格子。
回查:L03a p.12–13;T04 p.10。
B2 · Bayes rule for a spam word
In a mailbox, 20% of e-mails are spam. The word “prize” appears in 60% of spam e-mails and in 5% of non-spam e-mails. An e-mail contains “prize”. What is the probability that it is spam? Show the prior, the likelihoods and the evidence.
B2 · 查看答案与解析
推理过程:先验 P(S) = 0.2,P(¬S) = 0.8;似然 P(w|S) = 0.6,P(w|¬S) = 0.05。
- 分子 P(w|S)P(S) = 0.6 × 0.2 = 0.12
- 证据 P(w) = 0.12 + 0.05 × 0.8 = 0.12 + 0.04 = 0.16
- 后验 P(S|w) = 0.12/0.16 = 0.75
答案:0.75。
English: By Bayes’ rule, the posterior P(spam | word) equals the likelihood times the prior divided by the evidence, and the evidence is obtained with the law of total probability.
易错点:不要把 0.6 当成答案,那是 P(w|S),方向反了。分母要包含非垃圾邮件那一项。
回查:L03a p.15–17。
B3 · Converging connection
A Bayesian network has three binary nodes: Rain R and Sprinkler S are both parents of WetGrass W, and R and S have no parents. P(R) = 0.2, P(S) = 0.4. P(W | R, S) = 0.95, P(W | R, ¬S) = 0.8, P(W | ¬R, S) = 0.7, P(W | ¬R, ¬S) = 0.05.
(a) Compute P(R, S, W). (b) Compute P(W) and P(R | W). (c) Compute P(R | W, S) and explain why it is smaller than P(R | W).
B3 · 查看答案与解析
推理过程:联合概率按父节点连乘;R 与 S 无父节点,W 未观测时两者独立。
| R | S | P(R)·P(S)·P(W|R,S) | |—|—|—| | 真 | 真 | 0.2 × 0.4 × 0.95 = 0.076 | | 真 | 假 | 0.2 × 0.6 × 0.8 = 0.096 | | 假 | 真 | 0.8 × 0.4 × 0.7 = 0.224 | | 假 | 假 | 0.8 × 0.6 × 0.05 = 0.024 |
答案:
(a) P(R, S, W) = 0.076。
(b) P(W) = 0.076 + 0.096 + 0.224 + 0.024 = 0.42;P(R|W) = (0.076 + 0.096)/0.42 = 0.172/0.42 ≈ 0.4095。
(c) P(R|W, S) = 0.076/(0.076 + 0.224) = 0.076/0.3 ≈ 0.2533。已知洒水器开着,湿草地已经有了另一个解释,下雨的后验概率下降,这就是 explaining away。
English: In a converging connection the parents are independent while the child is unobserved; once the child is observed, evidence for one parent explains away the other.
易错点:(a) 要用 P(¬S) = 0.6 等补概率时别漏算;(c) 的分母只取 S 为真的两行。
回查:L03a p.21–25;T04 p.7–8。
B4 · Counting parameters
Five binary variables have this structure: A and B have no parents; C has parents A and B; D has parent C; E has parent C.
(a) How many numbers are needed for the full joint probability table? How many of them are free? (b) Counting one number P(X = true | parents) for each parent configuration, how many numbers does the network need?
B4 · 查看答案与解析
推理过程:联合表每种取值一项;网络每个节点按父节点组合计数。
- 联合表:2⁵ = 32 项,总和为 1,自由参数 31 个。
- 网络:A 1 个,B 1 个,C 有两个父节点共 4 个,D 2 个,E 2 个,合计 1 + 1 + 4 + 2 + 2 = 10 个。
答案:(a) 32 项,31 个自由参数;(b) 10 个。
English: A joint table grows exponentially with the number of variables, while a Bayesian network grows exponentially only with the number of parents of each node.
易错点:根节点也要算一个数;按课件口径每种父节点组合只记 P(X 为真)。
回查:L03a p.24;L03a 补充节。
B5 · Concept check
Answer True or False and give one reason for each.
(a) If two events are mutually exclusive and both have non-zero probability, they are independent. (b) If A and B are conditionally independent given C, then A and B are independent. (c) In the lecture’s disease test, the probability of having the disease after a positive result is about 0.99.
B5 · 查看答案与解析
答案:
(a) False。互斥时 P(EF) = 0,而 P(E)P(F) > 0,两者不相等,所以不独立。
(b) False。条件独立与独立互不蕴含。
(c) False。0.99 是 P(+|D);后验 P(D|+) ≈ 0.0194,因为患病率只有 0.001。
English: (a) Mutually exclusive events with non-zero probabilities are dependent. (b) Conditional independence does not imply independence. (c) Confusing P(+|D) with P(D|+) ignores the prior; this is the base-rate fallacy.
易错点:(c) 别把灵敏度读成准确率或后验。
回查:L03a p.13、p.16–17、p.19。
B6 · Monty Hall with four doors
A car is behind one of four doors, each with probability 1/4. You pick door 1. The host knows where the car is, never opens your door and never reveals the car; he chooses uniformly among the doors he is allowed to open. He opens door 2 and shows a goat.
(a) Give the likelihood P(host opens door 2 | car behind door k) for k = 1, 2, 3, 4. (b) Compute the posterior for each door. Should you switch to door 3? (c) Repeat (b) if the host does not know where the car is, opens one of doors 2, 3, 4 at random, and it happens to show a goat.
B6 · 查看答案与解析
推理过程:Hₖ 表示车在门 k,O₂ 表示主持人开 2 号门。主持人知情时:车在 1 号门,他在 2、3、4 里等可能选,似然 1/3;车在 2 号门,他不能开,似然 0;车在 3 或 4 号门,他只能在剩下两扇羊门里选,似然各 1/2。
- P(O₂) = 1/4 × (1/3 + 0 + 1/2 + 1/2) = 1/3
- P(H₁|O₂) = (1/4 × 1/3)/(1/3) = 1/4
- P(H₃|O₂) = P(H₄|O₂) = (1/4 × 1/2)/(1/3) = 3/8
主持人不知情时,车在 1、3、4 号门的似然都是 1/3,车在 2 号门为 0,后验各 1/3。
答案:(a) 1/3、0、1/2、1/2。(b) 1 号门 1/4,2 号门 0,3、4 号门各 3/8,换到 3 号门更好。(c) 1、3、4 号门各 1/3,换不换一样。
English: The likelihood of the host’s choice depends on where the car is. With an informed host, the posterior of door 3 is 3/8, larger than 1/4 for door 1, so switching helps. With an uninformed host who happens to show a goat, doors 1, 3 and 4 all have 1/3.
易错点:不能数概率树的叶子,各叶子的概率不同;主持人知不知情改变的是似然,不是先验。
回查:L03a p.15–17;T04 p.11–15。
B7 · Bayes rule for a noisy channel
A channel sends only two symbols, X and Y, in the ratio 3:1. X is received as Y with probability 0.04, and Y is received as X with probability 0.10.
(a) A Y is received. What is the probability that a Y was sent? Define the events first. (b) Compute the probability that an X was sent given that an X is received.
B7 · 查看答案与解析
推理过程:Sx、Sy 表示发出 X、Y,Ry 表示收到 Y。3:1 换成先验 P(Sx) = 0.75、P(Sy) = 0.25。P(Ry|Sx) = 0.04,P(Ry|Sy) = 1 − 0.10 = 0.9。
- P(Ry) = 0.75 × 0.04 + 0.25 × 0.9 = 0.03 + 0.225 = 0.255
- P(Sy|Ry) = 0.225/0.255 = 15/17 ≈ 0.882
- P(Rx) = 0.75 × 0.96 + 0.25 × 0.10 = 0.745,P(Sx|Rx) = 0.72/0.745 ≈ 0.966
答案:(a) 约 0.882。(b) 约 0.966。
English: Let Sy be “Y is sent” and Ry be “Y is received”. By the law of total probability, P(Ry) = P(Ry|Sx)P(Sx) + P(Ry|Sy)P(Sy) = 0.255, and by Bayes’ rule P(Sy|Ry) = 0.225/0.255 ≈ 0.882.
易错点:0.10 是 Y 被错收的概率,P(Ry|Sy) 要用 0.9;分母漏掉「X 错收成 Y」那一项,结果会变成 1。
回查:L03a p.15–17;T04 p.5–10。
个人整理的学习笔记,不是官方材料;数字与结论以课件和讲师为准。