0% found this document useful (0 votes)
2 views28 pages

Module 5 - Part1

Module 5 of the BAD402 Artificial Intelligence course covers uncertain knowledge and reasoning, focusing on how agents act under uncertainty and the use of expert systems. It discusses the limitations of logical agents in handling uncertainty and introduces probability theory as a means to quantify belief and make rational decisions. The module also outlines basic probability notation and the concepts of utility theory and decision theory, emphasizing the importance of expected utility in rational decision-making.

Uploaded by

shreeshak862005
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views28 pages

Module 5 - Part1

Module 5 of the BAD402 Artificial Intelligence course covers uncertain knowledge and reasoning, focusing on how agents act under uncertainty and the use of expert systems. It discusses the limitations of logical agents in handling uncertainty and introduces probability theory as a means to quantify belief and make rational decisions. The module also outlines basic probability notation and the concepts of utility theory and decision theory, emphasizing the importance of expected utility in rational decision-making.

Uploaded by

shreeshak862005
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 28

Module 5 BAD402 Artificial Intelligence

Syllabus;
Uncertain knowledge and Reasoning: Quantifying Uncertainty, Acting
under Uncertainty, Basic Probability Notation, Inference Using Full Joint
Distributions, Independence, Bayes Rule and Its Use, The WumpusWorld
Revisited.
Expert Systems: Representing and using domain knowledge, ES shells. Explanation,
knowledge acquisition
Text Book 1: Chapter 13-13.1, 13.2, 13.3, 13.4, 13.5, 13.6
Text Book 2: Chapter 20
13.1 : Acting under Uncertainty
• Agents may need to handle uncertainty, whether due to partial
observability, non-determinism, or a combination of the two.
• An agent may never know for certain what state it’s in or where it
will end up after a sequence of actions.
• Problem-solving agents and logical agents designed to handle
uncertainty by keeping track of a belief state—a representation of
the set of all possible world states that it might be in—and
generating a contingency plan that handles every possible
eventuality that its sensors may report during execution.
• This approach has significant drawbacks when taken literally as a
recipe for creating agent programs:
• When interpreting partial sensor information, a logical agent must
consider every logically possible explanation for the observations,
no matter how unlikely.
• This leads to impossible large and complex belief-state
representations.
• A correct contingent plan that handles every eventuality can grow
arbitrarily large and must consider arbitrarily unlikely contingencies.
• Sometimes there is no plan that is guaranteed achieve the goal—yet
the agent must act.
• It must have some way to compare the merits of plans that are not
guaranteed.

1
Module 5 BAD402 Artificial Intelligence

• Suppose, for example, that an automated taxi automated has the goal
of delivering a passenger to the airport on time.
• The agent forms a plan, A90, that involves leaving home 90 minutes
before the flight departs and driving at a reasonable speed.
• Even though the airport is only about 5 miles away, a logical taxi
agent will not be able to conclude with certainty that ―Plan A90 will
get us to the airport in time.‖
• Instead, it reaches the weaker conclusion ―Plan A90 will get us to the
airport in time, as long as : the car doesn’t break down or run out of
gas, and I don’t get into an accident, and there are no accidents on
the bridge, and the plane doesn’t leave early, and no meteorite hits
the car,and ....‖ None of these conditions can be deduced for sure.
• So the plan’s success cannot be inferred.
• This is the qualification problem, for which we so far have seen no
real solution.
• A90 is expected to maximize the agent’s performance measure
(where the expectation is relative to the agent’s knowledge about the
environment).
• The performance measure includes getting to the airport in time for
the flight, avoiding a long, unproductive wait at the airport, and
avoiding speeding tickets along the way.
• The agent’s knowledge cannot guarantee any of these outcomes for
A90, but it can provide some degree of belief that they will be
achieved.
• Other plans, such as A180, might increase the agent’s belief that it
will get to the airport on time, but also increase the likelihood of a
long wait.

2
Module 5 BAD402 Artificial Intelligence

• The right thing to do—the rational decision—therefore depends on


