0% found this document useful (0 votes)
10 views74 pages

Knowledge-Based Agents in AI Explained

Knowledge-based agents in AI require an internal knowledge base and inference system to make decisions and act efficiently. They learn from experiences, update their knowledge, and perform operations like TELL and ASK. The document also discusses knowledge representation, reasoning types, and inference rules, highlighting the importance of logical structures in AI decision-making.

Uploaded by

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

Knowledge-Based Agents in AI Explained

Knowledge-based agents in AI require an internal knowledge base and inference system to make decisions and act efficiently. They learn from experiences, update their knowledge, and perform operations like TELL and ASK. The document also discusses knowledge representation, reasoning types, and inference rules, highlighting the importance of logical structures in AI decision-making.

Uploaded by

madhuriloni0
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd

UNIT 3

KNOWLEDGE AND REASONING


KNOWLEDGE BASED AGENT IN AI
 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.
THE ARCHITECTURE OF KNOWLEDGE-BASED AGENT:
 Knowledge-based agents are composed of
two main parts:

⚫ Knowledge-base and
⚫ Inference system.
 The knowledge-based agent (KBA) take
input from the environment

 The input is taken by the inference engine


of the agent and which also communicate
with KB to decide as per the knowledge
store in KB.

 The learning element of KBA regularly


updates the KB by learning new knowledge.
KNOWLEDGE BASE:
 Knowledge-base is a central component of a
knowledge-based agent, it is also known as
KB.

 The Knowledge-base of KBA stores fact


about the world.
WHY USE A KNOWLEDGE BASE?

 Knowledge-base is required for updating


knowledge for an agent to learn with
experiences and take action as per the
knowledge.
OPERATIONS PERFORMED BY KBA

 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.


STRUCTURE OUTLINE OF A GENERIC
KNOWLEDGE-BASED AGENTS PROGRAM:
APPROACHES TO DESIGN
KNOWLEDGE BASED AGENT
 Declarative Approach:
-In this beginning from an empty knowledge base, the
agent can TELL sentences one after another till the
agent has knowledge of how to work with its
environment.
-It stores required information in empty knowledge-
based system.

 Procedural Approach: This converts required


behaviors directly into program code in empty
knowledge-based system. In this by coding behavior
of system is designed .
KNOWLEDGE REPRESENTATION
 Humans are best at understanding,
reasoning. Human perform various actions
in the real world as per their knowledge.

 But how machines do all these things


comes under knowledge
representation and reasoning?
KNOWLEDGE REPRESENTATION
 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.

 So that machine can solve complex problems like-


- diagnosis a medical condition
- communicating with humans in natural
language.
WHAT TO REPRESENT:

 Object: All the facts about objects in our world

 Events: Events are the actions which occur in our


world.

 Performance: It describe behavior which involves


knowledge about how to do things.

 Meta-knowledge: It is knowledge about what we know.

 Facts: Facts are the truths about the real world and
what we represent.

 Knowledge-Base: The central component of the


knowledge-based agents is the knowledge base.
RELATION BETWEEN KNOWLEDGE
AND INTELLIGENCE
AI KNOWLEDGE CYCLE

For showing intelligent


behavior, an artificial
intelligence system must
have the following
components:

• Perception
• Learning
• Knowledge
Representation
• Reasoning
• Planning
• Execution
TECHNIQUES OF KNOWLEDGE
REPRESENTATION

[Link] Representation
[Link] Network Representation
[Link] Representation
[Link] Rules
LOGICAL REPRESENTATION

? It represents a conclusion based on various


conditions and lays down some
important communication rules.
SEMANTIC NETWORK
REPRESENTATION

? In Semantic networks, you can represent your


knowledge in the form of graphical networks.

? This network consists of nodes representing objects and


arcs which describe the relationship between those
objects.
Statements:
• Jerry is a cat.
• Jerry is a mammal.
• Jerry is owned by Priya.
• Jerry is brown colored.
• All Mammals are animal.
FRAME REPRESENTATION

? A frame is a record-like structure that


