Professional Documents
Culture Documents
CSNB234 - Chap5 - Notes - Sem 1 20232024
CSNB234 - Chap5 - Notes - Sem 1 20232024
Outline
• Formal Logic
• Semantic Networks
• Conceptual Graph
• Frames
• Scripts
• Production Rule
• Reasoning Methods in Production Rule Systems
1
CSNB234 Artificial Intelligence
Introduction
• 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?
2
CSNB234 Artificial Intelligence
Introduction
• So It is crucial for representing information about
the real world to a machine
• By doing that, computer/machine can
understand and can utilize this knowledge to
solve the complex real world problems such as
diagnosis a medical condition or communicating
with humans in natural language.
• 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.
3
CSNB234 Artificial Intelligence
Introduction
4
CSNB234 Artificial Intelligence
Knowledge Representation
• Types of knowledge which needs to be represented in
AI systems:
– Object: All the facts about objects in our world domain.
E.g., Guitars contains strings, trumpets are brass
instruments.
– 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. It is
represented as KB. The Knowledgebase is a group of the
Sentences (Here, sentences are used as a technical term
5
and not identical with the English language).
CSNB234 Artificial Intelligence
6
CSNB234 Artificial Intelligence
Syntax:
•Syntaxes are the rules which decide how we
can construct legal sentences in the logic.
•It determines which symbol we can use in
knowledge representation.
•How to write those symbols.
Semantics:
Semantics are the rules by which we can interpret the
sentence in the logic.
Semantic also involves assigning a meaning to each
sentence. 8
CSNB234 Artificial Intelligence
11
CSNB234 Artificial Intelligence
Example 2:
Draw a semantic network for the following description: Lab
is a room. Lab has a door. Lab has many computers. Printer
is in lab. Laser printer is a Printer.
has_a
DOOR
is_a
LAB ROOM
has
in COMPUTERS
is_a
PRINTERS LASER_PRINTER
12
CSNB234 Artificial Intelligence
14
CSNB234 Artificial Intelligence
action
17
CSNB234 Artificial Intelligence
Production Rules
• The human mental process is too complex to be
represented as an algorithm
• However, most experts are capable of expressing
their knowledge in the form of rules for their
problem solving
• Facts, rules and inference engines are required to
execute a rule-based expert system
• Most Expert Systems (ES) are rule-based
– i.e. the knowledge-base of the ES consists of a huge set of
production rules (or just “rules”)
• Production-rules system captures knowledge in simple
“if-then” format.
• e.g.
• IF the traffic-light is green THEN the action is go 18
CSNB234 Artificial Intelligence
Recommendation:
21
CSNB234 Artificial Intelligence
“Firing” of Rules
• When the condition part of a rule is satisfied,
the rule is said to fire and the action part is
executed.
• The inference engine carries out the reasoning
whereby the expert system reaches a solution.
It links the rules given in the KB with the facts
provided in the DB.
• The explanation facility enables the user to ask
questions such as “why” & “how”.
22
CSNB234 Artificial Intelligence
Forward Backward
chaining chaining
• Data-driven • Goal-driven
reasoning reasoning
23
CSNB234 Artificial Intelligence
Forward Chaining
• This is the data-driven reasoning.
• The reasoning starts from the known fact or
data and proceeds forward with the data.
• Each time only the topmost rule is executed.
• When fired, the rule adds a new fact in the
database. Powerful
mechanism
• Any rule can be executed only once.
• The match-fire cycle stops when no further
rules can be fired.
24
CSNB234 Artificial Intelligence
25
CSNB234 Artificial Intelligence
KB DB
Rule 1: If A and C Then F
Rule 2: If A and E Then G
Rule 3: If B Then E
AB
Rule 4: If G Then D
26
CSNB234 Artificial Intelligence
Rule-based system
(Forward reasoning example)
27
CSNB234 Artificial Intelligence
Final goal: the person is R1: IF you eat beef or eggs THEN high
cholesterol
Unhealthy.
R2: IF you eat fish or poultry and no beef THEN
Rules that fired are: R8, R1, low cholesterol
R7 & Stopped. R3: IF you eat no beef and no fish and no
poultry THEN low cholesterol
R4: IF you are Catholic and today is Friday THEN
• Note: Conditions of other you eat no fish and no beef
rules are not satisfied thus R5: IF you are a vegetarian THEN you eat no
they are not executed in the fish, no beef and no poultry
R6: IF low cholesterol THEN healthy
forward chaining system to
R7: IF high cholesterol THEN unhealthy
conclude the “unhealthy” R8: IF you eat veal THEN you eat beef
decision. R9: If you work 6 hours or less today THEN it is
Friday 29
CSNB234 Artificial Intelligence
What if you are catholic, eat poultry and work 4 hours today? Advise the person on his health
situation.
Final Recommendation: The person is Healthy.
30
CSNB234 Artificial Intelligence
• Also, students need to mention why other rules are not used.
• An example is given below:
– R1 is not used because no clue on ‘egg’.
– R3 is not fired because the person eats poultry. So the condition is false.
– R5 is not used since not told that he is a vegetarian.
– R8 is not fired since ‘”eat veal” is unknown.
31
CSNB234 Artificial Intelligence
How? By firing R3, R1, and R4. Other rules all failed.
Rule 4: IF Y is true
AND C is true
THEN W is true
32
CSNB234 Artificial Intelligence
Backward Chaining
• Backward chaining is the goal-driven reasoning.
• Best applied when we want to find out the
reason once something has occurred.
• In this reasoning method, the expert system is
trying to satisfy a goal (i.e. there is a
hypothetical solution) and the inference engine
move attempts to find the evidence to prove it.
• If evidences are found, the goal is proved.
• If not, backtracking is initiated.
34
CSNB234 Artificial Intelligence
36
CSNB234 Artificial Intelligence
Procedure: Start with the rule that has the goal in its THEN part: catch the
6:00 flight (rule 5). Match that rule’s IF part to a preceding rule’s
THEN part (rule 4). Proceed in this way to arrive at the satisfying
premise (the IF part of rule 1):
Wake up at 4:00.
37
CSNB234 Artificial Intelligence
38
CSNB234 Artificial Intelligence
Summary
• Formal Logic
• Semantic Networks
• Conceptual Graph
• Frames
• Scripts
• Production Rule
• Reasoning Methods in Production Rule Systems
39