both the relative importance of various goals and the likelihood that,
and degree to which, they will be achieved.
13.1.1 Summarizing uncertainty:
• Let’s consider an example of uncertain reasoning: diagnosing a dental
patient’s toothache.
• Diagnosis—whether for medicine, automobile repair, or whatever—
almost always involves uncertainty.
• Let us try to write rules for dental diagnosis using propositional logic,
so that we can see how the logical approach breaks down.
Consider the following simple rule:
• Toothache ⇒ Cavity .
• The problem is that this rule is wrong.
• Not all patients with tooth aches have cavities; some of them have
gum disease, an abscess, or one of several other problems:
• Toothache ⇒ Cavity ∨ Gum Problem ∨ Abscess ...
• Unfortunately, in order to make the rule true, we have to add an
almost unlimited list of possible problems.
• We could try turning the rule into a causal rule:
• Cavity ⇒ Toothache.
• Trying to use logic to cope with a domain like medical diagnosis thus
fails for three main reasons:
• Laziness: It is too much work to list the complete set of antecedents
or consequents needed to ensure an exception less rule and too hard
touse such rules.
• Theoretical ignorance: Medical science has no complete theory for
the domain.

3
Module 5 BAD402 Artificial Intelligence

• Practical ignorance: Even if we know all the rules, we might be


uncertain about a particular patient because not all the necessary
tests have been or can be run.
• The agent’s knowledge can at best provide only a degree of belief
in the relevant sentences.
• Our main tool for dealing with degrees of belief is probability theory.
• The ontological commitments of logic and probability theory are the
same—that the world is composed of facts that do or do not hold in
any particular case—but the epistemological commitments are
different:
• a logical agent believes each sentence to be true or false or has no
opinion,
• whereas a probabilistic agent may have a numerical degree of belief
between 0 (for sentences that are certainly false) and 1 (certainly
true).
• Probability provides a way of summarizing the uncertainty that
comes from our laziness and ignorance, thereby solving the
qualification problem.
• We might not know for sure what afflicts a particular patient, but we
believe that there is, say, an 80% chance—that is, a probability of
0.8—that the patient who has a toothache has a cavity.
13.1.2 Uncertainty and rational decisions:
• Consider again the A90 plan for getting to the airport. Suppose
itgives us a 97% chance of catching our flight.
• Does this mean it is a rational choice? Not necessarily: there
mightbe other plans, such as A180, with higher probabilities.
• If it is vital not to miss the flight, then it is worth risking the
longerwait at the airport.
• What about A1440, a plan that involves leaving home 24 hours
inadvance?

4
Module 5 BAD402 Artificial Intelligence

• In most circumstances, this is not a good choice, because although


it almost guarantees getting there on time, it involves an intolerable
wait—not to mention a possibly unpleasant diet of airport food.
• To make such choices, an agent must first have preferences
between the different possible outcomes of the various plans.
• An outcome is a completely specified state, including such factors
as whether the agent arrives on time and the length of the wait at
the airport.
• We use utility theory to represent and reason with preferences.
• (The term utility is used here in the sense of ―the quality of
being useful,‖ not in the sense of the electric company or water
works.)
• Utility theory says that every state has a degree of usefulness,
or utility, to an agent and that the agent will prefer states with
higher utility.
• Preferences, as expressed by utilities, are combined with
probabilities in the general theory of rational decisions called
decision theory:
• Decision theory = probability theory + utility theory .
• The fundamental idea of decision theory is that an agent is rational
if and only if it chooses the action that yields the highest expected
utility, averaged over all the possible outcomes of the action.
• This is called the principle of Maximum Expected Utility (MEU).
13.2 Basic Probability Notation
For our agent to represent and use probabilistic information, we need a
formal language.
The language of probability theory has traditionally been informal,
written by human mathematicians to other human mathematicians.

5
Module 5 BAD402 Artificial Intelligence

13.2.1 What probabilities are about


• In probability theory, the set of all possible worlds is called the
sample space.
• The possible worlds are mutually exclusive and exhaustive—two
possible worlds cannot both be the case, and one possible world
must be the case.
• For example, if we are about to roll two (distinguishable) dice,
there are 36 possible worlds to consider: (1,1), (1,2), ..., (6,6).
• The Greek letter Ω (uppercase omega) is used to refer to the
sample space, and ω (lowercase omega) refers to elements of
the space, that is, particular possible worlds.
• A fully specified probability model associates a numerical
probabilityP(ω) with each possible world 1.
• The basic axioms of probability theory say that every possible
world has a probability between 0 and 1 and that the total
probability of the set of possible worlds is 1:

