Plan
Why bother?
Two examples
Basic probability theory
Bayes’ rule
Bayes’ nets
The Bayesian brain
Reading: Russell &Norvig pp.462-488
AI Principles, Lecture on Reasoning Under Uncertainty
Why do we need reasoning under uncertainty?
There are many situations where uncertainty arises:
• When you travel you reason about the possibility of delays
• When an insurance company offers a policy it has calculated the risk that
you will claim
• When your brain estimates what an object is it filters random noise and fills
in missing details
• When you play a game you cannot be certain what the other player will do
• A medical expert system that diagnoses disease has to deal with the results
of tests that are sometimes incorrect
Systems which can reason about the effects of uncertainty
should do better than those that don’t
But how should uncertainty be represented?
AI Principles, Lecture on Reasoning Under Uncertainty
Probability Theory: Variables and Events
A random variable can be an observation, outcome or event the value of
which is uncertain.
e.g a coin. Let’s use Throw as the random variable denoting the
outcome when we toss the coin.
The set of possible outcomes for a random variable is called its domain.
The domain of Throw is {head, tail}
A Boolean random variable has two outcomes.
Cavity has the domain {true, false}
Toothache has the domain {true, false}
AI Principles, Lecture on Reasoning Under Uncertainty
Probability Theory: Atomic events
We can create new events out of combinations of the outcomes of
random variables
An atomic event is a complete specification of the values of the random
variables of interest
e.g. if our world consists of only two Boolean random variables, then the
world has a four possible atomic events
Toothache = true ^ Cavity = true
Toothache = true ^ Cavity = false
Toothache = false ^ Cavity = true
Toothache = false ^ Cavity = false
The set of all possible atomic events has two properties:
• It is mutually exhaustive (nothing else can happen)
• It is mutually exclusive (only one of the four can happen at one time)
AI Principles, Lecture on Reasoning Under Uncertainty
Probability theory: probabilities
We can assign probabilities to the outcomes of a random variable.
P(Throw = heads) = 0.5
P(Mary_Calls = true) = 0.1
P(a) = 0.3
Some simple rules governing probabilities
1. All probabilities are between 0 and 1 inclusive 0 P(a) 1
P (true) 1
2. If something is necessarily true it has probability 1
P ( false) 0
3. The probability of a disjunction being true is
P (a b) P (a ) P (b) P (a b)
From these three laws all of probability theory can be derived.
AI Principles, Lecture on Reasoning Under Uncertainty
Probability theory: relation to set theory
We can often intuitively understand the laws of probability
by thinking about sets
P (a b) P (a ) P (b) P (a b)
AI Principles, Lecture on Reasoning Under Uncertainty
Probability Theory: Conditional Probability
A conditional probability expresses the likelihood that one event a will
occur if b occurs. We denote this as follows
P ( a | b)
e.g.
P (Toothache true) 0.2
P (Toothache true | Cavity true) 0.6
So conditional probabilities reflect the fact that some events make other
events more (or less) likely
If one event doesn’t affect the likelihood of another event they are said
to be independent and therefore
P ( a | b) P ( a )
E.g. if you roll a 6 on a die, it doesn’t make it more or less likely that you
will roll a 6 on the next throw. The rolls are independent.
AI Principles, Lecture on Reasoning Under Uncertainty
Combining Probabilities: the product rule
How we can work out the likelihood of two events occuring
together given their base and conditional probabilities?
P (a b) P (a | b) P (b) P (b | a ) P (a )
So in our toy example 1:
P (toothache cavity) P (toothache | cavity) P (cavity)
P (cavity | toothache) P (toothache)
But this doesn’t help us answer our question:
“I have toothache. Do I have a cavity?”
AI Principles, Lecture on Reasoning Under Uncertainty
Bayes’ rule
We can rearrange the two parts of the product rule:
P (a b) P (a | b) P (b) P (b | a ) P (a )
P (a | b) P (b) P (b | a ) P (a )
P (b | a ) P (a )
P ( a | b)
P (b)
This is known as Bayes’ rule.
It is the cornerstone of modern probabilistic AI.
But why is it useful?
AI Principles, Lecture on Reasoning Under Uncertainty
Bayes’ rule
We can think about some events as being “hidden” causes: not
necessarily directly observed (e.g. a cavity).
If we model how likely observable effects are given hidden causes (how
likely toothache is given a cavity)
Then Bayes’ rule allows us to use that model to infer the likelihood of the
hidden cause (and thus answer our question)
P (effect | cause) P (cause)
P (cause | effect )
P (effect )
In fact good models of P (effect | cause ) often available to us in real
are
domains (e.g. medical diagnosis)
AI Principles, Lecture on Reasoning Under Uncertainty
Bayes’ rule can capture causal models
Suppose a doctor knows that a meningitis causes a stiff neck in 50% of cases
P ( s | m) 0.5
She also knows that the probability in the general population of someone having a
stiff neck at any time is 1/20
0.05 in the population (1/50,000)
P (ofs )meningitis
She also has to know the incidence
Using Bayes’ rule she can calculate the probability the patient has meningitis:
P (m) 0.00002
P ( s | m) P (m) 0.5 0.00002
P(m | s) 0.0002 1 / 5000
P( s) 0.05
P (effect | cause) P (cause)
P (cause | effect )
P (effect )
AI Principles, Lecture on Reasoning Under Uncertainty
The power of causal models
Why wouldn’t the doctor be better off if she just knew the likelihood of
meningitis given a stiff neck? I.e. information in the diagnostic direction
from symptoms to causes?
Because diagnostic knowledge is often more fragile than causal
knowledge
Suppose there was a meningitis epidemic? The rate of meningitis goes
up 20 times within a group
P ( s | m) P (m) 0.5 0.0004
P(m | s) 0.004 1 / 250
P( s) 0.05
The causal model is unaffected by the change in P(m), whereas the
diagnostic model P(m|s)=1/5000 is now badly wrong.
AI Principles, Lecture on Reasoning Under Uncertainty
Bayes rule: the normalisation short cut
If we know P(effect|cause) for every cause we can avoid having to know
P(effect)
P (e | c ) P (c ) P (e | c ) P (c )
P (c | e)
P (e) P (e | h ) P ( h )
hCauses
Suppose for two possible causes of a stiff neck, meningitis (m) and not
meningitis (¬m)
P ( Meningitis ) P ( s | m) P (m), P ( s | m) P (m)
We simply calculate the top line for each one and then normalise (divide
by the sum of the top line for all hypothesises
But sometimes it’s harder to find out P(effect|cause) for all causes
independently than it is simply to find out P(effect)
Note that Bayes’ rule here relies on the fact the effect must have arisen
because of one of the hypothesised causes. You can’t reason directly
about causes you haven’t imagined.
AI Principles, Lecture on Reasoning Under Uncertainty
Bayes’ rule: combining evidence
Suppose we have several pieces of evidence we want to
combine:
• John rings and Mary rings
• I have toothache and the dental probe catches on my tooth
How do we do this?
P (cavity | toothache catch) P (toothache catch | cavity) P (cavity)
As we have more effects our causal model becomes very
complicated (for N binary effects there will be 2N different
combinations of evidence that we need to model given a
cause)
P(toothache catch | cavity) , P(toothache catch | cavity )
AI Principles, Lecture on Reasoning Under Uncertainty
Bayes rule + conditional independence
In many practical applications there are not a few evidence variables but
hundreds
Thus 2N is very big
This nearly led everyone to give up and rely on approximate or
qualitative methods for reasoning about uncertainty
But conditional independence helps
Toothache and catch are not independent, but they are independent
given the presence or absence of a cavity.
In other words we can use the knowledge that cavities cause toothache
and they cause the catch, but the catch and the toothache do not cause
each other (they have a single common cause).
AI Principles, Lecture on Reasoning Under Uncertainty
Bayes’ nets
This can be captured in a picture, where the arcs capture conditional
independence relationships
Or in a new equation:
P(cavity | toothache catch) P(toothache catch | cavity) P(cavity)
P (toothache | cavity ) P (catch | cavity ) P(cavity )
Using conditional independence the causal model is much more
compact. Rather than the number of parameters being O(2 N) it is O(N)
where N is the number of effects (or evidence variables)
AI Principles, Lecture on Reasoning Under Uncertainty
The Bayesian brain
It turns out that your brain understands Bayes rule!
Reproduced without permission
from Kording & Wolpert
Nature Vol 427, 15 Jan 2004
The human has to move their (hidden) hand to a target. Half
way through the movement they are given an uncertain clue
as to where the hand is. The position their hand moves to by
the end is consistent with the brain using Bayes’ rule to
combine the information it receives
AI Principles, Lecture on Reasoning Under Uncertainty
The non-Bayesian brain
But it is not apparent
that Bayes’ rule is used
everywhere
How will rotation of one
wheel affect the other?
Some kinds of
inference don’t seem to
be obviously
explainable using
probabilistic reasoning
alone
AI Principles, Lecture on Reasoning Under Uncertainty
Summary
Reasoning under uncertainty is an important area of AI
It is not the case that statistical methods are the only way
Logics can also cope with uncertainty in a qualitative way
But statistical methods, and particularly Bayesian reasoning
has become a cornerstone of modern AI (rightly or wrongly)
AI Principles, Lecture on Reasoning Under Uncertainty