Date post: | 03-Jan-2016 |
Category: |
Documents |
Upload: | irma-nieves |
View: | 30 times |
Download: | 5 times |
Artificial Intelligence
CIS 342
The College of Saint RoseDavid Goldschmidt, Ph.D.
I, RobotI, Robot by Isaac Asimov
What do we learn about robots?– Can “see” as humans do (computer vision)– Can walk and traverse around objects– Use intuition; are skeptical– Rely on reason– Are able to explain reasoning– Are curious as to one’s own existence– Are introspective
I, RobotI, Robot by Isaac Asimov
Is any of the AI in I, Robot realistic?– Computer vision– Robotics (boundary detection, learning)– Knowledge-based reasoning
Computer reasons and explains how aconclusion has been reached
– Expert systems Computer explains how a diagnosis
has been determined
Expert Systems
An expert system performs at a human expert level in a narrow and specialized domain– Often a tradeoff between accuracy and speed
Use symbolic reasoning to solve problems– Symbols represent facts and rules (i.e.
knowledge)– Symbols are usually human-readable as
opposed to cryptic variable names, etc.
Expert Systems
Expert systems apply heuristics to guidethe reasoning process– This reduces the search space and time
required toproduce one or more solutions
– The goal is not always tosolve the problem exactly;often just to identifyone or more good solutions
Expert Systems
Expert systems provide explanation facilities to display reasoning (e.g. applied rules) to users– How did you come to that conclusion or
diagnosis?
Expert systems make mistakes– So do human experts!– Users have to be aware
of this possibility
By Comparison....
Traditional programs
Human experts Expert systems
Process data and use algorithms to solve general numerical problems
Use knowledge in the form of “rules of thumb” or heuristics to solve problems in a narrow domain
Process knowledge expressed in the form of rules and use symbolic reasoning to solve problems in a narrow domain
By Comparison....
Traditional programs
Human experts Expert systems
Do not separate knowledge from the control structures and code used to process such knowledge
Have human brains; how does knowledge exist in the brain?
Provide a clear separation of knowledge and knowledge processing (reasoning)
By Comparison....
Traditional programs
Human experts Expert systems
Do not explain how particular results are obtained and why input data is needed
Are usually capable of explaining their line of reasoning and providing relevant details
Trace the rules fired during a problem-solving session; explain how a particular conclusion was reached and why specific input data was needed
By Comparison....
Traditional programs
Human experts Expert systems
Work only on problems where data is complete and exact
Use inexact reasoning and can deal with incomplete, uncertain, and fuzzy information
Permit inexact reasoning and can deal with incomplete, uncertain, and fuzzy information
By Comparison....
Traditional programs
Human experts Expert systems
Provide no solution at all (or an incorrect solution) when data is incomplete or fuzzy
Can make mistakes when information is incomplete of fuzzy
Can often deal with incomplete or fuzzy information; however, can also make mistakes
By Comparison....
Traditional programs
Human experts Expert systems
Enhance the quality of problem solving by changing the program code, which affects both the knowledge and its processing
Enhance the quality of problem solving via years of learning and personal training
Enhance the quality of problem solving by adding new rules or adjusting existing rules in a knowledge base
Knowledge
Knowledge is a theoretical or practical understanding of a subject or a domain– Those who possess knowledge are
called experts (or domain experts)– Experts have deep knowledge of facts, rules,
heuristics, etc.
In-Class Exercise
– Using your favorite programming language, create anexpert system to interactively ask users yes/no questions and diagnose one of the following health problems:
Cold and Flu Headaches Shoulder Problems Tooth Problems
– i.e. implement an expert system using charts from http://familydoctor.org/symptom.xml
Medical Diagnostics
from Every Patient Tells a Storyby Lisa Sanders, M.D.
ISBN 0767922476
Attempts to build expert systems formedical diagnosis go back to the mid-1970s– Peter Szolovits (Professor of Computer
Science at MIT)– Began his quest in 1976 (Caltech)– “We thought we could identify all of
the best practices in medicine, create a system that would make diagnosis faster and easier, and bring it all to doctors via a computer.”
Medical Diagnostics
from Every Patient Tells a Storyby Lisa Sanders, M.D.
ISBN 0767922476
“It’s simply not possible.”
“The emphasis and attention has shifted towardbringing below-average doctors up to current
standardsand helping even good doctors avoid doing
really stupid things.That turns out to provide greater benefits to
patients.”
DXplain
from Every Patient Tells a Storyby Lisa Sanders, M.D.
ISBN 0767922476
DXplain first launched in 1986– Users enter clinical information, then ask
DXplain to provide diagnostic decision support
– DXplain knowledge base (KB) covers ~2400 diseasesand over 5000 clinical findings (signs, symptoms, epidemiologic data, laboratory findings, etc.)
– Demo: http://dxplain.mgh.harvard.edu/dxp/dxp.sdemo.pl
– Info: http://lcs.mgh.harvard.edu/projects/dxplain.html
GIDEON
from Every Patient Tells a Storyby Lisa Sanders, M.D.
ISBN 0767922476
Global Infectious Disease and Epidemiology Network– Online application that supports the
diagnosis and treatment of infectious diseases
– Organized by country of origin– Updated weekly!– Info: http://www.gideononline.com/
Isabel
from Every Patient Tells a Storyby Lisa Sanders, M.D.
ISBN 0767922476
Second-generation diagnostic supportsystem with improved user interface– Freeform text entry– Modern search techniques
for text-based matching
– Info: http://www.isabelhealthcare.com/home/
Facts and Rules
A fact may be thought of as a unit of knowledge
A rule enables an artificially intelligent system to derive new facts from existing facts– Rules typically take the form of IF-THEN
statements– IF is the antecedent, premise, or condition– THEN is the consequent, conclusion, or action
Categories of Rules
Relation:IF the ‘fuel gauge’ is emptyTHEN the car is dead
Categories of Rules
Recommendation:IF the forecast is rainAND the sky is cloudyTHEN the advice is ‘bring your
umbrella’
Categories of Rules
Directive:IF the car is deadAND the ‘fuel gauge’ is emptyTHEN the action is ‘refuel the car’
Categories of Rules
Strategy:IF the car is deadTHEN the action is ‘check the fuel
gauge’;step 1 is complete
IF step 1 is completeAND the car is deadTHEN the action is ‘check the battery’;
step 2 is complete
Categories of Rules
Heuristic:IF the spill is liquidAND the ‘spill pH’ < 6AND the ‘spill smell’ is vinegarTHEN the ‘spill material’ is ‘acetic
acid’
Development Team
Expert System
End-user
Knowledge Engineer ProgrammerDomain Expert
Project Manager
Expert SystemDevelopment Team
Rule-Based Expert System
Newell and Simon, CMU (1970s)
Conclusion
REASONING
Long-term Memory
ProductionRule
Short-term Memory
Fact
Rule-Based Expert System
Inference Engine
Knowledge Base
Rule: IF-THEN
Database
Fact
Explanation Facilities
User Interface
User
Rule-Based Expert System
User
ExternalDatabase External Program
Inference Engine
Knowledge Base
Rule: IF-THEN
Database
Fact
Explanation Facilities
User Interface DeveloperInterface
Expert System
Expert
Knowledge Engineer
Inference Engine
New facts are discovered by anexpert system’s inference engine– The process is called inference – New facts are inferred – Facts serve as data within the knowledge
base– Rules (IF-THEN) describe how new data is
inferred
Inference Engine
Inference engine algorithm:– Inference engine compares each rule
with facts it already “knows” about,matching the antecedent (IF condition)
– When the antecedent matches one ormore known facts, the rule fires andits consequent (THEN) is executed
Inference Engine
Knowledge Base
Database
Fact: A is x
Match Fire
Fact: B is y
Rule: IF A is x THEN B is y
1
2 3
4
Inference Chain
An inference chain indicates how an expert system applies rules to reach a conclusionRule1: IF Y is true
AND D is trueTHEN Z is true
Rule2: IF X is trueAND B is trueAND E is trueTHEN Y is true
Rule3: IF A is trueTHEN X is true
A X
B
E
Y
D
Z
given: A, B, D, E
Inference Chain
An inference chain indicates how an expert system applies rules to reach a conclusionRule1: IF Y is true
AND D is trueTHEN Z is true
Rule2: IF X is trueAND B is trueAND E is trueTHEN Y is true
Rule3: IF A is trueTHEN X is true
A X
B
E
Y
D
Z
given: A, B, D, E
Inference Chain
An inference chain indicates how an expert system applies rules to reach a conclusionRule1: IF Y is true
AND D is trueTHEN Z is true
Rule2: IF X is trueAND B is trueAND E is trueTHEN Y is true
Rule3: IF A is trueTHEN X is true
A X
B
E
Y
D
Z
given: A, B, D, E
Forward Chaining
Forward chaining applies rules to knowndata to achieve a desired goal– Also called data-driven reasoning– At each iteration, topmost rule is executed– When fired, a rule adds a new fact
to the database– This match-fire cycle stops when the goal
has been found or when no other rulescan be fired
Match Fire Match Fire Match Fire Match Fire
Knowledge Base
Database
A C E
X
Database
A C E
L
Database
A D
YL
B
X
Database
A D
ZY
B
LX
Cycle 1 Cycle 2 Cycle 3
X & B & E
ZY & D
LC
L & M
A X
N
X & B & E
ZY & D
LC
L & M
A X
N
X & B & E
ZY & D
LC
L & M
A X
N
X & B & E
ZY & D
LC
L & M
A X
N
Knowledge Base Knowledge Base Knowledge Base
X
C E C EB D B D
Y Y Y Y
Forward Chaining
Match Fire Match Fire Match Fire Match Fire
Knowledge Base
Database
A C E
X
Database
A C E
L
Database
A D
YL
B
X
Database
A D
ZY
B
LX
Cycle 1 Cycle 2 Cycle 3
X & B & E
ZY & D
LC
L & M
A X
N
X & B & E
ZY & D
LC
L & M
A X
N
X & B & E
ZY & D
LC
L & M
A X
N
X & B & E
ZY & D
LC
L & M
A X
N
Knowledge Base Knowledge Base Knowledge Base
X
C E C EB D B D
Y Y Y Y
Match Fire Match Fire Match Fire Match Fire
Knowledge Base
Database
A C E
X
Database
A C E
L
Database
A D
YL
B
X
Database
A D
ZY
B
LX
Cycle 1 Cycle 2 Cycle 3
X & B & E
ZY & D
LC
L & M
A X
N
X & B & E
ZY & D
LC
L & M
A X
N
X & B & E
ZY & D
LC
L & M
A X
N
X & B & E
ZY & D
LC
L & M
A X
N
Knowledge Base Knowledge Base Knowledge Base
X
C E C EB D B D
Y Y Y Y
Match Fire Match Fire Match Fire Match Fire
Knowledge Base
Database
A C E
X
Database
A C E
L
Database
A D
YL
B
X
Database
A D
ZY
B
LX
Cycle 1 Cycle 2 Cycle 3
X & B & E
ZY & D
LC
L & M
A X
N
X & B & E
ZY & D
LC
L & M
A X
N
X & B & E
ZY & D
LC
L & M
A X
N
X & B & E
ZY & D
LC
L & M
A X
N
Knowledge Base Knowledge Base Knowledge Base
X
C E C EB D B D
Y Y Y Y
Match Fire Match Fire Match Fire Match Fire
Knowledge Base
Database
A C E
X
Database
A C E
L
Database
A D
YL
B
X
Database
A D
ZY
B
LX
Cycle 1 Cycle 2 Cycle 3
X & B & E
ZY & D
LC
L & M
A X
N
X & B & E
ZY & D
LC
L & M
A X
N
X & B & E
ZY & D
LC
L & M
A X
N
X & B & E
ZY & D
LC
L & M
A X
N
Knowledge Base Knowledge Base Knowledge Base
X
C E C EB D B D
Y Y Y Y
Forward Chaining Examples
Facts:
Rules: A X Q T A YA & D Q Q R R S N L T Z
A B C D E Prove: Z
Use forward chaining to prove the following:
Forward Chaining Examples
Facts:
Rules fired: A X A YA & D Q Q R R S Q T T Z
A B C D E
SOLUTION
Proven:Z
A B C D E X Y Q R S T ZA B C D E X A B C D E X Y A B C D E X Y Q A B C D E X Y Q R A B C D E X Y Q R S A B C D E X Y Q R S T
Use forward chaining to prove the following:
Forward Chaining Examples
Facts:
Rules: A X Q T A YA & D Q Q R R S N L T Z
A B C D E Prove: L
Use forward chaining to prove the following:
Forward Chaining Examples
Facts:
Rules fired: A X A YA & D Q Q R R S Q T T Z
A B C D E X Y Q R S T Z
SOLUTION
Cannot prove:
– No more rules left to fire
L
Use forward chaining to prove the following:
Forward Chaining
Using forward chaining, many rules may be executed unnecessarily– Search space is large and ever-expanding– Inefficiently fires rules that do not lead to
desired goal
Therefore, often prefer to use backward chaining....
Backward Chaining
Backward chaining starts with a desired goal,then searches for evidence to prove the goal
– Desired goal often calledthe hypothetical solution
– Backward chaining alsocalled goal-driven reasoning
Match Fire
Knowledge Base
Database
AB CD E
X
Match Fire
Knowledge Base
Database
AC DE
YX
B
Sub-Goal: X Sub-Goal: Y
Knowledge Base
Database
AC DE
ZY
B
X
Match Fire
Goal: Z
Pass 2
Knowledge Base
Goal: Z
Knowledge Base
Sub-Goal: Y
Knowledge Base
Sub-Goal: X
Pass 1 Pass 3
Pass 5Pass 4 Pass 6
Database
AB CD E
Database
AB CD E
Database
BC DEA
YZ
?
X
?
X & B & E
LCL & M
A X
N
ZY & DX & B & EY
ZY & D
LCL & M
A X
NLC
L & M N
X & B & EYZY & D
A X
X & B & EYZY & D
LC
L & M
A X
N
X & B & E
LCL & M
A X
N
ZY & DX & B & E
ZY & D
LC
L & M
A X
N
Y
YY
Backward Chaining
Backward chaining algorithm:– At the first iteration, rule(s) with the
desired goal in the consequent are selected– Stack up and attain many subgoals until....– If the antecedent matches known data,
the rule is fired and the goal is proven– Otherwise, if no rules remain,
the desired goal is not proven
Match Fire
Knowledge Base
Database
AB CD E
X
Match Fire
Knowledge Base
Database
AC DE
YX
B
Sub-Goal: X Sub-Goal: Y
Knowledge Base
Database
AC DE
ZY
B
X
Match Fire
Goal: Z
Pass 2
Knowledge Base
Goal: Z
Knowledge Base
Sub-Goal: Y
Knowledge Base
Sub-Goal: X
Pass 1 Pass 3
Pass 5Pass 4 Pass 6
Database
AB CD E
Database
AB CD E
Database
BC DEA
YZ
?
X
?
X & B & E
LCL & M
A X
N
ZY & DX & B & EY
ZY & D
LCL & M
A X
NLC
L & M N
X & B & EYZY & D
A X
X & B & EYZY & D
LC
L & M
A X
N
X & B & E
LCL & M
A X
N
ZY & DX & B & E
ZY & D
LC
L & M
A X
N
Y
YY
Backward Chaining
Match Fire
Knowledge Base
Database
AB CD E
X
Match Fire
Knowledge Base
Database
AC DE
YX
B
Sub-Goal: X Sub-Goal: Y
Knowledge Base
Database
AC DE
ZY
B
X
Match Fire
Goal: Z
Pass 2
Knowledge Base
Goal: Z
Knowledge Base
Sub-Goal: Y
Knowledge Base
Sub-Goal: X
Pass 1 Pass 3
Pass 5Pass 4 Pass 6
Database
AB CD E
Database
AB CD E
Database
BC DEA
YZ
?
X
?
X & B & E
LCL & M
A X
N
ZY & DX & B & EY
ZY & D
LCL & M
A X
NLC
L & M N
X & B & EYZY & D
A X
X & B & EYZY & D
LC
L & M
A X
N
X & B & E
LCL & M
A X
N
ZY & DX & B & E
ZY & D
LC
L & M
A X
N
Y
YY
Match Fire
Knowledge Base
Database
AB CD E
X
Match Fire
Knowledge Base
Database
AC DE
YX
B
Sub-Goal: X Sub-Goal: Y
Knowledge Base
Database
AC DE
ZY
B
X
Match Fire
Goal: Z
Pass 2
Knowledge Base
Goal: Z
Knowledge Base
Sub-Goal: Y
Knowledge Base
Sub-Goal: X
Pass 1 Pass 3
Pass 5Pass 4 Pass 6
Database
AB CD E
Database
AB CD E
Database
BC DEA
YZ
?
X
?
X & B & E
LCL & M
A X
N
ZY & DX & B & EY
ZY & D
LCL & M
A X
NLC
L & M N
X & B & EYZY & D
A X
X & B & EYZY & D
LC
L & M
A X
N
X & B & E
LCL & M
A X
N
ZY & DX & B & E
ZY & D
LC
L & M
A X
N
Y
YY
Match Fire
Knowledge Base
Database
AB CD E
X
Match Fire
Knowledge Base
Database
AC DE
YX
B
Sub-Goal: X Sub-Goal: Y
Knowledge Base
Database
AC DE
ZY
B
X
Match Fire
Goal: Z
Pass 2
Knowledge Base
Goal: Z
Knowledge Base
Sub-Goal: Y
Knowledge Base
Sub-Goal: X
Pass 1 Pass 3
Pass 5Pass 4 Pass 6
Database
AB CD E
Database
AB CD E
Database
BC DEA
YZ
?
X
?
X & B & E
LCL & M
A X
N
ZY & DX & B & EY
ZY & D
LCL & M
A X
NLC
L & M N
X & B & EYZY & D
A X
X & B & EYZY & D
LC
L & M
A X
N
X & B & E
LCL & M
A X
N
ZY & DX & B & E
ZY & D
LC
L & M
A X
N
Y
YY
Backward Chaining
Match Fire
Knowledge Base
Database
AB CD E
X
Match Fire
Knowledge Base
Database
AC DE
YX
B
Sub-Goal: X Sub-Goal: Y
Knowledge Base
Database
AC DE
ZY
B
X
Match Fire
Goal: Z
Pass 2
Knowledge Base
Goal: Z
Knowledge Base
Sub-Goal: Y
Knowledge Base
Sub-Goal: X
Pass 1 Pass 3
Pass 5Pass 4 Pass 6
Database
AB CD E
Database
AB CD E
Database
BC DEA
YZ
?
X
?
X & B & E
LCL & M
A X
N
ZY & DX & B & EY
ZY & D
LCL & M
A X
NLC
L & M N
X & B & EYZY & D
A X
X & B & EYZY & D
LC
L & M
A X
N
X & B & E
LCL & M
A X
N
ZY & DX & B & E
ZY & D
LC
L & M
A X
N
Y
YY
Match Fire
Knowledge Base
Database
AB CD E
X
Match Fire
Knowledge Base
Database
AC DE
YX
B
Sub-Goal: X Sub-Goal: Y
Knowledge Base
Database
AC DE
ZY
B
X
Match Fire
Goal: Z
Pass 2
Knowledge Base
Goal: Z
Knowledge Base
Sub-Goal: Y
Knowledge Base
Sub-Goal: X
Pass 1 Pass 3
Pass 5Pass 4 Pass 6
Database
AB CD E
Database
AB CD E
Database
BC DEA
YZ
?
X
?
X & B & E
LCL & M
A X
N
ZY & DX & B & EY
ZY & D
LCL & M
A X
NLC
L & M N
X & B & EYZY & D
A X
X & B & EYZY & D
LC
L & M
A X
N
X & B & E
LCL & M
A X
N
ZY & DX & B & E
ZY & D
LC
L & M
A X
N
Y
YY
Backward Chaining Examples
Facts:
Rules: A X Q T A YA & D Q Q R R S N L T Z
A B C D E Prove: Z
Use backward chaining to prove the following:
Backward Chaining Examples
Facts:
Stack of rules: (subgoals)
Rules fired: A & D Q Q T T Z
A B C D E Q T Z
SOLUTION
Proven:ZA & D Q Q T T Z
A B C D E
Use backward chaining to prove the following:
Backward Chaining Examples
Facts:
Rules: A X Q T A YA & D Q Q R R S N L T Z
A B C D E Prove: L
Use backward chaining to prove the following:
Backward Chaining Examples
Facts:
Stack of rules: (subgoals)
Cannot prove:– Subgoal N cannot be proven
A B C D E
SOLUTION
N L
L
Use backward chaining to prove the following:
Conflict Resolution
Rules with identical antecedents (IF conditions) can cause conflicts via their consequents (THEN clauses)
Conflict resolution provides a specific method for choosing which rule to fire– Highest priority– Most specific rule– Most recent first