• For example, if we assume that each die is fair and the rolls don’t
interfere with each other, then each of the possible worlds (1,1),
(1,2), ..., (6,6) has probability 1/36.

6
Module 5 BAD402 Artificial Intelligence

• On the other hand, if the dice conspire to produce the same number,
then the worlds (1,1), (2,2), (3,3), etc., might have higher
probabilities,leaving the others with lower probabilities.
• In AI, the sets are always described by propositions in a formal
language.
• For each proposition, the corresponding set contains just those
possible worlds in which the proposition holds.
• The probability associated with a proposition is defined to be the
sumof the probabilities of the worlds in which it holds:
• For any proposition ,

• For example, when rolling fair dice, we have P(Total =11) = P((5,6))
• + P((6,5)) = 1/36 + 1/36 = 1/18.
• Probabilities such as P(Total =11) and P(doubles) are called
unconditional or prior probabilities (and sometimes just
―priors‖ for short);
• they refer to degrees of belief in propositions in the absence of
any other information.
• Most of the time, however, we have some information, usually
called evidence, that has already been revealed.
• This probability is written P(doubles |Die1 =5),where the ―|‖
is pronounced ―given.‖
• Similarly, if I am going to the dentist for a regular checkup, the
probability P(cavity)=0.2 might be of interest; but if I go to the
dentist because I have a toothache, it’s P(cavity |toothache)=0.6
that matters.

7
Module 5 BAD402 Artificial Intelligence

• Note that the precedence of ―|‖is such that any expression


of theform P(...|...) always means P((...)|(...)).
• The assertion that P(cavity |toothache)=0.6
• does not mean ―Whenever toothache is true, conclude that
cavity istrue with probability 0.6‖ rather it means
• ―Whenever toothache is true and we have no further
information,conclude that cavity is true with probability 0.6.‖
• The extra condition is important; for example, if we had the
furtherinformation that the dentist found no cavities,
• we definitely would not want to conclude that cavity is true with
probability 0.6; instead we need to use
• P(cavity|toothache 𝖠¬cavity)=0.
• Mathematically speaking, conditional probabilities are
defined in terms of unconditional probabilities as follows: for
any propositions a and b, we have;

13.2.2 The language of propositions in probability assertions


• Factored representation, in which a possible world is represented
by a set of variable/value pairs.
• Variables in probability theory are called random variables
and their names begin with an uppercase letter.
• Thus, in the dice example, Total and Die1 are random variables.
Every random variable has a domain—the set of possible
values itcan take on.

8
Module 5 BAD402 Artificial Intelligence

• The domain of Total for two dice is the set {2,...,12} and
thedomain of Die1 is {1,...,6}.
• A Boolean random variable has the domain: {true, false} (notice
thatvalues are always lowercase);
• for example, the proposition that doubles are rolled can be written as
• Doubles =true.
• By convention, propositions of the form A=true are abbreviated
simply as a, while A=false is abbreviated as ¬a.
• As in Constrained Satisfaction Problems, domains can be sets of
arbitrary tokens;
• we might choose the domain of Age to be {juvenile,teen,adult} and
• the domain of Weather might be {sunny, rain, cloudy, snow}.
• ―The probability that the patient has a cavity, given that she
is ateenager with no toothache, is 0.1‖ as follows:

• Sometimes we will want to talk about the probabilities of all the


possible values of a random variable.
• We could write:

9
Module 5 BAD402 Artificial Intelligence

• where the bold P indicates that the result is a vector of numbers, and
where we assume a predefined ordering sunny, rain, cloudy, snow
on the domain of Weather.
• We say that the P statement defines a probability distribution for the
random variable Weather.
• The P notation is also used for conditional distributions: P(X |Y )
gives the values of
• P(X =xi |Y =yj) for each possible i, j pair.
• For continuous variables, it is not possible to write out the entire
distribution as a vector, because there are infinitely many values.
• Instead, we can define the probability that a random variable takes on
some value x as a parameterized function of x.
• For example, the sentence
• P(NoonTemp =x)=Uniform[18C,26C](x)
• Expresses the belief that the temperature at noon is distributed
uniformly between 18 and 26 degrees Celsius.
• We call this a Probability Density Function.
• Probability density functions (sometimes called pdfs) differ in
meaning from discrete distributions.
• Saying that the probability density is uniform from 18C to 26C means
that there is a 100% chance that the temperature will fall
somewhere in that 8C-wide region and a 50% chance that it will fall
in any 4C- wide region, and so on.
• the intuitive definition of P(x) is the probability that X falls within an
arbitrarily small region beginning at x, divided by the width of the
region:

10
Module 5 BAD402 Artificial Intelligence

• where C stands for centigrade (not for a constant).


• In P(NoonTemp =20.18C)= 1/ 8C, note that 1/ 8C is not a
probability, it is a probability density.
• The probability that NoonTemp is exactly 20.18C is zero, because
20.18C is a region of width 0.
• For example, P(Weather, Cavity) denotes the probabilities of all
combinations of the values of Weather and Cavity.
• This is a 4×2 table of probabilities called the joint probability
distribution of Weather and Cavity.
• We can also mix variables with and without values; P(sunny, Cavity)
would be a two-element vector giving the probabilities of a sunny
daywith a cavity and a sunny day with no cavity.
• The P notation makes certain expressions much more concise than
they might otherwise be.
• For example, the product rules for all possible values of Weather and
Cavity can be written as a single equation:
• P(Weather,Cavity)=P(Weather|Cavity)P(Cavity).

11
Module 5 BAD402 Artificial Intelligence

• As a degenerate case,
• P(sunny,cavity) has no variables and thus is a one-element vector
that is the probability of a sunny day with a cavity, which could also
be written as P(sunny,cavity) or P(sunny 𝖠cavity).
• A possible world is defined to be an assignment of values to all of the
random variables under consideration.
• It is easy to see that this definition satisfies the basic requirement that
possible worlds be mutually exclusive and exhaustive .
• For example, if the random variables are Cavity, Toothache, and
Weather, then there are 2×2×4=16possible worlds.
• Furthermore, the truth of any given proposition, no matter how
complex, can be determined easily in such worlds using the same
recursive definition of truth as for formulas in propositional logic.
• Probability model is completely determined by the joint
distribution for all of the random variables—the so-called full
joint probability distribution.
• For example, if the variables are Cavity, Toothache, and Weather,
then the full joint distribution is given by P(Cavity, Toothache,
Weather).
• This joint distribution can be represented as a 2×2×4 table with 16
entries.

12
Module 5 BAD402 Artificial Intelligence

• Because every proposition’s probability is a sum over possible worlds,


a full joint distribution suffices, in principle, for calculating the
probability of any proposition.
13.2.3 Probability axioms and their reasonableness

• The basic axioms of probability (Equations (13.1) and (13.2))


imply certain relationships among the degrees of belief that can be
accorded to logically related propositions.
• For example, we can derive the familiar relationship between the
probability of a proposition and the probability of its negation:

• We can also derive the well-known formula for the probability of a


disjunction, sometimes called the inclusion–exclusion principle:

• Equations (13.1) and (13.4) are often called Kolmogorov’s axioms


in honor of the Russian mathematician Andrei Kolmogorov, who
showed how to build up the rest of probability theory from this
simple foundation and how to handle the difficulties caused by
continuous variables.
• But de Finetti proved something much stronger:

13
Module 5 BAD402 Artificial Intelligence

• If an agent has some degree of belief in a proposition a, then the agent


should be able to state odds at which it is indifferent to a bet for or
against a3. Think of it as a game between two agents: Agent 1
states, ―my degree of belief in event a is 0.4.‖ Agent 2 is then free to
choose whether to wager for or against a at stakes that are consistent
with the stated degree of belief.
• If Agent 1 expresses a set of degrees of belief that violate the axioms
of probability theory then there is a combination of bets by Agent 2
that guarantees that Agent 1 will lose money every time.

13.3 :Inference Using Full Joint Distributions


• In this section we describe a simple method for probabilistic
inference—
• that is, the computation of posterior
probabilities for query propositions given observed
evidence.
• We use the full joint distribution as the ―knowledge base‖ from
whichanswers to all questions may be derived.
• Along the way we also introduce several useful techniques for
manipulating equations involving probabilities.
WHERE DO PROBABILITIES COME FROM?
• There has been endless debate over the source and status of
probability numbers.
• The frequentist position is that the numbers can come only from
experiments: if we test 100 people and find that 10 of them
have a