contains a set of properties and their values
to describe a physical thing.
PRODUCTION RULES

Production rules system consists of (condition,


action) pairs which means, "If condition then
action".

Example:
IF (at bus stop AND bus arrives) THEN
action (get into the bus)
IF (on the bus AND paid AND empty seat)
THEN action (sit down).
IF (on bus AND unpaid) THEN action (pay
charges).
IF (bus arrives at destination) THEN
action (get down from the bus.
PROPOSITIONAL LOGIC
 All statements are made up of propositions.

 The term "Proposition“ refers to a


declarative statement that can be true or
false.

 It's a method of expressing knowledge in


logical and mathematical terms.
Example:

 It is Sunday.
 The Sun rises from West (False proposition)
 3 + 3 = 7 (False proposition)
 5 is a prime number.
SOME BASIC FACTS ABOUT
PROPOSITIONAL LOGIC:
 It also known as Boolean logic because it
operates 0 and 1.

 Tautology, is a proposition formula that is


always true.

 Contradiction is a proposition formula that


is always false.

 Statements that are inquiries, demands, or


opinions are not propositions,
such as "Where is ABC“ "How are you"
SYNTAX OF PROPOSITIONAL LOGIC:
 Atomic propositions: It is made up of only
one proposition sign. These are the sentences
that must be true or untrue in order to pass.
Example:
⚫ 2+2 is 4, it is an atomic proposition as it is a true
fact.
⚫ "The Sun is cold" is also a proposition as it is a
false fact.

 Compound proposition: Atomic statements


are combined with parenthesis and logical
connectives to form compound propositions.
Example:
⚫ "It is raining today, and street is wet."
⚫ "Ankit is a doctor, and his clinic is in Mumbai."
PROPOSITIONAL LOGICAL
CONNECTIVES:
THE TRUTH TABLE FOR ALL
PROPOSITIONAL LOGICAL
CONNECTIVES
PROPERTIES OF OPERATORS:
 Commutative:
⚫ P ∧ Q= Q ∧ P, or
⚫ P ∨ Q = Q ∨ P.

 Associative:
⚫ (P ∧ Q) ∧ R = P ∧ (Q ∧ R),
⚫ (P ∨ Q) ∨ R= P ∨ (Q ∨ R).

 Identity element:
⚫ P ∧ True = P,
⚫ P ∨ True= True.
 Distributive:
⚫ P ∧ (Q ∨ R) = (P ∧ Q) ∨ (P ∧ R).
⚫ P ∨ (Q ∧ R) = (P ∨ Q) ∧ (P ∨ R).

 DE Morgan's Law:
⚫ ¬(P ∧ Q) = (¬P) ∨ (¬Q),
⚫ ¬(P ∨ Q) = (¬ P) ∧ (¬Q).

 Double-negation elimination:
⚫ ¬(¬P) = P.
LIMITATIONS OF PROPOSITIONAL
LOGIC:

 This is not possible to represent relations


like ALL, some, or none with propositional
logic. Example:
⚫ All the students are intelligent.
⚫ Some apples are sweet.

 The expressive power of propositional logic


is restricted.
RULES OF INFERENCE

 Inference:
Inference is the process of drawing
conclusions from data and facts.

 Inference rules:
1. The templates for creating valid arguments
are known as inference rules.
2. inference rules are used to generate proofs
3. Proof is a series of conclusions that leads
to the intended outcome.
SOME TERMS RELATING TO INFERENCE RULES

 Implication: It's one of the logical


connectives, denoted by the letters P → Q.

 Converse: The converse of implication. It is


denoted by the letters Q → P.

 Contrapositive: Negation of converse, that


is ¬ Q → ¬ P.

 Inverse: Inverse is the Negation of


implication. That is ¬ P → ¬ Q
VERIFY USING THE TRUTH TABLE:

 Hence it is proved that –


P → Q is equivalent to ¬ Q → ¬ P, and
Q→ P is equivalent to ¬ P → ¬ Q.
TYPES OF INFERENCE RULES:
1. MODUS PONENS:

If P and P → Q are both true, we can infer that


Q will be true as well. It's written like this:
 Example:
Statement-1: "If I am sleepy then I go to
bed" ==> P → Q
Statement-2: ""I am sleepy" ==> P"
Conclusion: "I go to bed." ==> Q.
Hence, we can say that, if P → Q is true and
P is true then Q will be true.

 Proof by Truth table:


TYPES OF INFERENCE RULES:
2. MODUS TOLLENS:

If P→ Q is true and ¬ Q is true, then ¬ P will


also true.
 Example:
Statement-1: "If I am sleepy then I go to
bed" ==> P→ Q
Statement-2: "I do not go to the bed."==>
~Q
Statement-3: Which infers that "I am not
sleepy" => ~P

 Proof by Truth table:


TYPES OF INFERENCE RULES:
3. HYPOTHETICAL SYLLOGISM:

 If P→R is true whenever P→Q is true, and


Q→R is true.
 Example:
Statement-1: If you have my home key then you
can unlock my home. P→Q
Statement-2: If you can unlock my home then you
can take my money. Q→R
Statement-3: If you have my home key then you
can take my money. P→R
 Proof by Truth table:
TYPES OF INFERENCE RULES:
4. DISJUNCTIVE SYLLOGISM:
 If P∨Q is true, and ¬P is true, then Q will be
true.
 Example:
Statement-1:Today is Sunday or Monday.
==>P∨Q
Statement-2:Today is not Sunday. ==> ¬P
Conclusion: Today is Monday. ==> Q

 Proof by Truth table:


TYPES OF INFERENCE RULES:
5. ADDITION:

 If P is true, then P∨Q will be true.


 Example:
Statement-1: I have a vanilla ice-cream.
==> P
Statement-2: I have Chocolate ice-cream.
Conclusion: I have vanilla or chocolate ice-
cream. ==> (P∨Q)

 Proof by Truth table:


TYPES OF INFERENCE RULES:
6. SIMPLIFICATION:
 If P∧ Q is true, then Q or P will also be true.
TYPES OF INFERENCE RULES:
7. RESOLUTION:
 If P∨Q and ¬ P∧R is true, then Q∨R will also be
true.
FIRST ORDER LOGIC
 In propositional logic, we can only
represent the facts

 The propositional logic has very limited


expressive power.
Ex . "Some humans are intelligent", or
"Sachin likes cricket.“

 First-order logic assumes the world contains


facts, objects and relations.
QUANTIFIERS IN FIRST-ORDER LOGIC:
 A quantifier is a language element which
generates quantification, and quantification
specifies the quantity of specimen in the
universe of discourse.

 These are the symbols that permit to


determine or identify the range and scope
of the variable in the logical expression.
There are two types of quantifier:
⚫ Universal Quantifier, (for all, everyone,
everything)
⚫ Existential quantifier, (for some, at least
one).
POINTS TO REMEMBER ABOUT
QUANTIFIER

 The main connective for universal


quantifier ∀ is implication →.

 The main connective for existential


quantifier ∃ is and ∧.
EXAMPLES OF FOL USING
QUANTIFIER:
 1. All birds fly.
∀x bird(x) →fly(x).

 2. Every man respects his parent.


∀x man(x) → respects (x,
parent).

 3. Some boys play cricket.


∃x boys(x) ∧ play(x, cricket).
FORWARD CHAINING AND BACKWARD
CHAINING IN AI

 Inference engine commonly proceeds in two


modes, which are:

Forward chaining
Backward chaining
FORWARD CHAINING

 Based on available data a decision is taken


then the process is called as Forwarding
chaining.

 It works from an initial state and reaches to


the goal(final decision).
BACKWARD CHAINING:
 In this, the inference system knows the final
decision or goal, this system starts from the
goal and works

 i.e it works from goal(final decision) and


reaches the initial state.
REASONING
 The reasoning is the mental process of deriving
logical conclusion and making predictions from
available knowledge, facts, and beliefs.

 "Reasoning is a way to infer facts from


existing data."

 It is a general process of thinking rationally, to


find valid conclusions.

 In artificial intelligence, the reasoning is


essential so that the machine can also think
rationally as a human brain, and can perform
like a human.
TYPES OF REASONING

 Deductive reasoning
 Inductive reasoning
 Abductive reasoning
 Common Sense Reasoning
 Monotonic Reasoning
 Non-monotonic Reasoning
DEDUCTIVE REASONING

 Deductive Reasoning is the strategic approach


that uses available facts, information or
knowledge to draw valid conclusions.

 Deductive reasoning uses a top-down approach.

 If the value of the premises is true, then the


conclusion is also true.

 Example -
People who are aged 20 or above are active
users of the internet.
INDUCTIVE REASONING:
 Inductive reasoning is associated with the
hypothesis-generating approach rather than
drawing any particular conclusion to the facts at
the beginning of the process.

 Inductive reasoning is the bottom-up process.

 In inductive Reasoning even if the premises are


true there is no chance that the conclusion will
also be true
 Example –
I got 20 marks in FAM, I always got out off marks
in each subject.
ABDUCTIVE REASONING:
 It draws conclusions based on what facts
you know at present rather than collecting
some outdated facts and information.

 Example –
 Doctor drawing conclusions regarding your
health based on test reports.
COMMON SENSE REASONING
? Common sense reasoning is the most
occurred type of reasoning in daily life
events.

? It is the type of reasoning which comes from


experiences.

? Draw the conclusion based on previous


experience.

? Example –
? A kid will never touch a glass of hot water
after burning his hand.
MONOTONIC REASONING:

 Once the conclusion is taken, then it will


remain the same even if we add some other
information to existing information in our
knowledge base.

 Monotonic reasoning is not useful for the


real-time systems, as in real time, facts get
changed, so we cannot use monotonic
reasoning.

 Example –
 Earth revolves around the Sun.
NON-MONOTONIC REASONING
 In Non-monotonic reasoning, some conclusions
may be invalidated if we add some more
information to our knowledge base.

 Example: Let suppose the knowledge base


contains the following knowledge:
 Birds can fly, Penguins cannot fly, Pittu is a
bird
 So from the above sentences, we can conclude
that Pittu can fly.
 However, if we add one another sentence into
knowledge base "Pittu is a penguin", which
concludes "Pittu cannot fly", so it invalidates
the above conclusion.
PROBABILISTIC REASONING IN AI

 Probabilistic reasoning is a key aspect


of artificial intelligence (AI) that allows for
handling uncertainty and ambiguity in
decision-making.

 It is a powerful technique that enables AI


systems to make informed decisions even
when faced with incomplete or noisy data.
UNCERTAINTY:
? We have learned knowledge representation
using first-order logic and propositional logic
with certainty, where A→B, which means if A is
true then B is true.

? But consider a situation where we are not sure


about whether A is true or not then we cannot
express this statement, this situation is called
uncertainty.
CAUSES OF UNCERTAINTY:

 Following are some leading causes of


uncertainty to occur in the real world.

1. Information occurred from unreliable


sources.
2. Experimental Errors
3. Equipment fault
4. Temperature variation
5. Climate change.
PROBABILISTIC REASONING IN AI

? 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.
 In the real world, there are lots of scenarios,
where the certainty of something is not
confirmed, such as

• "It will rain today,"


• “Virat will score 100 runs today”
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.
BAYES’ THEOREM

 Bayes’ Theorem is named after


Reverend Thomas Bayes.
 That is used to find the probability of an event,
based on prior knowledge
 Bayes theorem is also known as the Bayes Rule
or Bayes Law.
 It is used to determine the conditional
probability of event A when event B has already
happened.
BAYES THEOREM FORMULA

where,

P(A) and P(B) are the probabilities of events A and


B also P(B) is never equal to zero.

P(A|B) is the probability of event A when event B


happens

P(B|A) is the probability of event B when A happens

You might also like