TactivergeLite

Lite / Intelligent Robotic Systems / Week 26

Expected value: deciding when you can't be sure

A part is 15% likely to be faulty. Ship it, scrap it or check it again? There's a calculation for that.

About 40 min · 3 goals · Checked by automated tests · Full interactive version

Why should I care?

A perception system's output is a probability; a machine must still act. Expected value connects the two: it turns 'probably faulty' and 'a return costs £200' into a decision rule and a threshold you can defend.

Predict

A part is 15% likely to be faulty. Shipping a faulty part costs £200; scrapping any part costs £20. Which is cheaper on average?

  1. Ship: most parts are fine
  2. Scrap: 15% × £200 = £30 is more than £20
  3. They cost the same
Guess first, then reveal

Expected cost of shipping = 0.15 × £200 = £30; scrapping costs £20 for certain. Scrap wins on average, even though the part is 85% likely to be good. The costs are lopsided, so the decision is too.

Discover

With the default costs, sweep p from 0 to 100% and note where the best action changes. Read the break-even points from the chart and check them by hand. Now make re-inspection free, then expensive. When is checking again worth it?

What the interactive shows (text version)

The chart plots expected cost against the probability of a fault for three actions: shipping (a line rising from £0 to £200), scrapping (flat at £20) and re-inspecting (rising gently from £8 to £28). With the defaults, shipping is cheapest below about 4%, re-inspecting between about 4% and 60%, and scrapping above about 60%.

You can also open the interactive on the full site when you have a faster connection.

Understand

Expected value

For an action with possible outcomes, expected cost = Σ (probability of outcome × cost of outcome). Shipping a part that is faulty with probability p: p × (return cost) + (1 − p) × 0. Compute it for every action and choose the smallest. It is the average cost per decision over many similar decisions.

Thresholds from costs

Ship beats scrap while p × C_miss < C_scrap, so the decision threshold is p* = C_scrap ÷ C_miss. With £20 and £200 that is 10%: scrap anything more than 10% likely to be faulty. This is how a probability from Bayes' rule becomes an action, and why the 'right' detector threshold depends on costs.

The value of a second look

Re-inspection costs something but removes uncertainty: expected cost = C_check + p × C_scrap (scrap only if it really is faulty). It wins in the middle range of p, where you are genuinely unsure, and loses when you're already nearly certain either way.

What averages hide

Expected value treats a 1% chance of a £10,000 disaster like a certain £100 loss. When outcomes include injury or irreversible harm, engineers add constraints (never ship above some risk, whatever the average) instead of just minimising expected cost.

Explain it another way

Intuitive

Taking an umbrella: if rain is only 20% likely but getting soaked ruins your day, you take it anyway, because the bad outcome is so much worse than carrying an umbrella.

Technical

Bayes decision rule: choose the action a minimising Σₛ P(s | evidence)·L(a, s), where L is the loss table. For two actions and two states it reduces to a threshold on P(s | evidence) set by the loss ratio.

Mathematical

Ship vs scrap: p·M = S gives p* = S/M. Check vs ship: C + p·S = p·M gives p = C/(M − S). Check vs scrap: C + p·S = S gives p = 1 − C/S.

Applied

Autonomous vehicles weigh the cost of an unnecessary emergency brake against a missed obstacle. Because a miss can injure someone, designers set hard safety constraints rather than relying on average cost alone.

Worked example 1

p = 30%, miss £200, scrap £20, re-inspect £8. Which action?

Ship: 0.3 × 200 = £60. Scrap: £20. Check: 8 + 0.3 × 20 = £14. Re-inspect, which is cheapest on average.

Common mix-ups

Practice

Practice, not a test. Answers are checked on our server; a wrong answer gets a hint and another try. Nothing is saved.

£

£

%

£

Practice 5. A robot's choice has a 0.1% chance of injuring someone. Why isn't expected cost alone the right tool?

Apply it

Combine this week: take the Bayes posterior for a flagged part (base rate 2%, sensitivity 90%, false positives 5%) and the costs £200 miss, £20 scrap, £8 re-inspection. Decide what to do with flagged and unflagged parts, and compute the expected cost per 1,000 parts of your policy.

Reflect

Where in your own life have you made an expected-value decision without calling it that?

Write your answer on paper or in your own notes. Lite never stores what you write.

← Conditional probability, Bayes and base ratesDesigning a perception pipeline →