14
Module 5 BAD402 Artificial Intelligence

cavity, then we can say that the probability of a cavity is


approximately 0.1. In this view, the assertion ―the probability of a
cavity is 0.1‖ means that 0.1 is the fraction that would be observed in
the limit of infinitely many samples. From any finite sample, we can
estimate the true fraction and also calculate how accurate our estimate
is likely to be.
• The objectivist view is that probabilities are real aspects of the
universe—propensities of objects to behave in certain ways—
rather than being just descriptions of an observer’s degree of belief.
For example, the fact that a fair coin comes up heads with
probability 0.5 is a propensity of the coin itself.
• The subjectivist view describes probabilities as a way of
characterizing an agent’s beliefs, rather than as having any external
physical significance.
• In the end, even a strict frequentist position involves subjective
analysis because of the reference class problem:

• We begin with a simple example: a domain consisting of just the


three Boolean variables Toothache, Cavity, and Catch (the dentist’s
nasty steel probe catches in my tooth).
• The full joint distribution is a 2×2×2 table as shown in Figure13.3.
• Notice that the probabilities in the joint distribution sum to 1,
asrequired by the axioms of probability.
• For example, there are six possible worlds
• in which cavity ∨ toothache holds:
15
Module 5 BAD402 Artificial Intelligence

• For example, adding the entries in the first row gives the
unconditional or marginal probability of cavity:

• This process is called marginalization, or summing out—because


we sum up the probabilities for each possible value of the other
variables, there by taking them out of the equation.
• We can write the following general marginalization rule for any sets
of variables Y and Z:

• This rule is called conditioning.


• Marginalization and conditioning turn out to be useful rules for all
kinds of derivations involving probability expressions.
• For example, we can compute the probability of a cavity, given
evidence of a toothache, as follows:

16
Module 5 BAD402 Artificial Intelligence

• The two values sum to 1.0, as they should. Notice that in these two
calculations the term 1/P(toothache) remains constant, no matter
which value of Cavity we calculate.
• In fact, it can be viewed as a normalization constant for the
distribution P(Cavity | toothache), ensuring that it adds up to 1..
• Throughout the chapters dealing with probability, we use α to
denote such constants. With this notation, we can write the two
preceding equations in one:

• We begin with then case in which the query involves a single variable,
X (Cavity in the example).
• Let E be the list of evidence variables (just Toothache in the example),
let e be the list of observed values for them, and let Y be the
remaining unobserved variables (just Catch in the example).
• The query is P(X |e) and can be evaluated as:

17
Module 5 BAD402 Artificial Intelligence

13.4: Independence
• Let us expand the full joint distribution in Figure 13.3 by adding a
fourth variable, Weather.
• The full joint distribution then becomes P(Toothache, Catch,
Cavity, Weather), which has 2 ×2×2×4=32 entries.
• It contains four ―editions‖ of the table shown in Figure 13.3, one for
each kind of weather.
• What relationship do these editions have to each other and to the
original three-variable table?
• For example, how are P(toothache, catch, cavity, cloudy)
• and P(toothache, catch, cavity) related?
• We can use the product rule:

• Thus, the 32-element table for four variables can be constructed from
one 8-element table and one 4-element table.
• This decomposition is illustrated schematically in Figure 13.4(a).
• The property we used in Equation (13.10) is called independence
(also marginal independence and absolute independence).

18
Module 5 BAD402 Artificial Intelligence

• In particular, the weather is independent of one’s dental problems.


Independence between propositions a and b can be written as:
• P(a|b)=P(a) or P(b|a)=P(b) or
P(a𝖠b)=P(a)P(b)................................................................ (13.11)
• Independence between variables X and Y can be written as follows
(again, these are all equivalent):
• P(X |Y)=P(X) or P(Y |X)=P(Y) or P(X,Y)=P(X)P(Y).
• Independence assertions are usually based on knowledge of the
domain.
• As the toothache weather example illustrates, they can dramatically
reduce the amount of information necessary to specify the full joint
distribution.

