0% found this document useful (0 votes)
53 views

Knowledge and Reasoning: UNIT-3

This document discusses knowledge representation and reasoning in artificial intelligence. It covers the following key points: 1. Knowledge representation is how machines store and organize knowledge to enable intelligent behavior, while reasoning allows machines to use logic to derive new facts and make decisions. 2. There are different approaches to knowledge representation, including simple relational knowledge, inheritable knowledge, and inferential knowledge using formal logic. 3. Knowledge-based agents use knowledge representation and reasoning to maintain an internal state, update their knowledge based on observations, and take intelligent actions. They perform operations like telling their knowledge base new information and asking it to determine the best action.

Uploaded by

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

Knowledge and Reasoning: UNIT-3

This document discusses knowledge representation and reasoning in artificial intelligence. It covers the following key points: 1. Knowledge representation is how machines store and organize knowledge to enable intelligent behavior, while reasoning allows machines to use logic to derive new facts and make decisions. 2. There are different approaches to knowledge representation, including simple relational knowledge, inheritable knowledge, and inferential knowledge using formal logic. 3. Knowledge-based agents use knowledge representation and reasoning to maintain an internal state, update their knowledge based on observations, and take intelligent actions. They perform operations like telling their knowledge base new information and asking it to determine the best action.

Uploaded by

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

UNIT-3

Knowledge and Reasoning


Knowledge
• Humans are best at understanding, reasoning, and interpreting
knowledge.
• Human knows things, which is knowledge and as per their
knowledge they perform various actions in the real world.
• But how machines do all these things comes under knowledge
representation and reasoning.
• What is Knowledge?
– It is some set of patterns and associations derived from data or
information that helps in making decisions and resolves problems that
may be related to any day-to-day life or some complex problems.
Reasoning

• A systematic reasoning process is required when we try


to relate the events to the outcomes or to arrive at
judgements.
• Reasoning is the way we conclude on different aspects
of problems based on the available knowledge
representation.
• Logic plays an important role in the reasoning process.
• So, logic is the one that makes the knowlledge
representative.
Knowledge representation and reasoning
• Knowledge representation and reasoning (KR, KRR) is the part of
Artificial intelligence which concerned with AI agents thinking and
how thinking contributes to intelligent behavior of agents.
• Knowledge representation is not just storing data into some
database, but it also enables an intelligent machine to learn from
that knowledge and experiences so that it can behave intelligently
like a human.
• The different kinds of knowledge that need to be represented in AI
include:
• Objects, Events, Performance, Facts, Meta-Knowledge,
Knowledge-base
Different Types of Knowledge
What is the Relation between Knowledge &
Intelligence?
Approaches to Knowledge Representation in AI
• There are different approaches to knowledge representation such
as:
1. Simple Relational Knowledge
2. Inheritable Knowledge
3. Inferential Knowledge
Simple Relational Knowledge
• It is the simplest way of storing facts which uses the relational
method.
• Here, all the facts about a set of the object are set out
systematically in columns.
• Also, this approach of knowledge representation is famous in
database systems where the relationship between different
entities is represented.
• Thus, there is little opportunity for inference.
• Example:
Inheritable Knowledge
• In the inheritable knowledge approach, all data must be stored
into a hierarchy of classes and should be arranged in a
generalized form or a hierarchal manner.
• Also, this approach contains inheritable knowledge which shows a
relation between instance and class, and it is called instance
relation.
• In this approach, objects and values are represented in Boxed
nodes.
• Example:
Inferential Knowledge
• The inferential knowledge approach represents knowledge in the
form of formal logic.
• Thus, it can be used to derive more facts.
• Also, it guarantees correctness.
• Example:
Issues in Knowledge Representation

