1. Course Code: IS 463
Course Title:
Knowledge Base Systems Application
PART : 3
Prof. Taymoor Mohamed Nazmy
Dept. of computer science, faculty of computer science, Ain Shams uni.
Ex-vice dean of post graduate studies and research Cairo, Egypt
2. Semantic nets
It is a graphical method to represent the knowledge. The semantic net
originally developed to represent the meaning of English words.
A semantic net is really just a graph, where the nodes in the graph represent
concepts, and the arcs (or links) represent binary relationships between
concepts.
The most important relations between concepts are subclass relations
between classes and subclasses, and instance relations between
particular objects and their parent class.
However, any other relations are allowed, such as has-part, is-a, colour, etc.
So, to represent some knowledge about animals (as AI people so often do)
we might have the following network:
4. 4
Nodes and Arcs
• Arcs define binary relationships that hold
between objects denoted by the nodes.
john 5Sue
age
mother
mother(john,sue)
age(john,5)
wife(sue,max)
age(max,34)
...
34
age
father
Max
age
5. 5
Semantic Networks
• The ISA (is-a) or AKO (a-
kind-of) relation is often
used to link instances to
classes, classes to
superclasses
• Some links (e.g. hasPart)
are inherited along ISA
paths.
• The semantics of a
semantic net can be
relatively informal or
very formal
– often defined at the
implementation level
isa
isa
isaisa
Robin
Bird
Animal
RedRusty
hasPart
Wing
6. Nodes for words
Directed links for relations/associations between words
Each link has its own meaning
You know the meaning (semantics) of a word if you know the
meaning of all nodes that are used to define the word and the
meaning of the links connecting them
Otherwise, follow the links to the definitions of related words
airplane
machine
move cargo move people pilot
fly
is a
can do
operated by
used for
used for
Boeing 747
is a
pilot
7. Semantic Networks
Concentrate on categories of objects and the relations
between them
BIRTHDAY-PARTY
JOHN’S-B-P
AUGUST-3
MARY JOHN’S-B-P
CAKE
ELEMENT-OF
date
guest place
food
8. Example
give
pick up
have a meeting
before
after
after
morning lunch
at the time
who?
John
who?
who?
what?
report
to whom?
me
whos?
his
John must pick up his report in the morning and have
a meeting after lunch. After the meeting he will give the report to me.
9. Semantic Networks - An example
IS - A Hierarchy
Living Thing
Animal Plant
Tree Bush
Pine
LivestockPet
CowCatDog
German
Shepherd
Bull
dog
is ais a
is a
is a
is a
is a
is a is a
is a is a
is ais a
10. 10
Individuals and Classes
• Many semantic
networks distinguish
–nodes representing
individuals and those
representing classes
–the “subclass”
relation from the
“instance-of” relation
subclass
subclass
instanceinstance
Robin
Bird
Animal
RedRusty
hasPart
Wing
instance
Genus
11. 11
From Semantic Nets to Frames
• A frame has a set of slots.
• A slot represents a relation to another frame
(or value).
• A slot has one or more facets.
• A facet represents some aspect of the relation.
12. Frames
Frames: a knowledge representation technique which
attempts to organize concepts into a form which exploits
interrelatioships and common beliefs
frame-based KR is analogous to Object-oriented
programming; the difference is the entities encoded
(knowledge vs computation information)
A frame is similar to a record data structure or database
record:
Frame has slot names and slot fillers, and usually arranged
in a hierarchy .
16. Frames
(frame) instance: frame representing” lowest-
level” object; a single object or entity
(frame) class: a frame that describes different
frames (either instances or classes)
every instance has an “is-a” link, pointing to its
class
possibly more than one “is-a”
17. Frames – Example
Panda
Type: Animal
Colour: Black and white
Food:
EatFunc: ……..
Name:
Height:
Age: 0
Sibling
Bamboo
Type: Plant
GrowFunc: ……..
Location:
Height: 2
Jenny
Name: Jenny
Height: 1.6
Age: 5
Sibling:
Vicky
Name: Vicky
Height: 0.7
Age: 1
Sibling:
18. Frames – Example
Panda
Type: Animal
Colour: Black and white
Food:
EatFunc: ……..
Name:
Height:
Age: 0
Sibling
Bamboo
Type: Plant
GrowFunc: ……..
Location:
Height: 2
Jenny
Name: Jenny
Height: 1.6
Age: 5
Sibling:
Vicky
Name: Vicky
Height: 0.7
Age: 1
Sibling:
20. Human Experts Behaviors
• Recognize and formulating the problem
• Solve problems quickly and properly
• Explain the solution
• Learn from experience
• Restructure knowledge
• Break rules
• Determine relevance
Expert Systems are not
necessarily used to
replace human experts.
They can be used to make
their knowledge and
experience more widely
available (e.g., allowing
non experts to work
better).
21. Expert System
• An expert system is a system that employs
human knowledge captured in a computer to
solve problems that ordinarily require human
expertise.(Turban)
• A computer program that emulates the
behaviour of human experts who are solving
real-world problems associated with a
particular domain of knowledge. (Pigford &
Braur)
22. 22
Early Expert Systems
• DENDRAL – used in chemical mass
spectroscopy to identify chemical constituents
• MYCIN – medical diagnosis of illness
• DIPMETER – geological data analysis for oil
• PROSPECTOR – geological data analysis for
minerals
• XCON/R1 – configuring computer systems
23. Example of an expert system:
Mycin
Goal: Help non-expert physicians to treat blood infections
1972: Collaboration of Stanford Medical & AI
Purpose: to assist a physician, who was not an expert in the field of
antibiotics, with the diagnosis & treatment of blood disorders (and
in particular to establish whether the patient was suffering from a
serious infection like meningitis).
Input: symptoms & test results
Output: a diagnosis, accompanied by a degree of certainty, &
recommended therapy
Therapy selection:
Significant Infection?
Determine possible organism(s) involved
Select set of appropriate drugs
Select most appropriate drug or drug combination
24. Types of Expert Systems
Rule-based Systems
Knowledge represented by series of rules
Frame-based Systems
Knowledge represented by frames
Hybrid Systems
Expert systems that represent domain knowledge using
production rules. Two type of Rule based systems:
Forward chaining Systems
Backward chaining systems
25. Interpretation
Prediction
Diagnosis
Control
Monitoring
Planning
Design
Debugging and Repair
Instruction
Expert Systems – Tasks
ANALYSIS
SYNTHESIS
26. A classification of expert system tasks
The following is a classification of expert systems, in terms of the kinds of task that
they have been designed to perform.
Diagnosis. The process of finding faults in a system, or diseases in a living system.
example: MYCIN - diagnosed blood infection. Shortliffe, 1976.
Interpretation. The analysis of data, to determine their meaning.
example: PROSPECTOR - interpreted geological data as potential evidence
for mineral deposits. Duda, Hart, et al 1976.
Monitoring. The continuous interpretation of signals from a system, so that a diagnosis
or an alarm can be given when required.
example: NAVEX - monitored radar data and estimated the velocity and
position of the space shuttle. Marsh, 1984.
Design. The production of specifications from which systems, satisfying particular
requirements, can be made.
example: R1/XCON - configured VAX computer systems on the basis of
customers' needs. McDermott, 1980.
27. A classification of expert system tasks
Planning. The production of a sequence of actions that will achieve a particular
goal.
example: MOLGEN - planned chemical processes whose purpose was to
analyse and synthesise DNA. Stefik, 1981.
Instruction. Teaching a student a body of knowledge, varying the teaching
according to assessments it makes of the student's current knowledge. N.B. This
type of expert system is often called an intelligent tutoring system.
example: SOPHIE - instructed the student on the repair of an electronic
power-pack. Brown, Burton & de Kleer, 1982.
Prediction. Forecasting future events, using a model based on past events.
example: PLANT - predicted the damage to be expected when a corn crop
was invaded by black cutworm. Boulanger, 1983.
28. A classification of expert system tasks
Debugging & repair. Generating and, perhaps, administering remedies for system
faults.
example: COOKER ADVISER - provides repair advice with respect to
canned soup sterilising machines. Texas Instruments, 1986.
Control. Governing the behaviour of a system by anticipating problems, planning
solutions, and monitoring actions.
example: VENTILATOR MANAGEMENT ASSISTANT - scrutinised the
data from hospital breathing-support machines, and provided accounts of the
patients' conditions. Fagan, 1978.
today, expert systems are used extensively in finance, manufacturing, scheduling,
customer service, …
American Express uses an ES to automatically approve purchases
Mrs. Field's cookies uses an ES to model the founder's operational ideas
TaxCut uses an ES to give tax advice
Phoenix Police Dept uses an ES to help identify suspects
29. Distinctive features of expert systems
• Reasoning with uncertainty.
– Rules in the knowledge base may only express a
probability that a conclusion follows from certain
premises, rather than a certainty.
– This is particularly true of medicine and other life
sciences.
– The items in the knowledge base must reflect this
uncertainty, and the inference engine must process the
uncertainties to give conclusions that are accompanied
by a likelihood that they are true or correct.
30. Distinctive features of expert systems
• Time-varying data. In a monitoring task, the
situation evolves over time, and pieces of data
do not remain reliable.
31. Distinctive features of expert systems
• Noisy data. In any interpretation, diagnostic or
monitoring task, some of the data may be
missing, and some of it may be spurious. In
other words,
– items of data may be wrong and have appeared by
accident
– or correct items of data may have been missed out
by accident.
32. Inferencing
• Whereas one could describe a conventional
program (or at least, the part of it that produces
the results, as opposed to the user interface,
etc) in these terms:
Program = algorithm + data
one would have to describe an expert system in
these terms:
Expert system = inference engine +
knowledge base + data.
33. Inferencing
• The inference engine uses one of several
available forms of inferencing.
• By inferencing I mean the method used in a
knowledge-based system to process the
supplied data, and the stored knowledge, so as
to produce correct conclusions.
34. Forward and Backward Reasoning
forward reasoning
Facts are given. What is the conclusion?
A set of known facts is given; apply rules to derive new facts as
conclusions (forward chaining of rules) until you come up with
a requested final goal fact.
backward reasoning
Hypothesis (goal) is given. Is it supported by facts?
A hypothesis (goal fact) is given; try to derive it based on a set
of given initial facts using sub-goals (backward chaining of
rules) until goal is grounded in initial facts.
35. 1. study good_grade
2. not_study bad_grade
3. sun_shines go_out
4. go_out not_study
5. stay_home study
6. awful_weather stay_home
Example ‘Grades’
forward reasoning rule chain
given fact: awful_weather 6,5,1
backward reasoning
hypothesis/goal: good_grade 1,5,6
36. good grade
Example ‘Grades’ – Reasoning Tree
bad grade
not studystudy
go outstay home
sun shinesawful weather
37. Forward vs. Backward Chaining
Forward Chaining Backward Chaining
diagnosis construction
data-driven goal-driven (hypothesis)
bottom-up reasoning top-down reasoning
find possible conclusions
supported by given facts
find facts that support a
given hypothesis
antecedents (LHS) control
evaluation
consequents (RHS) control
evaluation
38. Meta-rules
• Meta-rules are rules which alter the reasoning
process: these can make a production system
more flexible.
– e.g. a rule which chooses a particular style of conflict-
resolution, on the basis of data in the working memory.
–
– Or a rule which switches from forward to backward
chaining at a suitable moment in the reasoning
process.
– Or a rule which "decides" to consider a certain type of
rule before other types.
39. Expert System components
1-Working Memory
A global database of facts used by the system
2-Knowledge Base
Contains the domain knowledge
3-Inference Engine
The brain of the Expert system. Makes logical
deductions based upon the knowledge in the
KB.
40. Expert System components
4-User Interface
A facility for the user to interact with the
Expert system.
5-Explanation Facility
Explains reasoning of the system to the user
6-Knowledge Acquisition Facility
An automatic way to acquire knowledge
42. Knowledge Acquisition
• Knowledge acquisition is the process by which
knowledge available in the world is transformed and
transferred into a representation that can be used by
an expert system. World knowledge can come from
many sources and be represented in many forms.
• Knowledge acquisition is a multifaceted problem that
encompasses many of the technical problems of
knowledge engineering, the enterprise of building
knowledge base systems.
44. Building the knowledge base
• Five processes can be identified:
• 1. Knowledge acquisition
• 2. Knowledge analysis & representation
• 3. Knowledge validation
• 4. Inference design
• 5. Explanation and justification
• These are not stages that have to follow each other -
some of them will run concurrently.
46. Classification of Technology Levels
• Specific expert systems
• Shells
• Support tools
• Hybrid Systems (environments)
• Programming languages
• NEW
– Object-oriented Programming (OOP)
– Internet/Web/Intranet-based Tools
47. Expert System Development Tools
• Language: Development time, convenience,
maintainability, efficiency and speed determine
what language software is written in.
• Tool: A language plus
– utility programs to facilitate development (debugging,
file management, code generators, text and graphics
editors, etc.)
– aids for knowledge acquisition, knowledge validation
and verification and construction of interfaces to other
software packages
48. Expert System Development Tools
• Hybrid Systems: consist of several support tools
and programming languages.
• Shell: A special purpose tool designed for certain
types of application in which the user must only
supply the knowledge base (EMYCIN).
49. Shells tool
• Developed via specialized software tools called
shells
• Shells come equipped with an inference
mechanism
– Backward chaining
– Forward chaining
– Both
• May or may not have learning components
• They are tested by being placed in the same real
world problem solving situation
• Key idea: problem solved by applying specific
knowledge rather than specific technique
50. Expert system shells
• A general expert system development product for the market
• An expert system shell has all components of an expert system -except
the knowledge-base
User
User
Interface:
- Menu-
driven
- GUI
- Natural
language
Knowledge-
base editor
Inference
engine
Explanation
sub-system
Knowledge-base
Working memory
51. 51
Expert system shells (cont’d)
• Good shells also provide facilities for communication with external
sources including
– Database management systems
– Spreadsheets
– Graphics packages.
• Shell selected must match reasoning process (goal driven or data driven)
characterising given problem domain
• Other features to be considered
– knowledge representation scheme and the knowledge base editor
– user interface
– explanation capabilities.
53. Classification of Tools
Rule Based Tools
• Rule-based tools use if-then rules to represent
knowledge.
• These rules are processed through a backward or
forward chaining process, or a combination of the
two (called bidirectional inference).
• Some tools permit the coding of inexact rules and
inexact inferencing, possibly using confidence factors
and processing methods found in the certainty theory,
54. CLIPS – Background
CLIPS – C Language Integrated Production
System
• Production System refers to Rule-Based
Systems
• Originally developed by NASA
• download, user’s manual, developer’s forum
etc. see CLIPS link on course web-page
• CLIPS is free, shareware; can even be used for
commercial applications
55. CLIPS – Programming Systems
CLIPS Editor
load, save and edit CLIPS program files
CLIPS Interpreter
enter commands, execute CLIPS programs
Execution-Menu
set execution parameters (e.g. watch)
Browse-Menu
manage constructs
56. CLIPS - Example
CLIPS> (load “file”) or use file-menu
CLIPS> (assert (today is Tuesday))
f-0 (today is Tuesday)
CLIPS> (retract 0) retract fact 0
CLIPS> (facts) display current facts
CLIPS> (reset) reset facts; re-run definitions
CLIPS> (clear) clear CLIPS Interpreter
(everything’s gone now)
57. Classification of Tools
Frame-based Tools
• Today's frame-based tools share many common points
with object-oriented programming.
• The advantage that these tools have over the base
language approach is that they enable the coding of
knowledge in a natural symbolic language style versus the
more rigid syntax of an object-oriented programming
language.
• Though rule-based tools dominated the 1980s, frame-
based ones are dramatically picking up steam during the
1990s
58. Classification of Tools
Fuzzy Logic Tools
• Fuzzy logic expert system tools represent knowledge
in fuzzy rules and fuzzy sets.
• They include statements that contain fuzzy variables
with corresponding fuzzy values that are represented
mathematically in a fuzzy set.
• It is most widely used in the area of control systems.
Common sense control rules are usually easy to
generate.
59. Classification of Tools
Induction Tools
• Induction tools generate rules from examples. They are
products of AI research in machine learning.
• A developer enters a large set of examples from the
domain under consideration, where each example contains
values for a set of domain features, and a single result
characterizing the example.
• The induction tool then uses an algorithm, such as ID3, to
generate a rule or a decision tree.
• In operation, a user enters information about a current
problem and the system then determines the probable
result.
60. Classification of Tools
Case Based reasoning Tools (CBR)
• In practice, they serve a role similar to induction tools in
that they use past experiences (cases) to solve current
problems.
• Given an input specification of a problem, the system will
search its case memory for an existing case that matches
the input specification. It may find an exact match and
immediately go to a solution.
• Even if an exact match can't be found, the system applies
a matching algorithm in order to find a case that is most
similar to the input specification.
62. 1. Case-Based Reasoning definition
• Case-Based reasoning (CBR), broadly construed,
is the process of solving new problems
based on the solutions of similar past problems.
• CBR is reasoning by remembering:
It is a starting point for new reasoning
• Case-Based Reasoning is a well established research field
that involves the investigation of theoretical foundations,
system development and practical application building of
experience-based problem solving.
63. • An auto mechanic who fixes an engine by recalling another car that
exhibited similar symptoms
• A lawyer who advocates a particular outcome in a trial based on
legal precedents or a judge who creates case law.
• An engineer copying working elements of nature (practicing
biomimicry), is treating nature as a database of solutions to
problems.
• Case-based reasoning is a prominent kind of analogy making.
1. Case-Based Reasoning definition
Everyday examples of CBR :
64. 1. Case – previously made and stored experience item
2. CBR problem solver
2. Case-Base – core of every case – based problem solver
- collection of cases
65. • One of the core assumptions behind CBR is that
similar problems have similar solutions.
• A case-based problem solver solves new problems primarily
by reuse of solutions from the cases in the case-base.
• For this purpose, one or several relevant cases are selected.
2. CBR problem solver
66. • Once similar cases are selected,
the solution(s) from the case(s) are adapted
to become a solution of the current problem.
2. CBR problem solver
• When a new (successful) solution to the new problem is
found,
a new experience is made,
which can be stored in the case-base to increase its
competence,
thus implementing a learning behavior.
67. 1. Structural (a common structured vocabulary, i.e. an ontology)
2. Textual (cases are represented as free text, i.e. strings)
3. Conversational
(a case is represented through a list of questions that varies from one
case to another ; knowledge is contained in customer / agent
conversations)
3. Types of CBR
There are three main types of CBR that differ significantly
from one another concerning case representation and
reasoning:
68. 4. CBR Cycle
• Despite the many different appearances of CBR
systems,
the essentials of CBR are captured in a surprisingly
simple and uniform process model.
• The CBR cycle consists of 4 sequential steps around the
knowledge of the CBR system.
• The CBR cycle is proposed by Aamodt and Plaza.
69. 9 / 25
4. CBR Cycle
New Case
Retrieved Case
New Case
Solved Case
Tested /
Repaired
Case
Learned
Case
General Knowledge
Previous
Cases
Problem
Suggested
Solution
Confirmed
Solution
RETRIEVE
REUSE
REVISE
RETAIN
70. What is case-based reasoning?
An approach to building KBS which is radically
different to the rule-based and other knowledge-
representation approaches we have seen so far.
The principle is to find a solution which has been
shown to solve problems like your current problem in
the past, and adapt it so that it solves the current
problem.
70
71. How a CBR system works:
the knowledgebase
• The knowledge base contains a collection of
representative cases, with their
– symptoms,
– causes,
– and treatments.
• The user is instructed to provide the (relevant)
features of the current case.
• The similarity between this set of features, and
the features characteristic of each of the stored
cases is calculated, and the best match is chosen.
71
72. How a CBR system works:
the process
Case 1 Case 2 Case 3 Case 4 Case 5
1 3 4 7 5 2 1 3 5 7 5 3 1 3 4 7 4 4 2 8 4 7 4 3 1 4 4 7 0 2
Current
Case
2 8 4 7 4 2
72
73. How a CBR system works:
the process
Case 1 Case 2 Case 3 Case 4 Case 5
1 3 4 7 5 2 1 3 5 7 5 3 1 3 4 7 4 4 2 8 4 7 4 3 1 4 4 7 0 2
Current
Case
2 8 4 7 4 2
73
74. How a CBR system works:
the process
Case 1 Case 2 Case 3 Case 4 Case 5
1 3 4 7 5 2 1 3 5 7 5 3 1 3 4 7 4 4 2 8 4 7 4 3 1 4 4 7 0 2
Current
Case
2 8 4 7 4 2
74
75. How a CBR system works:
the process
• The features which have been identified as important
in the stored cases, and which the user is asked about,
are known as “indices”.
• Each has a value. In the example I just showed you,
each was represented by a number.
• If necessary, this case is adapted so that it is a better
match for the current circumstances.
• The case is then presented as the solution, with the
opportunity to examine the 'precedent' case.
75
76. How a CBR system works
• The sequence of operations, for a
“full-blown” CBR system:
1) assign indices
2) retrieve a similar case
3) modify the past case
4) test the case
5a) assign indices to this new case,
and store as a working solution
OR
5b) explain failure, repair the solution,
and test again.
76
77. Flow chart for a full-blown CBR system
1. Assign indices
2. Retrieve
3. Modify
4. Test
6a. Explain
Repair rules
5b. Store
5a. Assign indices
Case memory
Similarity
metrics
Modification
rules
Indexing rules
6b. Repair
Input
Working
solution
Failed
solution
78. Available techniques for
case memory organisation
• Memory organisation by:
linear ("flat") case memory
case hierarchy
nested cases
decision-tree orientated memory
knowledge-guided indexing
78
79. Available techniques for
case retrieval
• Retrieval by:
Nearest neighbour case matching
Weighted nearest neighbour case matching
Decision tree methods
Knowledge-guided retrieval
79
80. Advantages of CBR
• Case-based reasoning:
tends to focus on the problem's essential
features.
can solve problems in domains that are only
partially understood.
can provide solutions when no algorithmic
method is available.
can interpret open-ended and ill-defined
concepts.
80
81. Steps in building a case-based
reasoning system
1. Obtain data for cases.
2. Design cases based on data.
3. Determine the case memory structure.
4. Decide the case retrieval method.
5. Decide whether a case adaptation procedure is
appropriate (and, if so, implement it).
6. Develop the rest of the system (e.g. the user
interface).
81
82. 82
The PROTOS system
Protos is a case-based problem solving and learning system for
heuristic classification tasks.
The main features of the system will be presented in the context of
a task for the classification of hearing disorders.
In Protos, a concept ci is represented extensionally as a collection
of examples (called exemplars or cases):
ci = {ei1, ei2, ...}.
Classifying an input NewCase involves searching for a concept
exemplar ejk that strongly matches NewCase. If such an exemplar
is found then Protos asserts that NewCase belongs to the concept
cj (the concept whose exemplar is ejk).
83. 83
The classification and learning algorithm
Input: a set of exemplar-based categories C = {c1, c2, ... , cn} and a
case (NewCase) to classify.
REPEAT
Classify:
Find an exemplar of ci C that strongly matches NewCase and
classify NewCase as ci.
Explain the classification.
Learn:
If the expert disagrees with the classification or explanation then
acquire classification and explanation knowledge and adjust C
so that NewCase is correctly classified and explained.
UNTIL the expert approves the classification and explanation.
84. 84
The PROTOS system: explaining a classification
C is the set of all concepts recognized by the system, each concept
being represented extensionally as a set of representative exemplars.
How could one explain the classification of a case to a concept?
Explaining the classification involves showing the line of reasoning
used during matching.
Which would be a simple type of explanation?
85. 85
Explaining a classification (cont.)
The simplest explanation is a list of the matched features of the
case and the exemplar.
Which would be a simple type of explanation?
A more detailed explanation may include justifications of the flexible
matches performed as, for instance, in the case of classifying chairs:
'pedestal' was matched with 'legs(4)'
because both are specializations of seat support"
or
'seat' was matched with 'backrest'
because seat enables 'hold(person)' and
backrest enables 'hold(person)'
Which would be a more detailed explanation?
86. 86
The PROTOS system: learning
How could it learn?
When would a CBR system like PROTOS need to learn?
When it makes mistakes.
What kind of mistakes could PROTOS make?
Errors of classification and errors of explanation.
87. 87
The PROTOS system: learning
Add the case to the correct category as a new exemplar.
How could it learn?
Adjust the categories so that the case will be properly classified and
explained.
Which is a simple way to assure that the case will be correctly
classified in the future?
89. 89
Signs of Intelligence
Learn or understand from experience
Make sense out of ambiguous or
contradictory messages
Respond quickly and successfully to new
situations
Use reasoning to solve problems
90. Reasoning Methods 1
deduction
◆ conclusions must follow from their premises; prototype of logical reasoning
induction
◆ inference from specific cases (examples) to the general
abduction
◆ reasoning from a true conclusion to premises that may have caused the conclusion
resolution
◆ find two clauses with complementary literals, and combine them
generate and test
◆ a tentative solution is generated and tested for validity
◆ often used for efficiency (trial and error)
9
0
91. Reasoning Methods 2
default reasoning
◆ general or common knowledge is assumed in the absence of specific
knowledge
analogy
◆ a conclusion is drawn based on similarities to another situation
heuristics
◆ rules of thumb based on experience
intuition
◆ typically human reasoning method
nonmonotonic reasoning
◆ new evidence may invalidate previous knowledge
auto epistemic
◆ reasoning about your own knowledge
9
1
92. Precondition ==Rule==> Conclusion
Deduction – determine the conclusion
Induction – determine the rule
Abduction – determine the precondition
”Abduction is the source of all human knowledge”
Logical Reasoning
93. 93
Abduction
• Abduction is a reasoning process that tries to form
plausible explanations for abnormal observations
– Abduction is distinctly different from deduction and induction
– Abduction is inherently uncertain
• Uncertainty is an important issue in abductive
reasoning Some major formalisms for representing
and reasoning about uncertainty
– Mycin’s certainty factors (an early representative)
– Probability theory (esp. Bayesian belief networks)
– Dempster-Shafer theory
– Fuzzy logic
– Truth maintenance systems
– Nonmonotonic reasoning
94. 94
Abduction
• Definition (Encyclopedia Britannica):
reasoning that derives an explanatory
hypothesis from a given set of facts
– The inference result is a hypothesis that, if true, could
explain the occurrence of the given facts
• Examples
– Dendral, an expert system to construct 3D structure of
chemical compounds
• Fact: mass spectrometer data of the compound and its
chemical formula
• KB: chemistry, esp. strength of different types of bounds
• Reasoning: form a hypothetical 3D structure that satisfies
the chemical formula, and that would most likely produce
the given mass spectrum
95. 95
– Medical diagnosis
• Facts: symptoms, lab test results, and other observed
findings (called manifestations)
• KB: causal associations between diseases and
manifestations
• Reasoning: one or more diseases whose presence would
causally explain the occurrence of the given manifestations
– Many other reasoning processes (e.g., word sense
disambiguation in natural language process, image
understanding, criminal investigation) can also been seen
as abductive reasoning
Abduction examples (cont.)
96. 96
Comparing abduction, deduction,
and induction
Deduction: major premise: All balls in the box are black
minor premise: These balls are from the box
conclusion: These balls are black
Abduction: rule: All balls in the box are black
observation: These balls are black
explanation: These balls are from the box
Induction: case: These balls are from the box
observation: These balls are black
hypothesized rule: All ball in the box are black
A => B
A
---------
B
A => B
B
-------------
Possibly A
Whenever
A then B
-------------
Possibly
A => B
Deduction reasons from causes to effects
Abduction reasons from effects to causes
Induction reasons from specific cases to general rules
97. 97
Characteristics of abductive
reasoning
• “Conclusions” are hypotheses, not theorems (may be
false even if rules and facts are true)
– E.g., misdiagnosis in medicine
• There may be multiple plausible hypotheses
– Given rules A => B and C => B, and fact B, both A and C
are plausible hypotheses
– Abduction is inherently uncertain
– Hypotheses can be ranked by their plausibility (if it can be
determined)
98. 98
Characteristics of abductive reasoning
(cont.)
• Reasoning is often a hypothesize-and-test cycle
– Hypothesize: Postulate possible hypotheses, any
of which would explain the given facts (or at least
most of the important facts)
– Test: Test the plausibility of all or some of these
hypotheses
– One way to test a hypothesis H is to ask whether
something that is currently unknown–but can be
predicted from H–is actually true
• If we also know A => D and C => E, then ask if D and E are true
• If D is true and E is false, then hypothesis A becomes more plausible
(support for A is increased; support for C is decreased)
99. 99
Characteristics of abductive reasoning
(cont.)
• Reasoning is non-monotonic
– That is, the plausibility of hypotheses can increase/decrease
as new facts are collected
– In contrast, deductive inference is monotonic: it never
change a sentence’s truth value, once known
– In abductive (and inductive) reasoning, some hypotheses
may be discarded, and new ones formed, when new
observations are made
100. 100
Sources of uncertainty
• Uncertain inputs
– Missing data
– Noisy data
• Uncertain knowledge
– Multiple causes lead to multiple effects
– Incomplete enumeration of conditions or effects
– Incomplete knowledge of causality in the domain
– Probabilistic/stochastic effects
• Uncertain outputs
– Abduction and induction are inherently uncertain
– Default reasoning, even in deductive fashion, is uncertain
– Incomplete deductive inference may be uncertain
Probabilistic reasoning only gives probabilistic results
(summarizes uncertainty from various sources)
101. 101
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)
102. Deductive database
• A deductive database is a database system that can make deductions (i.e.,
conclude additional facts) based on rules and facts stored in the (deductive)
database.
• Datalog is a purely declarative programming language derived from Prolog. It
is used in many fields that require logic programming including networking,
cloud computing, deductive database design, information extraction, and
program analysis.
• Datalog is usually implemented in, or interpreted using, other programming
languages. Open source Datalog implementations exist for Java, C++, Lua,
Python, Prolog, Clojure, and Racket, and commercial Datalog
implementations are also available.
• Datalog is the language typically used to specify facts, rules and queries in
deductive databases.
103. • A deductive database is a database system that
can make conclusions about its data based on a set
of well-defined rules and facts. This type of
database was developed to combine logic
programming with relational database
management systems.
• Usually, the language used to define the rules and
facts is the logical programming language
Datalog.
104. Deductive databases and logic
programming
• Deductive databases reuse a large number of concepts from logic
programming; rules and facts specified in the deductive database
language Datalog look very similar to those in Prolog. However
important differences between deductive databases and logic
programming:
• Order sensitivity and procedurality: In Prolog, program execution
depends on the order of rules in the program and on the order of parts
of rules; these properties are used by programmers to build efficient
programs.
• In database languages (like SQL or Datalog), however, program
execution is independent of the order of rules and facts.
•
105. • Special predicates: In Prolog, programmers can directly
influence the procedural evaluation of the program with
special predicates such as the cut, this has no
correspondence in deductive databases.
• Function symbols: Logic Programming languages
allow function symbols to build up complex symbols.
This is not allowed in deductive databases.
• Tuple-oriented processing: Deductive databases use set-
oriented processing while logic programming
languages concentrate on one tuple at a time.
106. Datalog language
• Datalog is a declarative logic programming language that
syntactically is a subset of Prolog. It is often used as a query
language for deductive databases.
• In recent years, Datalog has found new application in data
integration, information extraction, networking, program
analysis, security, and cloud computing
107. The Deductive Databases
Some query languages for the relational model resemble a
logic more than they do the algebra that we introduced
earlier.
The logic-based languages appear to be difficult for many
programmers to grasp.
We will discuss Deductive Databases , which is the
intersection of databases, logic, and artificial intelligence
or knowledge bases.
108. Deductive Databases
A deductive database system is a database system
that includes capabilities to define (deductive) rules,
which can deduce or infer additional information
from the facts that are stored in a database.
Because part of the theoretical foundation for some
deductive database systems is mathematical logic,
such rules are often referred to as logical databases.
110. Deductive Databases
In a deductive database system, we typically specify
rules through a declarative language - a language in
which we specify what to achieve rather than how to
achieve it.
An inference engine ( or deduction mechanism)
within the system can deduce new facts from the
database by interpreting these rules.
The model for deductive databases is closely related
to the relational data model, and particularly to the
domain relational calculus formalism.
111. Deductive Databases
Deductive Database is also related to the field of logic
programming and the Prolog language.
The deductive database work based on logic has used
Prolog (Programming in Logic) as a starting point.
A variation of Prolog called Datalog is used to define
rules declaratively in conjunction with an existing set of
relations, which are themselves treated as literals in the
language.
The basic constructs of logic programming: terms,
statements
113. Deductive Databases
Fact Example:
father ( abraham, isaac).
==> Abraham is the father of Isaac, or that the
relation father holds between the
individuals named abraham and isaac.
Another name for relationship is predicate.
114. Deductive Databases
Names of individuals are know as atoms.
Similarly plus (2,3,5) ==> expresses the relationship
that 2 plus 3 is 5.
plus is a predicate!
The familiar plus relationship can be realized via a set
of facts that defines the addition table.
115. Deductive Databases
An initial segment of the addition table is:
plus(0,0,0). plus(0,1,1). plus (0,2,2). plus(0,3,3).
plus(1,0,1). plus(1,1,2). plus(1,2,3). plus (1,3,4).
Notice the period after each sentence.
The table above is a segment of the definition of plus!
116. Deductive Databases
Syntactic conventions for logic programming:
1) case convention
Names of both predicates and atoms in facts
begin with a lowercase letter (italicized when
they appear in running text).
2) program
A finite set of facts constitutes a program.
This is the simplest form of a logic program.
117. Deductive Databases
Syntactic conventions for logic programming:
2) program (continued)
A set of facts is also a description of a situation.
This insight is the basis of database
programming !
118. Deductive Databases
father(terach, abraham). male(terach).
mother( sarah, isaac). female(yiscah).
The predicates father, mother, male, female express
the obvious relationships.
119. Deductive Databases
A second form of statement in a logic program is a
query.
Queries are a means of retrieving information from a
logic program.
A query asks whether a certain relation holds
between objects.
121. Deductive Databases
father (abraham, isaac)?
Given the facts presented earlier the
answer to this query is YES!
Note: statement of fact or question
122. Course Code: IS 463
Course Title:
Knowledge Base Systems Application
PART : 4
Prof. Taymoor Mohamed Nazmy
Dept. of computer science, faculty of computer science, Ain Shams uni.
Ex-vice dean of post graduate studies and research Cairo, Egypt
125. 125
Query Processing Components
• Query language that is used
– SQL (Structured Query Language)
• Query execution methodology
– The steps that the system goes through in
executing high-level (declarative) user queries
• Query optimization
– How to determine the “best” execution plan?
126. Query Processing and Optimization
• 1. What do you mean by query processing? What
are the various steps involved in query processing?
Explain with the help of a block diagram.
• Ans: Query processing includes translation of high-
level queries into low-level expressions that can be
used at the physical level of the file system, query
optimization and actual execution of the query to get
the result. It is a three-step process that consists of
parsing and translation, optimization and execution of
the query submitted by the user These steps are
127.
128.
129. Example
• Consider a lit of employee with number and name, and a
list of projects with project number in which employee is
assigned, the role of employee in the project, and the
duration of the project in months.
• Find the list of all employees who are working in project
which is more than 10 month old.
• SELECT Ename
• FROM Employee, Proj_Assigned
• WHERE Employee.Eno=Proj_Assigned.Eno AND DOP<10;