• For example, the full joint distribution on the outcome of n


independent coin flips, P(C1,. ,Cn),has 2n entries,
• but it can be represented as the product of n single-variable
distributions P(Ci).

19
Module 5 BAD402 Artificial Intelligence

13.5 : BAYES’RULE AND ITS USE


• The Product rule. It can actually be written in two forms:

• This equation is known as Bayes’ rule (also Bayes’ law or


Bayes’theorem).
• This simple equation underlies most
modern AI systems forprobabilistic inference.
• The more general case of Bayes’ rule for multivalued variables can
bewritten in the P notation as follows:

We will also have occasion to use a more general version conditionalized


on some background evidence e:

13.5.1 ; Applying Bayes’ rule: The simple case


• On the surface, Bayes’ rule does not seem very useful.
• It allows us to compute the single term P(b|a) in terms of three terms:
• P(a|b), P(b),and P(a).

20
Module 5 BAD402 Artificial Intelligence

• The conditional probability P(effect |cause) quantifies the


relationship in the causal direction,
• whereas P(cause |effect) describes the diagnostic direction.

• The general form of Bayes’ rule with normalization is


• P(Y |X)=αP(X|Y)P(Y), (13.15)
• where α is the normalization constant needed to make the entries in
P(Y |X) sum to 1.
13.5.2 Using Bayes’ rule: Combining evidence
• We have seen that Bayes’ rule can be useful for answering
probabilistic queries conditioned on one piece of evidence—for
example, the stiff neck. In particular, we have argued that
probabilistic information is often available in the form P(effect
|cause).
• What happens when we have two or more pieces of evidence?
• For example, what can a dentist conclude if her nasty steel probe
catches in the aching tooth of a patient?
• If we know the full joint distribution (Figure 13.3), we can read off
the answer:
• P(Cavity |toothache 𝖠 catch)=α(0.108,0.016)≈(0.871,0.129) .
• We know, however, that such an approach does not scale up to larger
numbers of variables.
• We can try using Bayes’ rule to reformulate the problem:
• P(Cavity |toothache Λ catch)

21
Module 5 BAD402 Artificial Intelligence

=αP (toothache Λ catch |Cavity)P(Cavity) . …(13.16)


• P(toothache Λ catch |Cavity)=
o P(toothache |Cavity)P(catch |Cavity) …(13.17)
• This equation expresses the conditional independence of toothache
and catch given Cavity.
• We can plug it into Equation (13.16) to obtain the probability of a
cavity:
• P(Cavity |toothache 𝖠 catch)
o =αP(toothache|Cavity)P(catch|Cavity)P(Cavity) ……(13.18)
• The general definition of conditional independence of two variables X
and Y ,given a third variable Z, is:

• In the dentist domain, for example, it seems reasonable to assert


conditional independence of the variables Toothache and Catch, given
Cavity:

• which asserts independence only for specific values of Toothache and


Catch.
• As with absolute independence in Equation (13.11), the equivalent
forms:

22
Module 5 BAD402 Artificial Intelligence

• conditional independence assertions can allow probabilistic systems


to scale up; moreover, they are much more commonly available than
absolute independence assertions.
• Conceptually,: Cavity separates Toothache and Catch because it is a
direct cause of both of them.
• The decomposition of large probabilistic domains into weakly
connected subsets through conditional independence
• Is one of the most important developments in the recent history of AI.
• The dentistry example illustrates a commonly occurring pattern in
which a single cause directly influences a number of effects, all of
which are conditionally independent, given the cause.
• The full joint distribution can be written as

• Such a probability distribution is called a naive Bayes model—


―naive‖ because it is often
• used (as a simplifying assumption) in cases where the ―effect‖
variables are not actually conditionally independent given the cause
variable.
• (The naive Bayes model is sometimes called a Bayesian classifier,
a somewhat careless usage that has prompted true Bayesians to call
it the idiot Bayes model.)
13.6 THE WUMPUS WORLD

Environment in which knowledge-based agents can show their worth.

• The wumpus world is a cave consisting of rooms connected by passageways.

• Lurking somewhere in the cave is the terrible wumpus, a beast that eats anyone
who enters its room.

• The wumpus can be shot by an agent, but the agent has only one arrow.