• Attributes
• Relationship among the attributes
• Granularity
• Representation of objects as sets
• Selectin of correct structure
Important Attributed:
•Any attribute of objects so basic that they occur in almost every
problem domain?
•There are two attributed “instance” and “isa”(One entity type might
be a subtype of another), that are general significance.
•These attributes are important because they support property
inheritance.
Relationship among attributes:
•Any important relationship that exists among object attributed?
•The attributes we use to describe objects are themselves entities
that we represent.
• The relationship between the attributes of an object, independent of
specific knowledge they encode, may hold properties like:
– Inverse — This is about consistency check, while a value is added to one attribute. The
entities are related to each other in many different ways.
– Existence in an isa hierarchy — This is about generalization-specification, like, classes
of objects and specialized subsets of those classes, there are attributes and
specialization of attributes. For example, the attribute height is a specialization of general
attribute physical-size which is, in turn, a specialization of physical-attribute. These
generalization-specialization relationships are important for attributes because they
support inheritance.
– Technique for reasoning about values — This is about reasoning values of attributes
not given explicitly. Several kinds of information are used in reasoning, like, height: must
be in a unit of length, Age: of a person cannot be greater than the age of person’s
parents. The values are often specified when a knowledge base is created.
– Single valued attributes — This is about a specific attribute that is guaranteed to take a
unique value. For example, a baseball player can at time have only a single height and
be a member of only one team. KR systems take different approaches to provide support
for single valued attributes.
Choosing Granularity:
•At what level of detail should the knowledge be represented?
•Regardless of the KR formalism, it is necessary to know:
– At what level should the knowledge be represented and what are the primitives?
•Should there be a small number or should there be a large number of low-level
primitives or High-level facts.
•High-level facts may not be adequate for inference while Low-level primitives may
require a lot of storage.
Set of objects:
•How should sets of objects be represented?
•There are certain properties of objects that are true as member of a set but not as
individual;
•The reason to represent sets of objects is: if a property is true for all or most
elements of a set, then it is more efficient to associate it once with the set rather
than to associate it explicitly with every elements of the set.
Finding Right structure:
•Given a large amount of knowledge stored in a database, how can relevant
parts are accessed when they are needed?
•This is about access to right structure for describing a particular situation.
•This requires, selecting an initial structure and then revising the choice.
•While doing so, it is necessary to solve following problems:
– How to perform an initial selection of the most appropriate structure.
– How to fill in appropriate details from the current situations.
– How to find a better structure if the one chosen initially turns out not to be
appropriate.
– What to do if none of the available structures is appropriate.
– When to create and remember a new structure.
Knowledge-Based Agent
• An intelligent agent needs knowledge about the real world for taking
decisions and reasoning to act efficiently.
• Knowledge-based agents are those agents who have the capability
of maintaining an internal state of knowledge, reason over that
knowledge, update their knowledge after observations and take
actions.
• These agents can represent the world with some formal
representation and act intelligently.
• Knowledge-based agents are composed of two main parts:
– Knowledge-base and
– Inference system.
• A knowledge-based agent must able to do the following:
– An agent should be able to represent states, actions, etc.
– An agent Should be able to incorporate new percepts
– An agent can update the internal representation of the world
– An agent can deduce the internal representation of the world
– An agent can deduce appropriate actions.
Operations Performed by KBA
• Following are three operations which are performed by KBA in order to show
the intelligent behavior:
– TELL: This operation tells the knowledge base what it perceives from the
environment.
– ASK: This operation asks the knowledge base what action it should perform.
– Perform: It performs the selected action.
• A generic knowledge-based agent:
Various levels of knowledge-based agent:
• A knowledge-based agent can be viewed at different levels which are given
below:
1. Knowledge level
• Knowledge level is the first level of knowledge-based agent, and in this level,
we need to specify what the agent knows, and what the agent goals are. With
these specifications, we can fix its behavior. For example, suppose an
automated taxi agent needs to go from a station A to station B, and he knows
the way from A to B, so this comes at the knowledge level.
2. Logical level:
• At this level, we understand that how the knowledge representation of
knowledge is stored. At this level, sentences are encoded into different
logics. At the logical level, an encoding of knowledge into logical sentences
occurs. At the logical level we can expect to the automated taxi agent to
reach to the destination B.
3. Implementation level:
•This is the physical representation of logic and knowledge. At the
implementation level agent perform actions as per logical and knowledge level.
At this level, an automated taxi agent actually implement his knowledge and
logic so that he can reach to the destination.A knowledge-based agent can be
viewed at different levels which are given below:
Approaches to designing a knowledge-based agent
• There are mainly two approaches to build a knowledge-based agent:
– Declarative approach: We can create a knowledge-based agent by
initializing with an empty knowledge base and telling the agent all the
sentences with which we want to start with. This approach is called
Declarative approach.
– Procedural approach: In the procedural approach, we directly encode
desired behavior as a program code. Which means we just need to write a
program that already encodes the desired behavior or agent.
• However, in the real world, a successful agent can be built by
combining both declarative and procedural approaches, and
declarative knowledge can often be compiled into more efficient
procedural code.
Logic Basics
• logic deals with study of principles of reasoning.
• Here, we study about how logic is built,or how the logical
representation help in the process of decisions.
• logic involves syntax, semantics and inference procedure.
• Syntax: there is variety of ways to represent syntax. it is not a concern
but it is the way an agent builds a base so that reasoning plays an
important parrt.
• Semantics: it deals with the meaning in sentential form, it can either
be true or false.
• Logical inferring: there is a notion of truth that is to be maintained.
even it needs to have the property of completeness.
Propositional logic-syntax,semantics and inferences
• Propositional logic (PL) is the most simple logic that is
concerned with the propositions and their relationship.
• It is a mathematical model that provides reasoning regarding the
logical value of an expression.
• A proposition is a declarative statement which is either true or
false but not both.
• Example:
– It is Sunday.
– The Sun rises from West (False proposition)
– 3+3= 7(False proposition)
– 5 is a prime number.
Syntax of propositional logic
• The syntax of propositional logic defines the allowable sentences for
the knowledge representation.
• There are two types of Propositions:
– Atomic Propositions (simple)
– Compound propositions
• Atomic Proposition: It consists of a single propositional symbol. This
symbol esentially represents if the proposition can be true or false.
• Example:
a) 2+2 is 4, it is an atomic proposition as it is a true fact.
b) "The Sun is cold" is also a proposition as it is a false fact.
• Compound proposition: Compound propositions are constructed
by combining simpler or atomic propositions, using parenthesis and
logical connectives.
• Example:
a) "It is raining today, and street is wet."
b) "Ankit is a doctor, and his clinic is in Mumbai."
Logical Connectives:
• Logical connectives are used to connect two simpler propositions or
representing a sentence logically.
• We can create compound propositions with the help of logical
connectives.
• There are mainly five connectives, which are given as follows:
• Negation: A sentence such as ~or ¬ P is called negation of P. A literal can
be either Positive literal or negative literal.
• Conjunction: A sentence which has ∧ connective such as, P ∧ Q is called a
conjunction.
Example: Rohan is intelligent and hardworking. It can be written as,
P= Rohan is intelligent,
Q= Rohan is hardworking. → P∧ Q.
• Disjunction: A sentence which has ∨ connective, such as P ∨ Q. is called
disjunction, where P and Q are the propositions.
Example: "Ritika is a doctor or Engineer",
Here P= Ritika is Doctor. Q= Ritika is Doctor, so we can write it as P ∨ Q.
• Implication: A sentence such as P → Q, is called an implication.
Implications are also known as if-then rules. It can be represented as
If it is raining, then the street is wet.
Let P= It is raining, and Q= Street is wet, so it is represented as P → Q
• Biconditional: A sentence such as P⇔ Q is a Biconditional sentence,
example If I am breathing, then I am alive
P= I am breathing, Q= I am alive, it can be represented as P ⇔ Q.
• Following is the summarized table for Propositional Logic Connectives:
Semantics of propositional logic
• It tells about the rules to determine the truth of a sentence.
• The model comprising a number of propositions actually defines the truth
value.

