AI Module3 Notes
AI Module3 Notes
What is reasoning?
● When we require any knowledge system to do something it has not been
explicitly told how to do it must reason.
● The system must figure out what it needs to know from what it already knows.
◦ Reasoning is the act of deriving a conclusion from certain premises using
a given methodology. (Process of thinking/ Drawing inference)
◦ Once again uses knowledge about what you know and perhaps ordering
it in some kind of importance.
Uncertain Reasoning
Unfortunately the world is an uncertain place.
Any AI system that seeks to model and reasoning in such a world must be
able to deal with this.
In particular it must be able to deal with:
◦ Incompleteness – compensate for lack of knowledge.
◦ Inconsistencies – resolve ambiguities and contradictions.
◦ Change – it must be able to update its world knowledge base over
time.
Clearly in order to deal with this some decision that a made are more likely
to be true (or
false) than others and we must introduce methods that can cope with this
uncertainty.
Monotonic Reasoning
Predicate logic and the inferences we perform on it is an example of monotonic
reasoning. In monotonic reasoning if we enlarge at set of axioms we cannot retract
any existing assertions or axioms.
A monotonic logic cannot handle
Reasoning by default
◦ Because consequences may be derived only because of lack of
evidence of the contrary
● Abductive Reasoning
◦ Because consequences are only deduced as most likely explanations.
● Belief Revision
◦ Because new knowledge may contradict old beliefs.
Non-Monotonic Reasoning
Non monotonic reasoning is one in which the axioms and/or the rules of
inference are extended to make it possible to reason with incomplete
information. These systems preserve, however, the property that, at any given
moment, a statement is either
• believed to be true,
• believed to be false, or
• not believed to be either.
Statistical Reasoning: in which the representation is extended to allow some
kind of numeric measure of certainty (rather than true or false) to be
associated with each statement.
In a system doing non-monotonic reasoning the set of conclusions may either
grow or shrink when new information is obtained.
Non-monotonic logics are used to formalize plausible reasoning, such as the
following inference step:
Birds typically fly.
Tweety is a bird.
Properties of FOPL
● It is complete with respect to the domain of interest.
● It is consistent.
● The only way it can change is that new facts can be added as they become
available.
◦ If these new facts are consistent with all the other facts that have already
have been asserted, then nothing will ever be retracted from the set of
facts that are known to be true.
◦ This is known as “monotonicity”.
If any of these properties is not satisfied, conventional logic based reasoning systems
become inadequate.
Non monotonic reasoning systems, are designed to be able to solve problems in which
all of these properties may be missing Issues to be addressed:
How can the knowledge base be extended to allow inferences to be made on the
basis of lack of knowledge as well as on the presence of it?
o We need to make clear the distinction between
It is known that P.
▪ It is not known whether P.
o First-order predicate logic allows reasoning to be based on the first of
these. o In our new system, we call any inference that depends on the
lack of some piece of knowledge a non-monotonic inference.
o Traditional systems based on predicate logic are monotonic. Here number
of statements known to be true increases with time.
o New statements are added and new theorems are proved, but the
previously known statements never become invalid.
How can the knowledge base be updated properly when a new fact is added to
the system(or when the old one is removed)?
o In Non-Monotonic systems, since addition of a fact can cause previously
discovered proofs to become invalid,
▪ how can those proofs, and all the conclusions that depend on
them be found?
▪ Solution: keep track of proofs, which are often called justifications.
o Such a recording mechanism also makes it possible to support,
▪ monotonic reasoning in the case where axioms must occasionally
be retracted to reflect changes in the world that is being modeled.
How can knowledge be used to help resolve conflicts when there are several in
consistent non monotonic inferences that could be drawn?
o It turns out that when inferences can be based
▪ on the lack of knowledge as well as on its presence,
▪ contradictions are much likely to occur than they were in
conventional logical systems in which the only possible
contradictions.
Default Reasoning
● Non monotonic reasoning is based on default reasoning or “most probabilistic
choice”.
◦ S is assumed to be true as long as there is no evidence to the contrary.
● Default reasoning ( or most probabilistic choice) is defined as follows:
◦ Definition 1 : If X is not known, then conclude Y.
◦ Definition 2 : If X can not be proved, then conclude Y.
◦ Definition 3: If X can not be proved in some allocated amount of time
then conclude Y.
Default Reasoning
This is a very common form of non-monotonic reasoning.
Non-monotonic Logic
● One system that provides a basis for default reasoning is Non-monotonic
Logic (NML).
● This is basically an extension of first-order predicate logic to include a modal
operator, M.
◦ The purpose of this is to allow for
consistency.
states that
• for all x is x plays an instrument and if the fact that x can improvise is
consistent with all other knowledge
• then we can conclude that x is a jazz musician.
states that
• for all x and y, if x and y are related and if the fact that x gets along with y is
consistent with everything else that is believed,
• then we can conclude that x will defend y
Now this states that Quakers tend to be pacifists and Republicans tend not to be.
BUT Nixon was both a Quaker and a Republican so we could assert:
Quaker(Nixon)
Republican(Nixon)
This now leads to our total knowledge becoming inconsistent.
Default Logic
An alternative logic for performing default based reasoning is Reiter’s Default Logic
(DL). Default logic introduces a new inference rule of the form:
Now this is similar to Non-monotonic logic but there are some distinctions:
New inference rules are used for computing the set of plausible extensions. So
in the Nixon example above Default logic can support both assertions since is
does not say anything about how choose between them -- it will depend on the
inference being made. In Default logic any nonmonotonic expressions are rules of
inference rather than expressions. They cannot be manipulated by the other
rules of inference. This leads to some unexpected results.
In Default Logic, A indicates prerequisite, B indicates justification, and C indicates
Consequence.
Inheritance:
One very common use of nonmonotonic reasoning is as a basis for inheriting attribute
values from a prototype description of a class to the individual entities that belong to the
class. Considering the Baseball example in Inheritable Knowledge, and try to write its
inheriting knowledge as rules in DL.
We can write a rule to account for the inheritance of a default value for the height of a
baseball player as:
Which prohibits someone from having more than one height, then we would not be
able to apply the default rule. Thus an explicitly stated value will block the inheritance
of a default value, which is exactly what we want.
Let's encode the default rule for the height of adult males in general. If we pattern it
after the one for baseball players, we get
Unfortunately, this rule does not work as we would like. In particular, if we again assert
Pitcher(Three-Finger-Brown) then the resulting theory contains 2 extensions: one in
which our first rule fires and brown’s height is 6-1 and one in which this rule applies
and Brown’s height is 510. Neither of these extensions is preferred. In order to state
that we prefer to get a value from the more specific category, baseball player, we could
rewrite the default rule for adult males in general as:
This effectively blocks the application of the default knowledge about adult males in
this case that more specific information from the class of baseball players is available.
Unfortunately, this approach can become widely as the set of exceptions to the
general rule increases. We would end up with a rule like:
A clearer approach is to say something like. Adult males typically have a height of 5-
10 unless they are abnormal in some way. We can then associate with other classes
the information that they are abnormal in one or another way. So we could write, for
example:
Abduction
Abductive reasoning is to abduce (or take away) a logical assumption, explanation,
inference, conclusion, hypothesis, or best guess from an observation or set of
observations. Because the conclusion is merely a best guess, the conclusion that is
drawn may or may not be true. Daily decision-making is also an example of abductive
reasoning.
If we notice Spots, we might like to conclude measles, but it may be wrong. But may
be a best guess, we can make about what is going on. Deriving conclusions in this way
is abductive reasoning (a form of default reasoning).
▪ Given 2 wff’s (AB) & (B), for any expression A & B, if it is consistent to
assume A, do so.
Minimalist Reasoning
We describe methods for saying a very specific and highly useful class of things that
are generally true. These methods are based on some variant of the idea of a minimal
model. We will define a model to be minimal if there are no other models in which fewer
things are true. The idea behind using minimal models as a basis for non-monotonic
reasoning about the world is the following –
● There are many fewer true statements than false ones.
● If something is true and relevant it makes sense to assume that it has been
entered into our knowledge base.
● Therefore, assume that the only true statements are those that necessarily
must be true in order to maintain the consistency.
The extended
KB (
The problem is that we have assigned a special status to the positive instances of
predicates as opposed to negative ones. CWA forces completion of KB by adding
negative assertion whenever it is consistent to do so.
CWA captures part of the idea that anything that must not necessarily be true should
be assumed to be false, it does not capture all of it.
It has two essential limitations:
▪ It operates on individual predicates without considering interactions among
predicates that are defined in the KB.
▪ It assumes that all predicates have all their instances listed. Although in many
database applications this is true, in many KB systems it is not.
Circumscription
● Circumscription is a rule of conjecture (conclusion formed on the basis of
incomplete information) that allows you
◦ to jump to the conclusion that the objects you can show that posses a
certain property, p, are in fact all the objects that posses that property.
● Circumscription can also cope with default reasoning. Several theories of
circumscription have been proposed to deal with the problems of CWA.
● Circumscription together with first order logic allows a form of Non-monotonic
Reasoning.
Suppose we know:
This is where we apply circumscription and, in this case, we will assume that those things
that are shown to be abnormal are the only things to be abnormal. Thus we can rewrite
our default rule as:
: () () ()
and add the following
()
since there is nothing that cannot be shown to be abnormal.
The idea of truth maintenance system arose as a way of providing the ability to do
dependency directed backtracking and so to support nonmonotonic reasoning.
Types of TMS:
➢ justification-based TMS (JTMS)
➢ assumption-based TMS (ATMS)
➢ logic-based TMS (LTMS)
Basically TMSs:
• all do some form of dependency directed backtracking Assertions are
connected via a network of dependencies.
A Justification-based truth maintenance system (JTMS) is a simple TMS where one can
examine the consequences of the current set of assumptions. In JTMS labels are
attached to arcs from sentence nodes to justification nodes. This label is either "+" or
"-". Then, for a justification node we can talk of its IN-LIST, the list of its inputs with
"+" label, and of its OUT-LIST, the list of its inputs with "-" label.
The meaning of sentences is not known. We can have a node representing a sentence
p and one representing ~p and the two will be totally unrelated, unless relations are
established between them by justifications. For example, we can write:
~p^p Contradiction Node
o
|
x 'x' denotes a justification node
/ \ 'o' denotes a sentence node
+/ \+ o o
p ~p which says that if both p and ~p are IN we
have a contradiction.
The association of IN or OUT labels with the nodes in a dependency network defines
an in-outlabeling function. This function is consistent if:
• The label of a junctification node is IN iff the labels of all the sentence nodes
in its in-list are all IN and the labels of all the sentence nodes in its out-list are OUT.
• The label of a sentence node is IN iff it is a premise, or an enabled assumption node,
or it has an input from a justification node with label IN.
A set of important reasoning operations that a JTMS does not perform, including:
• Applying rules to derive conclusions
• Creating justifications for the results of applying rules
• Choosing among alternative ways of resolving a contradiction
• Detecting contradictions
All of these operations must be performed by the problem-solving program that is
using the JTMS.
The ATMS like the JTMS is designed to be used in conjunction with a separate
problem solver. The problem solver’s job is to:
• Create nodes that correspond to assertions (both those that are given as
axioms and those that are derived by the problem solver).
• Associate with each such node one or more justifications, each of which
describes reasoning chain that led to the node.
• Inform the ATMS of inconsistent contexts.
This is identical to the role of the problem solver that uses a JTMS, except that no
explicit choices among paths to follow need to be made as reasoning proceeds. Some
decision may be necessary at the end, though, if more than one possible solution still
has a consistent context.
The role of the ATMS system is then to:
• Propagate inconsistencies, thus ruling out contexts that include subcontexts
(set of assertions) that are known to be inconsistent.
• Label each problem solver node with the contexts in which it has a valid
justification. This is done by combining contexts that correspond to the
components of a justification. In particular, given a justification of the form
1∧ 2∧…∧ →
assign as a context for the node corresponding to C the intersection of the contexts
corresponding to the nodes A1 through An.
Contexts get eliminated as a result of the problem-solver asserting inconsistencies
and the ATMS propagating them. Nodes get created by the problem-solver to
represent possible components of a problem solution. They may then get pruned from
consideration if all their context labels get pruned.
8. Statistical
Reasoning
Introduction:
Statistical Reasoning: The reasoning in which the representation is extended to allow
some kind of numeric measure of certainty (rather than true or false) to be associated
with each statement. A fact is believed to be true or false. For some kind of problems,
describe beliefs that are not certain but for which there is a supporting evidence.
There are 2 class of problems:
• First class contain problems in which there is genuine randomness in the word.
o Example: Cards Playing
• Second class contains problems that could in principle be modeled using the
technique we described (i.e. resolution from predicate logic) o Example: Medical
Diagnosis
Read this expression as the probability of hypothesis H given that we have observed
evidence E. To compute this, we need to take into account the prior probability of H
and the extent to which E provides evidence of H.
Suppose, for example, that we are interested in examining the geological evidence at
a particular location to determine whether that would be a good place to dig to find a
desired mineral. If we know the prior probabilities of finding each of the various
minerals and we know the probabilities that if a mineral is present then certain
physical characteristics will be observed, then we use the Baye’s formula to compute
from the evidence we collect, how likely it is that the various minerals are present.
The key to using Baye’s theorem as a basis for uncertain reasoning is to recognize
exactly what it says.
Suppose we are solving a medical diagnosis problem. Consider the following assertions:
: ℎ
: ℎ
: ℎ ℎ ℎ .
• Without any additional evidence, the presence of spots serves as evidence in
favor of measles. It also serves as evidence of fever since measles would cause
fever.
• Suppose we already know that the patient has measles. Then the additional
evidence that he has spots actually tells us nothing about fever.
• Either spots alone or fever alone would constitute evidence in favor of measles.
• If both are present, we need to take both into account in determining the total
weight of evidence.
Disadvantages with Baye’s Theorem
● The size of set of joint probability that we require in order to compute this
function grows as 2n if there are n different propositions considered.
● Baye’s Theorem is hard to deal with for several reasons:
◦ Too many probabilities have to be provided
◦ the space that would be required to store all the probabilities is too
large.
◦ time required to compute the probabilities is too large.
We describe one practical way of compromising on a pure Bayesian system. MYCIN system
is an example of an expert system, since it performs a task normally done by a human
expert. MYCIN system attempts to recommend appropriate therapies for patients with
bacterial infections. It interacts with the physician to acquire the clinical data it needs.
We concentrate on the use of probabilistic reasoning.
MYCIN represents most of its diagnostic knowledge as a set of rules. Each rule has
associated with it a certainty factor, which is a measure of the extent to which the
evidence is described by antecedent of the rule, supports the conclusion that is given
in the rule’s consequent. It uses backward reasoning to the clinical data available from
its goal of finding significant diseasecausing organisms.
We must first need to describe some properties that we like combining functions to
satisfy:
◦ Combining function should be commutative and Associative
◦ Until certainty is reached additional conforming evidence should increase MB
◦ If uncertain inferences are chained together then the result should be less
certain than either of the inferences alone
The certainty factor of the hypothesis must take into account both the strength with
which the evidence suggests the hypothesis and the level of confidence in the
evidence. Let MB’[h,s] be the measure of belief in h given that we are absolutely
sure of the validity of s. Let e be the evidence that led us to believe in s (for
example, the actual readings of the laboratory instruments or
results of applying other rules). Then:
It turns out that these definitions are incompatible with a Bayesian view of conditional
probability. Small changes to them however make them compatible. We can redefine
MB as
MYCIN uses CF. The CF can be used to rank hypothesis in order of importance.
Example, if a patient has certain symptoms that suggest several possible diseases.
Then the disease with higher CF would be investigated first. If E then H CF(rule) =
level of belief of H given E.
The first scenario (a), Our example rule has three antecedents with a single CF
rather than three separate rules; this makes the combination rules unnecessary. The
rule writer did this because the three antecedents are not independent.
To see how much difference MYCIN’s independence assumption can make, suppose
for the moment that we had instead had three separate rules and that the CF of
each was 0.6. This could happen and still be consistent with the combined CF of 0.7
if three conditions overlap substantially. If we
apply the MYCIN combination formula to the
three separate rules, we get
Let’s consider what happens when independence assumptions are violated in the
scenario of (c):
BAYESION NETWORKS
CFs is a mechanism for reducing the complexity of a Bayesian reasoning system by
making some approximations to the formalism. Bayesian networks in which we
preserve the formalism and rely instead on the modularity of the world we are trying
to model. Bayesian Network is also called Belief Networks.
The basic idea of Bayesian Network is knowledge in the world is modular. Most events
are conditionally independent of other events. Adopt a model that can use local
representation to allow interactions between events that only affect each other. The
main idea is that to describe the real world it is not necessary to use a huge list of joint
probabilities table in which list of probabilities of all conceivable combinations of
events. Some events may only be unidirectional others may be bidirectional events
may be casual and thus get chained tighter in network.
Implementation:
A Bayesian Network is a directed acyclic graph. A graph where the directions are
links which indicate dependencies that exist between nodes. Nodes represent
propositions about events or events themselves. Conditional probabilities quantify
the strength of dependencies.
Eg: Consider the following facts
S: Sprinklers was on the last night
W: Grass is wet
R: It rained last night
From the above diagram, Sprinkler suggests Wet and Wet suggests Rain. (a) shows
the flow of constraints.
There are two different ways that propositions can influence the likelihood of each
other.
• The first is that causes. Influence the likelihood of their symptoms.
• The second is that the symptoms affect the likelihood of all of its possible
causes.
Rules:
(i) If the sprinkler was ON last night then the grass will be wet this morning
(ii) If grass is wet this morning then it rained last night
(iii) By chaining (if two rules are applied together) we believe that it rained
because we believe that sprinkler was ON.
The idea behind the Bayesian network structure is to make a clear distinction
between these two kinds of influence.
Bayesian Network Example:
Consider the following set of propositions:
patient has spots
patient has measles
patient has high
fever
patient has Rocky Mountain Spotted Fever
patient has previously been innoculated against
measles patient was recently bitten by a tick
patient has an allergy
Create a network that defines the casual connections among these nodes.
Conditional Probability Table
Each node in Bayesian Network has an associated Conditional Probability table (CPT).
This gives the probability values for the random variable at the node conditioned on
values for its parents.
Since each row must sum to one. Since the C node has no parents, its CPT specifies
the prior probability that is cloudy (in this case, 0.5).
Dempster-Shafer Theory
Dempster-Shafer Theory
So far we considered individual propositions and assign each of them a point of
degree of belief that is warranted for given evidence. The Dempster Shafer theory
approach considers sets of propositions and assigns each of them an interval
{ , }
in which the degree of belief must lie.
Belief measures the strength of evidence in favor of the set of propositions. It ranges
from 0 to 1 where 0 indicates no evidence and 1 denoting certainty.
Plausability (PL) is defined as
()=1−
It also ranges from 0 to 1 and measures the extent to which evidence in favour of
S leaves room for belief in S.
where i.e. all the evidence that makes us believe in the correctness of P, and
P.
Set up a confidence interval – an interval of probabilities within which the true probability
lies with a certain confidence based on belief B and plausibility PL provided by some
evidence E for a proposition P.
Suppose we are given two belief statements M1 M2. Let S be the subset of Θ which
M1 assigns a
non-zero value & tley be corresponding set to M2. We define the combination M3 of M1 & M2.
E.g.:
Fuzzy Logic
Fuzzy logic is an alternative for representing some kinds of uncertain
knowledge. Fuzzy logic is a form of many-valued logic; it deals with reasoning
that is approximate rather than fixed and exact. Compared to traditional
binary sets (where variables may take on true or false values), fuzzy logic
variables may have a truth value that ranges in degree between 0 and 1. Fuzzy
logic has been extended to handle the concept of partial truth, where the truth
value may range between completely true and completely false. Fuzzy set
theory defines set membership as a possibility distribution.