• Some rooms contain bottomless pits that will trap anyone who wanders into these
rooms (except for the wumpus, which is too big to fall in).

23
Module 5 BAD402 Artificial Intelligence

• Performance measure: +1000 for climbing out of the cave with the gold,–1000 for
falling into a pit or being eaten by the wumpus,–1 for each action taken and–10 for
using up the arrow.

• The game ends either when the agent dies or when the agent climbs out of the
cave.

• Environment: A 4×4 grid of rooms. The agent always starts in the square labeled
[1,1], facing to the right. In addition, each square other than the start can be a pit,
with probability 0.2.

24
Module 5 BAD402 Artificial Intelligence

The Wumpus World Revisted


• We can combine of the ideas in this chapter to solve probabilistic reasoning
problems in the wumpus world.

• Uncertainty arises in the wumpus world because the agent’s sensors give only
partial information about the world.

• For example, Figure 13.5 shows a situation in which each of the three reachable
squares—[1,3], [2,2], and [3,1]—might contain a pit.

• Pure logical inference can conclude nothing about which square is most likely to
be safe, so a logical agent might have to choose randomly.

• Our aim is to calculate the probability that each of the three squares contains a
pit.

• (For this example we ignore the wumpus and the gold.)

• The relevant properties of the wumpus world are that

• (1) a pit causes breezes in all neighboring squares, and

• (2) each square other than [1,1] contains a pit with probability 0.2.

• The first step is to identify the set of random variables we need:

• As in the propositional logic case, we want one Boolean variable Pij for each
square, which is true iff square[i,j] actually contains a pit.

25
Module 5 BAD402 Artificial Intelligence

• We also have Boolean variables Bij that are true iff square [i,j] is breezy; we
include these variables only for the observed squares—in this case, [1,1], [1,2],
and [2,1].

• The next step is to specify the full joint distribution,


P(P1,1,...,P4,4,B1,1,B1,2,B2,1).

• This decomposition makes it easy to see what the joint probability values should
be.

• The first term is the conditional probability distribution of a breeze configuration,

• Given a pit configuration; its values are 1 if the breezes are adjacent to the pits
and 0 otherwise.

• The second term is the prior probability of a pit configuration.

• Each square contains a pit with probability 0.2, independently of the other squares;
hence:

• In the situation in Figure 13.5(a), the evidence consists of the observed breeze (or
its absence) in each square that is visited, combined with the fact that each such
square contains no pit.

• We abbreviate these facts as:


26
Module 5 BAD402 Artificial Intelligence

• b=¬b1,1∧b1,2∧b2,1 and

• known =¬p1,1∧¬p1,2∧¬p2,1.

• We are interested in answering queries such as P(P1,3 |known,b):

• how likely is it that [1,3] contains a pit, given the observations so far?

• Let Unknown be the set of Pi,j variables for squares other than the Known squares
and the query square [1,3].

• Then, by Equation (13.9), we have:

• Surely, one might ask, aren’t the other squares irrelevant? How could [4,4] affect
whether [1,3] has a pit?

• Indeed, this intuition is correct.

• Let Frontier be the pit variables (other than the query variable) that are adjacent
to visited squares, in this case just [2,2] and [3,1].

• Also, let Other be the pit variables for the other unknown squares; in this case,
there are 10 other squares, as shown in Figure 13.5(b).

• The key insight is that the observed breezes are conditionally independent of
the other variables, given the known, frontier, and query variables.

• To use the insight, we manipulate the query formula into a form in which the
breezes are conditioned on all the other variables, and then we apply conditional
independence:

27
Module 5 BAD402 Artificial Intelligence

• By independence, as in Equation (13.20), the prior term can be factored, and then
the terms can be reordered:

• The models and their associated prior probabilities—P(frontier)—are shown in


Figure 13.6.

• We have P(P1,3 |known,b)=α 0.2(0.04 + 0.16 + 0.16), 0.8(0.04 + 0.16) ≈


0.31,0.69 .

• That is, [1,3] (and [3,1] by symmetry) contains a pit with roughly 31%
probability.

• A similar calculation, which the reader might wish to perform, shows that [2,2]
contains a pit with roughly 86% probability.

• The wumpus agent should definitely avoid [2,2]!

28

You might also like