A vessel-washing robot turns every idea from Chapter 2 into one working decision. A cost matrix says what each mistake costs. Sensors, fused with naive Bayes, turn readings into a belief. Expected cost turns the belief into a programme. Learning from labelled examples supplies the models, and the learning curve says when to stop collecting data and start building a better sensor.
The chapter on one page¶
Key concepts¶
| Concept | Meaning | In this chapter |
|---|---|---|
| Cost matrix | cost of action when the state is | programme × vessel type, capturing under-cleaning, over-cleaning, damage |
| Blind decision | best single action using only the prior | standard, 2.75 per vessel |
| Oracle | a robot that always knows the true state | 1.85 per vessel |
| Value of perfect information | blind cost − oracle cost | 0.90 per vessel: the most any sensor could save |
| Naive Bayes | posterior ∝ prior × one likelihood per sensor | camera ratio, weight, grease |
| Cost vs. accuracy | a sensor’s worth is the mistakes it prevents, not how often it is right | camera 85% accurate but costlier than the scale at 72% |
| Informative but useless alone | evidence that never changes the decision | the grease sensor on its own |
| Maximum-likelihood estimate | the parameters that make the data most probable | fractions, means, spreads per vessel type |
| Laplace smoothing | add pseudo-counts so nothing is “impossible” | the greasy tumbler |
| Learning curve | test cost vs. training size | flattens near 1.96 |
| Confusion matrix | how often each true type is predicted as each type | “other” recognised only about half the time |
Important equations¶
| Equation | Name |
|---|---|
| expected cost of a programme | |
| oracle cost | |
| naive Bayes | |
| decision after sensing | |
| maximum-likelihood counts | |
| Laplace smoothing |
Review questions¶
Name the three kinds of mistakes in the washing robot’s cost matrix and give one example of each.
Why is standard the best programme when the robot has no sensors, even though it is the best choice for only two of the five vessel types?
What is an oracle, and why is its cost useful to an engineer choosing sensors?
Explain in your own words why the camera alone is more accurate than the scale alone but leads to a higher average cost.
The grease sensor alone does not reduce the average cost at all. Does that mean it measures nothing useful? Explain.
What does “naive” mean in naive Bayes? Give an example from the kitchen where the assumption fails.
Why must a learned model be tested on vessels it did not see during training?
What goes wrong if a probability is estimated as exactly zero? How does Laplace smoothing help?
What does it mean when a learning curve becomes flat? What should the engineer do next?
Why is a mistake on an “other” item potentially more costly than its small probability suggests?
Numerical problems¶
Problem 1 · Festival week. During a festival the vessel mix changes to plate 0.25, tumbler 0.25, bowl 0.20, cooking vessel 0.25, other 0.05. Using the chapter’s cost matrix: (a) Compute the expected cost of each programme with no sensors. (b) What is the oracle cost? (c) What is the value of perfect information, and how does it compare with a normal week (0.90)?
Answer
(a) Quick rinse 4.80, standard 3.65, heavy degrease 4.00, gentle 5.85. Standard is still best, but only just ahead of heavy degrease. (b) Oracle: . (c) per vessel, almost double the normal 0.90. With more greasy cooking vessels, sensing is worth more.
Problem 2 · One sensor reading. With the normal prior, the grease sensor reports “greasy”. Its model is for plate, tumbler, bowl, cooking vessel, other. (a) What is the probability that the grease sensor says “greasy” for a random vessel? (b) What is the posterior probability of cooking vessel? (c) Compute the expected cost of standard and heavy degrease under this posterior. Which does the robot choose?
Answer
(a) . (b) . (c) The posterior is plate 0.384, tumbler 0.040, bowl 0.224, cooking 0.288, other 0.064. Standard: . Heavy degrease: . The robot still chooses standard, which is why the grease sensor alone never changes the decision.
Problem 3 · Smoothing. In a small training set, 5 of 12 bowls came out greasy and 0 of 3 “other” items came out greasy. (a) Give the plain counting estimates of and . (b) Give the Laplace-smoothed estimates with . (c) Which estimate changed more, and why?
Answer
(a) Bowl ; other . (b) Bowl ; other . (c) “Other” changed far more. With only 3 examples, the pseudo-counts are a large share of the data; with 12 examples they matter much less. Smoothing matters most exactly where data is scarce.
Problem 4 · Learning a weight model. Five labelled kadais weighed 850, 920, 1010, 780, and 940 g. Estimate the mean and standard deviation of the cooking-vessel weight model.
Answer
Mean g. Deviations: −50, 20, 110, −120, 40; squares sum to 31 000; , so g. (The chapter’s model used 250 g. Five kadais from one kitchen show far less variety than a whole city’s cooking vessels, a reminder that small samples can under-estimate spread.)
Problem 5 · Is a sensor worth buying? Section 3.2 found these average costs per vessel: no sensors 2.77, camera + scale 1.96, all three sensors 1.95. The family washes 60 vessels a day, and one cost unit is worth ₹0.50. (a) How much does camera + scale save per year compared with no sensors? (b) How much extra does the grease sensor save per year? (c) The grease sensor costs ₹2,000 and needs cleaning every week. Is it worth adding?
Answer
(a) ₹8,870 per year. (b) ₹110 per year. (c) No, not for this family. It would take about 18 years to pay back its price, before counting the weekly cleaning. For a restaurant with many greasy vessels the answer could be different.
Problem 6 · Rare but costly. “Other” items are 5% of the 60 vessels washed daily. In the confusion matrix of Section 3.3, about 9% of “other” items were predicted as cooking vessel, and so received heavy degrease. (a) How many “other” items does the robot wash in 30 days? (b) About how many of them receive heavy degrease by mistake? (c) Why might this number worry the family more than the robot’s 97% overall accuracy suggests?
Answer
(a) items. (b) items a month. (c) Heavy degrease is the one programme that ruins non-stick coatings. A few such mistakes a month can destroy expensive tawas and pans, even though they barely dent the overall accuracy. Accuracy averages over all vessels; cost reveals which mistakes matter.
Mini-projects¶
Your own kitchen’s cost matrix. Time how long each programme takes and estimate its water and electricity use. Look up the price of replacing a non-stick tawa. Build your own cost matrix in rupees and recompute the blind choice, the oracle cost, and the value of perfect information.
The shiny-surface sensor. Add a fourth sensor, a reflectance reading that is high for glass and non-stick coatings, to the Section 3.2 simulation. Choose a sensible model for it, then measure how much it improves the cost and the “other” row of the confusion matrix.
Moving to a restaurant. Create a restaurant vessel mix with large buckets and serving trays as new types. Collect a small labelled set, retrain with Laplace smoothing, and plot the learning curve. How many labelled examples does the installer need before switching the robot on?
Chapter 3 in one minute¶
Turn the task into states, actions, and costs, with different costs for different kinds of mistakes.
With no sensors, pick the lowest expected-cost programme; the oracle gives the floor, and the gap is the most any sensor could save.
Fuse sensors with naive Bayes and choose by expected cost. Judge sensors by the decisions they improve, not by raw accuracy.
Learn models from labelled examples, smooth the counts, test on new data, and use the learning curve to decide between more data and a better sensor.