AI AI-03.04
Decision theory and utility
Expected utility, the value of information, and decision networks: how an agent turns uncertain beliefs into the best action, and when to ask first.
The big idea
Bayesian networks tell an agent what to believe. They do not tell it what to do. A 30 percent chance of rain does not by itself say whether to carry an umbrella: that depends on how bad it is to get wet and how annoying it is to carry an umbrella all day. A fraud model's 2 percent risk score does not say whether to block a payment: that depends on the cost of fraud and the cost of angering a good customer.
Decision theoryThe theory of choosing actions under uncertainty by combining probabilities of outcomes with utilities that measure how much each outcome is wanted. joins beliefs to preferences. Give every outcome a number, its utilityA number expressing how much an agent values an outcome. Higher is better; only differences and ratios of differences matter., then pick the action whose outcomes are best on average, weighted by their probabilities. It also answers a question every assistant, doctor and engineer faces: is it worth gathering more information before deciding, and how much would you pay for it?
Think of a weather app's rain percentage as a pair of glasses and your own tolerance for getting wet as your destination. The glasses are the same for everyone; two people looking through them can still sensibly make opposite choices.
How it works
Step 1: Utilities
Assign a utility to every combination of action and outcome. For the umbrella:
| Rain | Dry | |
|---|---|---|
| Take the umbrella | 70 (dry, but carrying it) | 80 (carried it for nothing) |
| Leave it at home | 0 (soaked) | 100 (perfect) |
The numbers are a statement of preference, not a fact about the world. Only their relative sizes matter: doubling every number, or adding 50 to each, changes no decision.
Step 2: Expected utility
The expected utilityThe probability-weighted average of an action's utilities over all its possible outcomes. A rational agent chooses the action that maximizes it. of an action is the average of its utilities, weighted by the probability of each outcome:
With a 30 percent chance of rain:
so a rational agent takes the umbrella. The principle of maximum expected utility says: always choose the action with the highest expected utility. It does not guarantee a good outcome on any single day. It guarantees the best average over many decisions like it.
Step 3: Decision networks
A decision networkA Bayesian network extended with decision nodes (choices) and utility nodes (scores), used to compute the action with the highest expected utility and the value of information. (or influence diagram) adds two kinds of node to a Bayesian network: decision nodes for choices and utility nodes for scores. An arrow into a decision node means "this is known when the decision is made".
To solve it, for each possible forecast, update the weather belief (Bayesian inference), compute each action's expected utility, and pick the best. The result is a policy: a rule saying what to do for each thing you might observe.
Try it
Try this:
- At P(rain) = 0.30 and hassle 20, taking the umbrella wins, 77 to 70. Drag the probability down: below the break-even of 0.22 leaving it wins. The best choice switches at a threshold, not gradually.
- Watch the pink gap, the value of knowing the weather first. It is largest exactly at the break-even point and shrinks toward zero at both ends: when you are already nearly sure, information cannot change your mind, so it is worth little.
- Set the hassle to 0. Taking the umbrella now never loses, and the value of information drops to zero everywhere. Information only has value if it could change what you do.
Going deeper
The value of information
The value of informationHow much the expected utility of the best decision would improve if you learned something before deciding. It is never negative, and is zero if the information could not change the decision. (VOI) is the expected utility of deciding after seeing some evidence, minus the expected utility of deciding now. For perfect information about the weather at P(rain) = 0.3: you would take the umbrella on rainy days and leave it on dry ones, scoring , compared with 77 now, so a perfect forecast is worth 14 points. Real forecasts are imperfect, and their value comes from Bayes' rule:
# Umbrella decision: utilities for (action, weather).
U = {("take", "rain"): 70, ("take", "dry"): 80,
("leave", "rain"): 0, ("leave", "dry"): 100}
ACTIONS = ["take", "leave"]
def best(p_rain):
"""Action with the highest expected utility, and that utility."""
eu = {a: p_rain * U[(a, "rain")] + (1 - p_rain) * U[(a, "dry")]
for a in ACTIONS}
a = max(eu, key=eu.get)
return a, eu[a]
def value_of_forecast(p_rain, accuracy):
"""Expected gain from deciding after seeing a forecast."""
_, eu_now = best(p_rain)
total = 0.0
for says in ("rain", "dry"):
# P(forecast says this) and P(rain | forecast), by Bayes' rule
p_says_rain = accuracy if says == "rain" else 1 - accuracy
p_says_dry = 1 - accuracy if says == "rain" else accuracy
p_says = p_rain * p_says_rain + (1 - p_rain) * p_says_dry
posterior = p_rain * p_says_rain / p_says
action, eu = best(posterior)
total += p_says * eu
print(f" forecast says {says:4} (p {p_says:.2f}): "
f"P(rain) -> {posterior:.2f}, {action}, EU {eu:.1f}")
return total - eu_now
p = 0.3
action, eu = best(p)
print(f"P(rain) = {p}: best action now is '{action}' with EU {eu:.1f}")
for acc in (0.55, 0.8, 1.0):
print(f" forecast accuracy {acc:.0%}:")
print(f" -> worth {value_of_forecast(p, acc):.1f} utility points")Output
P(rain) = 0.3: best action now is 'take' with EU 77.0
forecast accuracy 55%:
forecast says rain (p 0.48): P(rain) -> 0.34, take, EU 76.6
forecast says dry (p 0.52): P(rain) -> 0.26, take, EU 77.4
-> worth 0.0 utility points
forecast accuracy 80%:
forecast says rain (p 0.38): P(rain) -> 0.63, take, EU 73.7
forecast says dry (p 0.62): P(rain) -> 0.10, leave, EU 90.3
-> worth 7.0 utility points
forecast accuracy 100%:
forecast says rain (p 0.30): P(rain) -> 1.00, take, EU 70.0
forecast says dry (p 0.70): P(rain) -> 0.00, leave, EU 100.0
-> worth 14.0 utility points A 55 percent accurate forecast is worth exactly nothing here: whatever it says, the updated probability of rain stays above the break-even point, so you would take the umbrella anyway. An 80 percent forecast is worth 7 points, because a "dry" forecast pushes rain down to 10 percent and changes the decision. A perfect forecast is worth 14, the upper bound. Information is valuable in proportion to how much it can change the decision and how much is at stake when it does.
This is how a rational agent decides whether to run a medical test, ask a clarifying question, or call a slower but more accurate tool: if the expected improvement is smaller than the cost of asking, decide now.
Where utilities come from
Utilities can be money, but often should not be exactly money: most people prefer a sure 1,000 to a coin flip between 0 and 2,000, which is risk aversion, modelled by a utility that grows more slowly than wealth. Utilities can also combine several goals (time, cost, safety) with weights. Choosing them is a design decision with real consequences. A classifier's decision threshold is a utility choice in disguise: blocking a payment at 2 percent fraud risk only makes sense if missing fraud costs far more than annoying a customer.
Beyond one decision
When decisions follow each other and each changes what comes next, the agent must plan over sequences of uncertain outcomes. That is a Markov decision process, the subject of Sequential decisions: MDPs (bridge to RL) , and the foundation of reinforcement learning.
Trade-offs
| Option | Wins when | Loses when |
|---|---|---|
| Maximise expected utility | Repeated decisions where averages matter and utilities are well understood | One-shot catastrophic risks, and when utilities are disputed or hard to state |
| Fixed rules or thresholds | Simple, auditable decisions with stable costs | Ignore context; the threshold encodes utilities nobody wrote down |
| Gather information first | High stakes near a decision threshold, with cheap, informative evidence | Costs time and money; useless if it cannot change the choice |
Common mistakes
- Choosing the most probable outcome's best action instead of the action with the highest expected utility. A 30 percent chance of a large loss can dominate.
- Paying for information that cannot change the decision. Check whether any possible result would flip the choice.
- Treating money as utility when risk matters. Losing a house and gaining a house are not symmetric.
- Hiding utilities inside a classifier threshold such as 0.5 without asking what errors cost.
In the wild
Where you will see this: medical decision analysis weighs treatment benefits, side effects and test costs; insurers and banks set approval and fraud thresholds from the costs of each kind of error; A/B testing and experimentation platforms decide when collecting more data is worth the delay; and AI assistants and agents that ask a clarifying question only when the answer would change what they do are applying the value of information.
Check yourself
-
P(rain) = 0.5. Take: 70 if rain, 80 if dry. Leave: 0 if rain, 100 if dry. Which action has the higher expected utility?
Show answer
A. Take (75 vs 50) EU(take) = 0.5 x 70 + 0.5 x 80 = 75; EU(leave) = 0.5 x 0 + 0.5 x 100 = 50.
-
When is the value of information zero?
Show answer
B. When no possible result would change the decision If you would choose the same action whatever the information says, knowing it cannot improve your expected utility.
-
Near which probability is a weather forecast most valuable for the umbrella decision?
Show answer
C. Near the break-even probability where both actions are equally good At the threshold, a small shift in belief flips the decision, so evidence matters most.
-
A fraud model flags payments above 0.5 risk. What does decision theory suggest?
Show answer
B. Set the threshold from the costs of missed fraud and of blocking good customers The best threshold is where the expected cost of blocking equals the expected cost of allowing, which depends on the utilities.
Recap
- Decision theory combines probabilities with utilities to choose actions.
- Choose the action with the highest expected utility: the probability-weighted average of its outcomes.
- Decision networks add decision and utility nodes to Bayesian networks; solving them yields a policy.
- The value of information is the gain from deciding after seeing evidence; it is zero if the evidence cannot change the decision.
- Thresholds in classifiers and agents are utility choices and should be set deliberately.