Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

2.5 Chapter 2 Summary and Exercises

Probability tells a robot how to represent uncertainty. Sensors provide imperfect evidence. Bayesian inference helps the robot update its beliefs when new evidence arrives. Decision theory turns those beliefs into actions by considering the consequences of being wrong.

The chapter on one page

The dashed arrow closes the loop from Chapter 1: after acting, the robot senses again, and the cycle repeats.

Key concepts

ConceptMeaningWhere we met it
Random variablea quantity whose value is not yet knownnext vessel type, next thermometer reading
PMFprobabilities of the values of a discrete random variable, summing to 1vessel types at the washing station
Gaussian N(μ,σ2)\mathcal{N}(\mu,\sigma^2)bell-shaped model for quantities affected by many small random effectstadka temperature readings
Mean, variance, standard deviationcentre and spread of a distributionthermometer readings
Sample mean, standard erroraverage of nn readings; its uncertainty shrinks as σ/n\sigma/\sqrt{n}5 vs. 20 vs. 50 temperature readings
Noise vs. failuresmall random error vs. a reading unrelated to the truthultrasonic readings at the gate
Sensor model p(z∣x)p(z \mid x)what readings to expect in a given stateultrasonic sensor, thermometer
Likelihood L(x)L(x)how well each possible state explains the observed reading“how likely is 2.4 m if the gate is at 2.3 m?”
Prior, posteriorbelief before and after the evidencetower belief before and after “green”
MAP estimatethe single most probable state“I am at Green Tower”
Sensor fusioncombining several imperfect sources with Bayes’ rulecamera + GPS + map
Expected costprobability-weighted average cost of an actioncontinue / slow down / brake
Dominated actionan action worse than another in every statecontinue in the e-cart example
Value of informationexpected saving from looking before actingone more camera frame at 8 vs. 25 km/h

Important equations

