Principles/Foundations of Artificial Intelligence.
Inferencing methods
Inferencing
By inferencing refers to the method used in a knowledge-
based system to produce correct conclusions using existing
facts.
It involves finding clues(facts),Putting them together inorder
and drawing conclusions from them
Synonyms of inferencing include:
Deduce
Figure out
Interpretation
Reason
Drawing conclusions
Goals of reasoning
The goal of reasoning is usually to:
1. Determine the state of the world
2. Determine what actions to take
3. Determine how the world behaves
Inferencing techniques
Forward chaining
Deductive reasoning
Inductive reasoning
Backward chaining
case-based Reasoning (CBR)
Fuzzy logic reasoning
Forward chaining
Forward chaining: involves working from the existing
facts to draw a conclusion.
It is also called the data-driven approach.
Forward chaining
To chain forward, match data in working memory
against 'conditions' of rules in the rule-base.
When one of them fires, its conclusion is liable to
become condition for another rule so the cycle
continues.
Forward chaining: Example
Inference the following rule using forward chain
strategy:
“If soil hasn't enough nitrogen, then it is poor soil. If it is poor
soil, then corn grown on it will rot”
Forward chaining reasoning :
This soil is low in nitrogen; therefore this is poor soil;
consequently corn grown on it will rot.
Forward chaining: Example
If X croaks and eats flies - Then X is a frog.
If X chirps and sings - Then X is a canary.
If X is a frog - Then X is green
If X is a canary - Then X is yellow
Question:
Your pet Y croaks and eats flies
Use forward chain to determined the colour of the
pet?
Example: solution
Step one: convert verbs into symbols
Croaks=A, eats flies=B,frog =c ,chirps and sings=D, canary=E, green=F , yellow=
G
if A and B Then C
If C then F
If D then E
If E then G
Answer
FACTS : A, B ,
Forward Chaining: A and B →C
C→F
F=green
the pet is Green in colour
Backward chaining algorithm
Involves working from the conclusion to the facts.
Sometimes called the goal-driven approach.
Take the goal to reach.
To chain backward, match the goal against 'conclusions'
of rules in the rule-base.
Determine what facts produced (fired) by matching rules
The facts become new goals (sub-goals) for the search.
The search continues backward until it identifies to the
facts of the problem.
The path is formed from facts to goal although it does so
in backward order.
Backward chaining: Example
e.g. Here are two rules:
If soil hasn't enough nitrogen, then it is poor soil.
If soil is poor, then corn grown on it will rot.
Backward chaining: This corn is rotten; therefore it must
have been grown on poor soil; therefore the soil must be
low in nitrogen.
Backward chaining: Example
The crop has rotten . What are the likely causes?
Solution
Goal : C
If A then B
If B then C
C →B Fires
Sub goal : B
B → A fires.
B-poor soil
A- Low nitrogen
Exercise
You are given an expert system with several rules
pertaining to the interpersonal skills of a job applicant
R1: if the applicant answers questions in straight
forward manner then she is easy to converse with.
R2: If the applicant seems honest then she answers in
straight forward manner.
Exercise
R3: If the applicant has item on her resume that are
found to be untrue then she is not honest.
R4: If the applicant is able to arrange an appointment
with the executive assistant then she is able to strike up a
conversation with the executive assistant.
R5: IF the applicant strikes up a conversation with the
executive assistant and the applicant is easy to converse
with then she is amiable.
R6: If the applicant has adequate interpersonal skills.
Then we will offer her the job.
Exercise
Solve the following problems:
a) assume that the applicant does not have any items
on her resume that are found to be untrue and that
she is able to arrange an appointment with the
executive assistant.
Run a forward chain analysis to find out whether we
will offer her a job.
Exercise
B) it is known that the applicant answers questions in
straight forward manner.
Run backward chain analysis to find out
Whether we will offer a job to the applicant
Exercise
C) we have just discovered that the applicant was able
to arrange an appointment with the executive
assistant.
It is also known that she is honest.
Does she have interpersonal skills?.
Exercise : solution
Step1: Use symbols to represent knowledge.( facts and sub
goals)
A –Straight forward
B- Easy to converse
C-honest
D-items on the resume to be untrue
E – able to arrange an appointment
F- able to strike a conversation
G-amiable
H- adequate interpersonal skills
I- offer a job
Exercise : solution
Step2: Use symbols to represent rules
If A then B
If c then A
If D then not c
If not D then c
If E then F
If F and B then G
IF H then I
Exercise : Solutions
A) facts : not D,E
Goal: I
Forward reasoning
not D,C,A,E,F -failure
no job( we could reach Goal I)
B) facts: A,
Goal:I
Backward Reasoning : I,H
– failure
- Could fire A as one of the facts
Exercise : solutions
C) KNOWN FACTS: E, C
GOAL =H
Forward Reasoning :E, C,A,F –failure
-Could fire H as one of the conclusions
No interpersonal skills.
Deductive Reasoning
Reasoning from the general to the specific
For example, start with a general statement:
All cars have tires.
You can apply this general statement to specific
instances and deduce that a Ford Escort, a Toyota
Camry, and a Mercedes Benz must have tires.
Deduction Example
All chefs are violinists.
Mary is a chef.
Therefore Mary is a violinist
Deductive Reasoning example
Broad Specific
Generalizations Conclusions
Example: All varsity My art history
course
courses are hard will be hard
Inductive reasoning
This involves Reasoning from the specific
Facts to conclude a general rule.
i.e. A general rule is concluded out of specific cases among which all the rules are
applicable
It is more commonly known as learning
Inductive reasoning example
18 16 14 ?? ??
12 10
The general rule in this example is:
Decrease by 2
Or
F(x)= x-2
Inductive reasoning problems
What is the general rule of writing the following numbers?
5 10 15 ?? ?? ?? ?? ?? ?? ?? ??
20 25 30 35 40 45 50 55
General Rule is:-
Increase by five
Or
F(x)=x+5
Inductive Reasoning
Example :
Specific Reasoning Broad Principles
Example:
My history All varsity courses
requires a lot of requires a lot of reading
reading
Case-based Reasoning (CBR)
Adapt solutions used to solve old problems for new
problems
CBR finds cases that solved problems similar to the
current one, and adapts the previous solution or solutions
to fit the current problem, while considering any
difference between the two situations
Fuzzy logic reasoning
This refers to reasoning with uncertainty by using vaguely
defined (fuzzy) predicates and rules.
It is a form reasoning that is approximate rather than
precise.
The method assumes that it is difficult to
Predict accuracy of a rule with a 100%
Certainty.
Fuzzy logic reasoning
Uncertainty can be represented using the
Following elements:
1. Numeric values e.g 8/10,80%
Example:
If a person coughing, with a whizzing sound during cold
weather, then it is 80% certain that he has asthma.
Fuzzy logic reasoning
2.Likert scale.- scale in which respondents indicate their level
of agreement with statements that express a favourable or
unfavourable attitude toward a concept being measured.
Examples :
Strongly unfavourable to the concept
somewhat unfavourable to the concept
undecided
Somewhat favourable to the concept
Strongly favourable to the concept
Fuzzy logic reasoning example
Estimate inflation in Kenya in 2011 is most likely (very
likely, unlikely) to be high
Fuzzy logic reasoning example
For example, an extremely simple temperature
regulator that uses a fan might look like this:
IF temperature IS very cold THEN stop fan
IF temperature IS cold THEN turn down fan
IF temperature IS normal THEN maintain level
IF temperature IS hot THEN speed up fan