• with 2 propositional symbols the model will be 2^2, with 3 it will be 2^3.
Inference of propositional logic
• Generating the conclusions from evidence and facts is termed as
Inference.
• When comes to inference, we need to enumerate the models.
• The number of propositions playing part in it directly hampers the efficiency.
• The values where KB is true, and thus, the value of x is true indicate
inferring.
• Given a sentence n, the approach for deciding entailment is based on
recursive enumeration. The approach is:
Some Concepts
• Tautology: It states that the sentence is true if it is true in all
models.It is also called validity.
• Contradiction: Here, the proposition is always false.
• Satisfiability: A sentence or a proposition is satisfiable if it is true
for some model.
• To understand the relation between validity and satisfiability:
– Assume that a sentence x is valid.
– To prove that x is valid, we need to prove that ~x is not valid.
– we can state that, x I= y iff sentence (x^~y) is unsatisfiable.
– Proving y from x by checking the unsatisfiability is Proof by refutation or
contradiction.
Reasoning patterns in propositional logic
• Here, we use and apply the basic rules in order to derive chains of
conclusions to get the outcome or the target.
• These basic rules are also called patterns of inference.
• Two most commonly used rules are modes ponens and and-elimination.
– Modus ponens is represented as follows:
ɑ -> β, ɑ l-> β
• the rule states that when any sentence is in the form of ɑ -> β, and ɑ is given, then we can infer
β.
– In and-elimination , the rule is represented as
ɑ1^ɑ2^ɑ3^ɑn l->ɑi
• It states that from conjunctions, it is possible to infer any conjunction.
• These rules are actually the ones that eliminate the need for generating the
models.
• When these rules are applied, they generate sound(correct) inferences.
Resolution
• Resolution discuss about completeness.
• Resolution is a single inference rule, which gives a complete
inference algorithm when coupled with complete search algorithms.
• Any search algorithms, that is complete and applies the resolution
rule can derive any conclusion that is entailed in KB.
• suppose if x proposition is true, it is not possible to have resolution
to generate XvY, but can determine whether it is true or not.
• This is referred to as refutation completeness.
• Resolution is not ly applied to disjunctions but to conjection forms
also called conjunctive normal form (CNF).
Resolution Algorithm
Predicate logic
• In propositional logic, we can only represent the facts, which are either true
or false. It is not sufficient to represent the complex sentences or natural
language statements.
• The propositional logic has very limited expressive power.
• So, we required some more powerful logic, such as Predicate logic.
• It is also known as First-order logic. (more expressive)
• First-order logic statements can be divided into two parts:
– Subject: Subject is the main part of the statement.
– Predicate: A predicate can be defined as a relation, which binds two
atoms together in a statement.
• Consider the statement: "x is an integer.", it consists of two parts, the first
part x is the subject of the statement and second part "is an integer," is
known as a predicate.
Syntax and Semantics
• First-order logic (like natural language) does not only assume that the world
contains facts like propositional logic but also assumes the following things in
the world:
– Objects: A, B, people, numbers, colors, wars, theories, squares, pits, wumpus, ......
– Relations: It can be unary relation such as: red, round, is adjacent, or n-any relation
such as: the sister of, brother of, has color, comes between
– Function: Father of, best friend, third inning of, end of, ......
• As a natural language, first-order logic also has two main parts:
– Syntax
– Semantics
• The syntax of FOL determines which collection of symbols is a logical
expression in first-order logic. The basic syntactic elements of first-order logic
are symbols.
• We write statements in short-hand notation in FOL.
• For example,
• “The car is red”
– here ‘car’ is the subject and ‘is red’ is the predicate.
• While representing,
– R(x) ; where R is red and x is any object
• A sentence can be an atomic sentence or sentence connected to each other.
Atomic sentences:
• Atomic sentences are the most basic sentences of first-order logic. These
sentences are formed from a predicate symbol followed by a parenthesis with
a sequence of terms.
• We can represent atomic sentences as Predicate (term1, term2, ......, term n).
• Example: Ravi and Ajay are brothers: => Brothers(Ravi, Ajay).
Chinky is a cat: => cat (Chinky).
Complex Sentences:
•Complex sentences are made by combining atomic sentences using
connectives.
Inference in First-Order Logic
• Inference in First-Order Logic is used to deduce new facts or
sentences from existing sentences.
• Example:
– Shyam is an engineer.
– All engineers are intelligent.
• Here, intelligent and engineer are the classes. whereas, instance
indicates the membership belonging to the class.
• Instance(Shyam, Engineer) indicates the class membership.
Comparison of predicate and propositional logic
Unification
• Unification is a process of making two different logical atomic
expressions identical by finding a substitution.
• Unification depends on the substitution process.
• The substitution variables are called Most General Unifier or MGU.
• The UNIFY algorithm is used for unification, which takes two atomic
sentences and returns a unifier for those sentences (If any exist).
• It returns fail if the expressions do not match with each other.
• Unification is a key component of all first-order inference algorithms.
• Unification takes two literals as input and makes them identical using
substitution.
– Let Ψ1 and Ψ2 be two atomic sentences and 𝜎 be a unifier such that,
Ψ1𝜎 = Ψ2𝜎, then it can be expressed as UNIFY(Ψ1, Ψ2).
• Example: Find the MGU for Unify{King(x), King(John)}
– Let Ψ1 = King(x), Ψ2 = King(John),
– Substitution θ = {John/x} is a unifier for these atoms and applying this
substitution, and both expressions will be identical.
• E.g. Let's say there are two different expressions, P(x, y), and P(a, f(z)).
– In this example, we need to make both above statements identical to each
other.
– For this, we will perform the substitution.
– P(x, y)......... (i)
– P(a, f(z))......... (ii)
– Substitute x with a, and y with f(z) in the first expression, and it will be
represented as a/x and f(z)/y.
– With both the substitutions, the first expression will be identical to the second
expression and the substitution set will be: [a/x, f(z)/y].
Conditions for Unification:
• Following are some basic conditions for unification:
– Predicate symbol must be same, atoms or expression with
different predicate symbol can never be unified.
– Number of Arguments in both expressions must be identical.
– Unification will fail if there are two similar variables present in
the same expression.
Unification Algorithm
• Algorithm: Unify(Ψ1, Ψ2)
Implementation of the Algorithm
• Step.1: Initialize the substitution set to be empty.
• Step.2: Recursively unify atomic sentences:
a.Check for Identical expression match.
b.If one expression is a variable vi, and the other is a term ti which
does not contain variable vi, then:
a.Substitute ti / vi in the existing substitutions
b.Add ti /vi to the substitution setlist.
c.If both the expressions are functions, then function name must
be similar, and the number of arguments must be the same in both
the expression.
1. Find the MGU of {p(f(a), g(Y)) and p(X, X)} 2. Find the MGU of {p(b, X, f(g(Z))) and p(Z, f(Y),
f(Y))}
Sol:
Sol:
S0 => Here, Ψ1 = p(f(a), g(Y)), and Ψ2 = p(X,
Here, Ψ1 = p(b, X, f(g(Z))) , and Ψ2 = p(Z, f(Y), f(Y))
X)
S0 => { p(b, X, f(g(Z))); p(Z, f(Y), f(Y))}
SUBST θ= {f(a) / X}
SUBST θ={b/Z}
S1 => Ψ1 = p(f(a), g(Y)), and Ψ2 = p(f(a),
f(a)) S1 => { p(b, X, f(g(b))); p(b, f(Y), f(Y))}
SUBST θ= {f(a) / g(y)}, Unification failed. SUBST θ={f(Y) /X}