EquationName
∑xP(X=x)=1\sum_x P(X = x) = 1a PMF sums to one
tˉ=1n∑iti,s2=1n−1∑i(ti−tˉ)2\bar{t} = \frac{1}{n}\sum_i t_i, \quad s^2 = \frac{1}{n-1}\sum_i (t_i - \bar{t})^2sample mean and variance
p(t)=12πσ2e−(t−μ)2/2σ2p(t) = \frac{1}{\sqrt{2\pi\sigma^2}} e^{-(t-\mu)^2/2\sigma^2}Gaussian density
σtˉ=σ/n\sigma_{\bar{t}} = \sigma / \sqrt{n}standard error of the mean
z=x+vz = x + vmeasurement = truth + noise
L(x)=p(zobs∣x)L(x) = p(z_{\text{obs}} \mid x)likelihood
P(x∣z)=P(z∣x) P(x)∑x′P(z∣x′) P(x′)P(x \mid z) = \dfrac{P(z \mid x)\,P(x)}{\sum_{x'} P(z \mid x')\,P(x')}Bayes’ rule
x^MAP=arg⁡max⁡xP(x∣z)\hat{x}_{\text{MAP}} = \arg\max_x P(x \mid z)MAP estimate
P(x∣z1,z2)∝P(z1∣x) P(z2∣x) P(x)P(x \mid z_1, z_2) \propto P(z_1 \mid x)\,P(z_2 \mid x)\,P(x)fusing independent sources
E[C(a)]=∑xP(x) C(a,x),a⋆=arg⁡min⁡aE[C(a)]\mathbb{E}[C(a)] = \sum_x P(x)\,C(a,x), \quad a^\star = \arg\min_a \mathbb{E}[C(a)]expected cost and best action
VOI=min⁡aE[C(a)]−∑zP(z)min⁡aE[C(a)∣z]\text{VOI} = \min_a \mathbb{E}[C(a)] - \sum_z P(z)\min_a \mathbb{E}[C(a) \mid z]value of information

Review questions

  1. Why is “the next vessel will be a plate” a poor way for the washing robot to plan, even though plates are the most common vessel?

  2. What two conditions must every PMF satisfy? Why must the probabilities add up to exactly 1?

  3. Six thermometer readings of steady oil all differ. Give two physical reasons, and explain why this does not mean the thermometer is broken.

  4. What is the difference between the standard deviation of single readings and the standard error of their mean? Which one shrinks when the robot takes more readings?

  5. Explain, without equations, why z=x+vz = x + v means the robot can never know the true distance to the gate exactly.

  6. Give two examples of ultrasonic sensor failure on an Indian residential road and explain how each differs from ordinary noise.

  7. What is the difference between a sensor model p(z∣x)p(z \mid x) and a likelihood L(x)L(x)? Why do likelihoods not have to add up to 1?

  8. In the tower example, why is the posterior belief in Green Tower less than 1 even though the camera is 90% reliable?

  9. What does the MAP estimate tell the robot, and what does it not tell it?

  10. When is it wrong to multiply the likelihoods of two sensors? Give an example involving GPS and a camera.

  11. Explain why the e-cart should brake even when the most probable object is a dog.

  12. Why does the value of one more camera frame fall to zero when the cart is already very sure it is facing a pedestrian?

Numerical problems

Use only the models from this chapter. Answers are hidden below each problem; try it first.

Problem 1 · Vessel-washing station. Using the PMF plate 0.40, tumbler 0.25, bowl 0.20, cooking vessel 0.10, other 0.05, and assuming vessels arrive independently: (a) How many plates should the robot expect among 60 vessels? (b) What is the probability that the next vessel is not a plate? (c) What is the probability that the next two vessels are both tumblers? (d) What is the probability that at least one of the next three vessels is a cooking vessel?

Answer

(a) 60×0.40=2460 \times 0.40 = 24 plates. (b) 1−0.40=0.601 - 0.40 = 0.60. (c) 0.25×0.25=0.06250.25 \times 0.25 = 0.0625. (d) The chance that none of three is a cooking vessel is 0.93=0.7290.9^3 = 0.729, so at least one: 1−0.729=0.2711 - 0.729 = 0.271.

Problem 2 · Tadka thermometer. Five readings of steady oil are 167, 171, 169, 173, 170 °C. (a) Compute the sample mean and sample variance. (b) Compute the standard error of the mean. (c) If the robot took 20 readings with the same spread, what would the standard error be?

Answer

(a) Mean =850/5=170= 850/5 = 170 °C. Deviations are −3, 1, −1, 3, 0; squares sum to 20; s2=20/4=5s^2 = 20/4 = 5 °C², so s≈2.24s \approx 2.24 °C. (b) 2.24/5≈1.02.24/\sqrt{5} \approx 1.0 °C. (c) 2.24/20≈0.52.24/\sqrt{20} \approx 0.5 °C: four times the readings, half the uncertainty.

Problem 3 · Ultrasonic sensor at the gate. The sensor model is z∼N(d,σ(d)2)z \sim \mathcal{N}(d, \sigma(d)^2) with σ(d)=0.02+0.03 d\sigma(d) = 0.02 + 0.03\,d. (a) The reading is z=2.0z = 2.0 m. Compute L(d)L(d) for d=1.9,2.0,2.1d = 1.9, 2.0, 2.1 m and say which explains the reading best. (b) After a reading of 2.0 m the robot drives 0.2 m straight towards the gate, then reads 3.8 m. Is this noise or failure? Justify with the sensor model.

Answer

(a) σ(1.9)=0.077\sigma(1.9) = 0.077, σ(2.0)=0.080\sigma(2.0) = 0.080, σ(2.1)=0.083\sigma(2.1) = 0.083. The likelihoods are about 2.23, 4.99, and 2.33, so d=2.0d = 2.0 m explains the reading best, and 1.9 m and 2.1 m each explain it a little under half as well. (b) The gate should now be about 1.8 m away, where σ=0.074\sigma = 0.074 m. A reading of 3.8 m is (3.8−1.8)/0.074≈27(3.8 - 1.8)/0.074 \approx 27 standard deviations away, which is essentially impossible as noise. It is a failure, most likely a lost echo, and the reading should be discarded.

Problem 4 · Tower signboards. The robot starts with a uniform prior (0.25 for each tower). The camera likelihoods for “green” are Blue 0.05, Green 0.90, Yellow 0.04, Red 0.03. (a) Compute the posterior after one “green” detection. (b) The camera says “green” again. Using (a) as the new prior, compute the updated belief in Green Tower. (c) What is the MAP estimate after each step?

Answer

(a) Products: 0.0125, 0.225, 0.010, 0.0075; total 0.255. Posterior: Blue 0.049, Green 0.882, Yellow 0.039, Red 0.029. (b) Multiply by the likelihoods again and normalize: Green ≈ 0.994 (Blue 0.003, Yellow 0.002, Red 0.001). (c) Green both times; the second detection mainly increases confidence.

Problem 5 · E-cart near a school. At school dismissal time the belief is pedestrian 0.70, dog 0.20, cow 0.10. Using the honest cost matrix (continue 100/30/70, slow down 20/10/20, brake 15/15/15): (a) Compute the expected cost of each action. (b) Which action should the cart take? (c) What is the smallest value of P(pedestrian)+P(cow)P(\text{pedestrian}) + P(\text{cow}) for which braking beats slowing down?

Answer

(a) Continue 70+6+7=8370 + 6 + 7 = 83; slow down 14+2+2=1814 + 2 + 2 = 18; brake 15. (b) Brake. (c) Slow down costs 20P(ped)+10P(dog)+20P(cow)=10+10 [P(ped)+P(cow)]20P(\text{ped}) + 10P(\text{dog}) + 20P(\text{cow}) = 10 + 10\,[P(\text{ped}) + P(\text{cow})]. This exceeds 15 when P(ped)+P(cow)>0.5P(\text{ped}) + P(\text{cow}) > 0.5.

Problem 6 · Value of one more look. The belief is pedestrian 0.25, dog 0.65, cow 0.10. Use the honest cost matrix, the camera table from Section 2.4, and a waiting cost of 2 units per metre travelled during a 0.3 s look. (a) What is the best action now, and its expected cost? (b) The value of information works out to about 1.11. Up to what speed is another look worth it? (c) Should the cart look again at 5 km/h? At 10 km/h?

Answer

(a) Continue 51.5, slow down 13.5, brake 15, so slow down, at 13.5. (b) Waiting cost =2×(v/3.6)×0.3= 2 \times (v/3.6) \times 0.3. Setting this equal to 1.11 gives v≈6.7v \approx 6.7 km/h. (c) At 5 km/h waiting costs about 0.83 < 1.11, so look again. At 10 km/h it costs about 1.67 > 1.11, so act now.

Mini-projects

  1. Learn the kitchen’s PMF. Write a small simulator that logs a week of vessels arriving at the washing station, with a different mix at breakfast, lunch, and dinner. Estimate a PMF for each meal from the log and show how the estimates improve as the log grows.

  2. Tower localizer. Simulate the delivery robot driving through the complex, passing several signboards, with the camera’s full confusion table and a GPS model. Update the belief with Bayes’ rule after every observation and plot how quickly it settles on the right tower. Then break the independence assumption on purpose and observe the over-confidence.

  3. E-cart decision explorer. Build an interactive notebook with sliders for the three object probabilities, the cost matrix entries, and the cart’s speed. Show the decision triangle, the expected costs, and whether another look is worth it. Use it to argue for sensible costs in a school zone and on a monsoon evening.

Chapter 2 in one minute