Unification is not possible for these S2 => { p(b, f(Y), f(g(b))); p(b, f(Y), f(Y))}
expressions. SUBST θ= {g(b) /Y}

S2 => { p(b, f(g(b)), f(g(b)); p(b, f(g(b)), f(g(b))}


Unified Successfully.
And Unifier = { b/Z, f(Y) /X , g(b) /Y}.
UNIFY(knows(Richard, x), knows(Richard, John))
•Sol:
Here, Ψ1 = knows(Richard, x), and
Ψ2 = knows(Richard, John)
S0 => { knows(Richard, x); knows(Richard, John)}
SUBST θ= {John/x}
S1 => { knows(Richard, John); knows(Richard, John)},
Successfully Unified.
Unifier: {John/x}.
Resolution in FOL
• Resolution is a theorem proving technique that proceeds by
building refutation proofs, i.e., proofs by contradictions.
• It was invented by a Mathematician John Alan Robinson in the year
1965.
• Resolution is used, if there are various statements are given, and
we need to prove a conclusion of those statements.
• Unification is a key concept in proofs by resolutions.
• Resolution is a single inference rule which can efficiently operate on
the conjunctive normal form or clausal form.
• Clause: Disjunction of literals (an atomic sentence) is called a
clause.
• It is also known as a unit clause.
• Conjunctive Normal Form: A sentence represented as a conjunction of
clauses is said to be conjunctive normal form or CNF.
• The resolution inference rule:
• The resolution rule for first-order logic is simply a lifted version of the
propositional rule.
• Resolution can resolve two clauses if they contain complementary literals,
which are assumed to be standardized apart so that they share no variables.

• Where li and mj are complementary literals.


• This rule is also called the binary resolution rule because it only resolves
exactly two literals.
• Example:
We can resolve two clauses which are given below:
[Animal (g(x) V Loves (f(x), x)] and [ ¬ Loves(a, b) V ¬ Kills(a, b)]
– Where two complimentary literals are: Loves (f(x), x) and ¬ Loves (a, b)
– These literals can be unified with unifier θ= [a/f(x), and b/x] , and it will
generate a resolvent clause:
– [Animal (g(x) V ¬ Kills(f(x), x)].
Steps for Resolution

• Conversion of facts into first-order logic.


• Convert FOL statements into CNF
• Negate the statement which needs to prove (proof by
contradiction)
• Draw resolution graph (unification).
• To better understand all the above steps, we will take an
example in which we will apply resolution.
• Example:
a.John likes all kind of food.
b.Apple and vegetable are food
c.Anything anyone eats and not killed is food.
d.Anil eats peanuts and still alive
e.Harry eats everything that Anil eats.
f. Prove by resolution that:
g.John likes peanuts.
• Step-1: Conversion of Facts into FOL
• In the first step we will convert all the given statements into its first
order logic.
• Step-2: Conversion of FOL into CNF
• In First order logic resolution, it is required to convert the FOL into CNF as
CNF form makes easier for resolution proofs.
• Eliminate all implication (→) and rewrite
a. ∀x ¬ food(x) V likes(John, x)
b. food(Apple) Λ food(vegetables)
c. ∀x ∀y ¬ [eats(x, y) Λ ¬ killed(x)] V food(y)
d. eats (Anil, Peanuts) Λ alive(Anil)
e. ∀x ¬ eats(Anil, x) V eats(Harry, x)
f. ∀x¬ [¬ killed(x) ] V alive(x)
g. ∀x ¬ alive(x) V ¬ killed(x)
h. likes(John, Peanuts).
• Move negation (¬)inwards and • Rename variables or standardize
rewrite variables
a. ∀x ¬ food(x) V likes(John, x) a. ∀x ¬ food(x) V likes(John, x)
b. food(Apple) Λ food(vegetables) b. food(Apple) Λ food(vegetables)
c. ∀x ∀y ¬ eats(x, y) V killed(x) V c. ∀y ∀z ¬ eats(y, z) V killed(y) V
food(y) food(z)
d. eats (Anil, Peanuts) Λ alive(Anil) d. eats (Anil, Peanuts) Λ alive(Anil)
e. ∀x ¬ eats(Anil, x) V eats(Harry, x) e. ∀w¬ eats(Anil, w) V eats(Harry, w)
f. ∀x ¬killed(x) ] V alive(x) f. ∀g ¬killed(g) ] V alive(g)
g. ∀x ¬ alive(x) V ¬ killed(x) g. ∀k ¬ alive(k) V ¬ killed(k)
h. likes(John, Peanuts). h. likes(John, Peanuts).
• Eliminate existential instantiation quantifier by elimination.
– In this step, we will eliminate existential quantifier ∃, and this process is known as
Skolemization. But in this example problem since there is no existential quantifier so
all the statements will remain same in this step.
• Drop Universal quantifiers.
– In this step we will drop all universal quantifier since all the statements are not
implicitly quantified so we don't need it.
a. ¬ food(x) V likes(John, x)
b. food(Apple)
c. food(vegetables)
d. ¬ eats(y, z) V killed(y) V food(z)
e. eats (Anil, Peanuts)
f. alive(Anil)
g. ¬ eats(Anil, w) V eats(Harry, w)
h. killed(g) V alive(g)
i. ¬ alive(k) V ¬ killed(k)
j. likes(John, Peanuts).
• Distribute conjunction ∧ over
disjunction ¬.
– This step will not make any change in
this problem.
Step-3: Negate the statement to be
proved
– In this statement, we will apply negation
to the conclusion statements, which will
be written as ¬likes(John, Peanuts)
Step-4: Draw Resolution graph:
– Now in this step, we will solve the
problem by resolution tree using
substitution. For the above problem, it
will be given as follows:
Explanation of Resolution graph
• In the first step of resolution graph, ¬likes(John, Peanuts) , and likes(John, x)
get resolved(canceled) by substitution of {Peanuts/x}, and we are left with ¬
food(Peanuts)
• In the second step of the resolution graph, ¬ food(Peanuts) , and food(z) get
resolved (canceled) by substitution of { Peanuts/z}, and we are left with ¬
eats(y, Peanuts) V killed(y) .
• In the third step of the resolution graph, ¬ eats(y, Peanuts) and eats (Anil,
Peanuts) get resolved by substitution {Anil/y}, and we are left with Killed(Anil) .
• In the fourth step of the resolution graph, Killed(Anil) and ¬ killed(k) get resolve
by substitution {Anil/k}, and we are left with ¬ alive(Anil) .
• In the last step of the resolution graph ¬ alive(Anil) and alive(Anil) get resolved.
Knowledge representation
Knowledge representation using rules
• Procedural Versus Declarative Knowledge
• Logic Programming
• Forward versus Backward Reasoning
• Matching
– Indexing
– Matching with Variables
– Complex and Approximate Matching
– Conflict Resolution
• Preference Based on Rules
• Preference Based on Objects
• Preference Based on States
Procedural Versus Declarative Knowledge

• The need for the representation of knowledge in terms of


rules is finally to get the solution.
• Two types of representation exist.
• A declarative representation is one in which knowldge
is specified, but the use to which that knowledge is to be
put is not given.
• A procedural representation is one in which the control
information that is necessary to use the knowledge is
considered to be embedded in the knowledge itself.
• The real difference between the declarative and the procedural
views of knowledge lies in where control information resides.
• Example:
Logic Programming
• Logic Programming is a programming language paradigm in
which logical assertions are viewed as programs.
• It comprises of facts(axioms) and rules(rules that determine goal).
• PROLOG program is described as a series of logical assertions
each of which is a Horn Clause.
• Prolog program = {Horn Clauses}
– Horn clause: disjunction of literals of which at most one is positive literal
– p,¬pVq,and p->q are horn clauses.
• Prolog program is decidable
• Control structure:
Prolog interpreter = backward reasoning + depth-first with
backtracking
Forward versus Backward Reasoning
• Forward: from the start states.
• Backward: from the goal states.
• Reason forward from the initial states:
– Begin building a tree of move sequences that might be solutions by
starting with the initial configurations at the root of the tree. Generate the
next level of the tree by finding all the rules whose left sides match the
root node and using their right sides to create the new configurations.
Continue until a confi guration that matches the goal state is generated.
• Reason backward from the goal states:
– Begin building a tree of move sequences that might be solutions by
starting with the goal configurations at the root of the tree. Generate the
next level of the tree by finding all the rules whose right side match the
root node.
Matching
• How to extract from the entire collection of rules that can be applied
at a given point?
=> Matching between current state and the precondition of the rules.
• Indexing
• One way to select applicable rules is to do a simple search through
all the rules, comparing each one’s preconditions to the current state
and extracting all the ones that match.
• But there are two problems with this simple solution:
– It will be necessary to use a large number of rules. scanning through all of them
at every step of the search would be hopelessly inefficient.
– It is not always immediately obvious whether a rule’s precondition’s are
satisfied by a particular state
Approximate matching
• Rules should be applied if their preconditions approximately
match the current situation
• Example: A speech-understanding program
– Rules: A description of a physical waveform to phones (a, e, …)
– Physical signal: differences in the way individuals speak, result
of background noise, …
• Women : i need your help.
• ELIZA how can i help you?
Conflict resolution

• The result of the matching process is a list of rules whose


antecedents
– Preferences based on rules:
• Specificity of rules
• Physical order of rules
–Preferences based on objects:
• Importance of objects
• Position of objects
–Preferences based on action:
• Evaluation of states
Semantic Networks
• Semantic networks are graphs, with
– nodes representing objects and
– arcs representing relationships between objects.
• The two most common types of relationships are
– Instance
– IS-A (Inheritance relation)
– HAS (Ownership relation)
Frame Systems
• It is an extensions of semantic networks.
• A frame is a collection of attributes or slots.

• Representation of frames:
Tendulkar
Instance: Batsman
Runs: 15500
Team: India
Inferences
• It is a mechanism by which reasoning takes place.
• Basic types are
– Deduction
– Induction
– Abduction
Uncertain Knowledge and Reasoning-Methods
• Uncertainty
• Let action At = leave for airport t minutes before flight
• Will At get me there on time?
– Problems:
1) partial observability (road state, other drivers’ plans, etc.)
2) noisy sensors (traffic reports)
3) uncertainty in action outcomes (flat tire, etc.)
4) immense complexity of modelling and predicting traffic
– Hence a purely logical approach either
1) risks falsehood: “A25 will get me there on time”
or
2) A1440 leads to conclusions that are too weak for decision making:
How To Deal With Uncertainty
Implicit methods:
•Ignore uncertainty as much as possible
•Build procedures that are robust to uncertainty
•This is the approach in the planning methods studied so far
(e.g.monitoring and replanning)
Explicit methods:
•Build a model of the world that describes the uncertainty (about the
system’s state, dynamics, sensors, model)
•Reason about the effect of actions given in the model
Methods for Handling Uncertainty
• Default reasoning
– Nonmonotonic logic: Allow the retraction of default beliefs if they
prove to be false
• Rule-based methods
– Certainty factors (Mycin): propagate simple models of belief
through causal or diagnostic rules
• Evidential reasoning
– Dempster-Shafer theory: Bel(P) is a measure of the evidence for
P; Bel(P) is a measure of the evidence against P; together they
define a belief interval (lower and upper bounds on confidence)
• Fuzzy reasoning
– Fuzzy sets: How well does an object satisfy a vague property?
– Fuzzy logic: “How true” is a logical statement?
Decision making with uncertainty
• Rational behavior:
– For each possible action, identify the possible outcomes
– Compute the probability of each outcome
– Compute the utility of each outcome
– Compute the probability-weighted (expected) utility over
possible outcomes for each action
– Select the action with the highest expected utility (principle of
Maximum Expected Utility)
Probability
• A well-known and well-understood framework for dealing with
uncertainty
• Has a clear semantics
• Provides principled answers for:
– Combining evidence
– Predictive and diagnostic reasoning
– Incorporation of new evidence
• Can be learned from data
• Intuitive to human experts (arguably?)
Bayesian Probability and Belief Network
• We use probability to describe uncertainty due to:
– Laziness: failure to enumerate exceptions, qualifications etc.
– Ignorance: lack of relevant facts, initial conditions etc.
– True randomness? Quantum effects? ...
• Probability can be interpreted from two views 1. Subjective and 2.Objective
• Bayesian or subjective probabilities - relate propositions to one’s current state of
knowledge.
– E.g. P(A(25)| no reported accident) = 0.1
These are not assertions about the world / absolute truth
• Beliefs change with new evidence:
– E.g. P(A(25)| no reported accident, 5am) = 0.2
• Bayesian probability is viewed as an extension of logic that enables reasoning with
uncertain statements.
Conditional Probability
• The basic statements in the Bayesian framework talk about
conditional probabilities.
– P(A|B) is the belief in event A given that event B is known with
certainty.
P(A|B)=P(A and B)/P(B)
• If it is rewritten as,
P(A ∧ B) = P(A|B)P(B) = P(B|A)P(A)
– Note: we often write P(A, B) as a shorthand for P(A ∧ B)
• This called Product Rule.
Bayes Rule
• Bayes rule is another alternative formulation of the product rule:

• It is used to infer the probability of hypothesis under observed data


or evidence. (bayesian inference).
• The complete probability formula states that:

• where bi form a set of exhaustive and mutually exclusive events.


• Bayesian inference
– Use probability theory and information about independence
– Reason diagnostically (from evidence (effects) to conclusions
(causes)) or causally (from causes to effects)

• Bayesian networks or belief network


– Compact representation of probability distribution over a set of
propositional random variables
– Take advantage of independence relationships
• We can define a Bayesian network as:
– "A Bayesian network is a probabilistic graphical model which represents a set
of variables and their conditional dependencies using a directed acyclic
graph."
• It is also called a Bayes network, belief network, decision network, or
Bayesian model.
• Bayesian networks are probabilistic, because these networks are built from a
probability distribution, and also use probability theory for prediction and
anomaly detection.
• Real world applications are probabilistic in nature, and to represent the
relationship between multiple events, we need a Bayesian network.
• It can also be used in various tasks including prediction, anomaly detection,
diagnostics, automated insight, reasoning, time series prediction, and
decision making under uncertainty.
• Bayesian Network can be used for building models from data and experts
opinions, and it consists of two parts:
– Directed Acyclic Graph
– Table of conditional probabilities.
• The generalized form of Bayesian network that represents and solve decision
problems under uncertain knowledge is known as an Influence diagram.
• A Bayesian network graph is made up of nodes and Arcs (directed links), where:
– Each node corresponds to the random variables, and a variable can be continuous or
discrete.
– Arc or directed arrows represent the causal relationship or conditional probabilities
between random variables. These directed links or arrows connect the pair of nodes in the
graph.
– These links represent that one node directly influence the other node, and if there is no
directed link that means that nodes are independent with each other
• Bayesian network is based on Joint probability distribution and conditional
probability.
Joint probability distribution:
• If we have variables x1, x2, x3,....., xn, then the probabilities of a different
combination of x1, x2, x3.. xn, are known as Joint probability distribution.
• P[x1, x2, x3,....., xn], it can be written as the following way in terms of the
joint probability distribution.
= P[x1| x2, x3,....., xn]P[x2, x3,....., xn]
= P[x1| x2, x3,....., xn]P[x2|x3,....., xn]....P[xn-1|xn]P[xn].
• In general for each variable Xi, we can write the equation as:
P(Xi|Xi-1,........., X1) = P(Xi |Parents(Xi ))
Example for Bayesian network
• Let's understand the Bayesian network through an example by creating a
directed acyclic graph:
• Example: Harry installed a new burglar alarm at his home to detect burglary.
The alarm reliably responds at detecting a burglary but also responds for
minor earthquakes. Harry has two neighbors David and Sophia, who have
taken a responsibility to inform Harry at work when they hear the alarm.
David always calls Harry when he hears the alarm, but sometimes he got
confused with the phone ringing and calls at that time too. On the other hand,
Sophia likes to listen to high music, so sometimes she misses to hear the
alarm. Here we would like to compute the probability of Burglary Alarm.
• Problem:
Calculate the probability that alarm has sounded, but there is neither a
burglary, nor an earthquake occurred, and David and Sophia both called the
Harry.
• Solution:
• List of all events occurring in this network:
– Burglary (B)
– Earthquake(E)
– Alarm(A)
– David Calls(D)
– Sophia calls(S)
• We can write the events of problem statement in the form of probability: P[D, S, A, B, E], can
rewrite the above probability statement using joint probability distribution:

– P[D, S, A, B, E]= P[D | S, A, B, E]. P[S, A, B, E]


= P[D | S, A, B, E]. P[S | A, B, E]. P[A, B, E]
= P [D| A]. P [ S| A, B, E]. P[ A, B, E]
= P[D | A]. P[ S | A]. P[A| B, E]. P[B, E]
= P[D | A ]. P[S | A]. P[A| B, E]. P[B |E]. P[E]
• From the formula of joint distribution, we can write the problem statement in
the form of probability distribution:
P(S, D, A, ¬B, ¬E) = P (S|A) *P (D|A)*P (A|¬B ^ ¬E) *P (¬B) *P (¬E).
= 0.75* 0.91* 0.001* 0.998*0.999
= 0.00068045.
• Hence, a Bayesian network can answer any query about the domain by using
Joint distribution.
• The semantics of Bayesian Network:
• There are two ways to understand the semantics of the Bayesian network,
which is given below:
• 1. To understand the network as the representation of the Joint probability
distribution. (It is helpful to understand how to construct the network.)
• 2. To understand the network as an encoding of a collection of conditional
independence statements. (It is helpful in designing inference procedure.)
Probabilistic reasoning
• Probabilistic reasoning is a way of knowledge representation
where we apply the concept of probability to indicate the
uncertainty in knowledge.
• In probabilistic reasoning, we combine probability theory with logic
to handle the uncertainty.
• We use probability in probabilistic reasoning because it provides a
way to handle the uncertainty that is the result of someone's
laziness and ignorance.
• In the real world, there are lots of scenarios, where the certainty of
something is not confirmed, such as "It will rain today," here we
can assume that it will happen but not sure about it, so here we
use probabilistic reasoning.
Probabilistic Reasoning over Time

• The world changes; we need to track and predict it.


• Basic idea: copy state and evidence variables for each
time step
– Xt = set of unobservable state variables at time t
– Et = set of observable evidence variables at time t
• This assumes discrete time; step size depends on
problem
– Notation: Xa:b = Xa,Xa+1, . . . ,Xb−1,Xb
• Need of probabilistic reasoning in AI:
– When there are unpredictable outcomes.
– When specifications or possibilities of predicates becomes too large to
handle.
– When an unknown error occurs during an experiment.
• In probabilistic reasoning, there are two ways to solve problems
with uncertain knowledge:
– Bayes' rule
– Bayesian Statistics
Markov processes (Markov chains)
Inference tasks
Forward and backward reasoning
• Forward chaining or data-driven inference works from an initial
state, and by looking at the premises of the rules (IF-part),
perform the actions (THEN-part), possibly updating the knowledge
base or working memory.
• This continues until no more rules can be applied or some cycle
limit is met, e.g.
• In example: no more rules, that is, inference chain for this
is:

• Problem with forward chaining:


• many rules may be applicable. The whole process is not
directed towards a goal.
• Backward chaining or goal-driven inference works towards a final
state, and by looking at the working memory to see if goal already
there. If not look at the actions (THEN-parts) of rules that will
establish goal, and set up subgoals for achieving premises of the
rules (IF-part).
• This continues until some rule can be applied, apply to achieve goal
state.
• Advantage of backward chaining:
• search is directed
• Disadvantage of backward chaining:
• goal has to be known
Other uncertainity techniques

• Data mining
• Fuzzy logic
• Dempster -shafer theory

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy