KBS-Rule Based System
KBS-Rule Based System
ARTIFICIAL
INTELLIGENCE
Intelligent systems
Rule-based systems
Topics
A. Short introduction in Artificial Intelligence (AI)
C. Intelligent systems
A. Rule-based systems in certain environments
B. Rule-based systems in uncertain environments (Bayes, Fuzzy)
C. Learning systems
A. Decision Trees
B. Artificial Neural Networks
C. Support Vector Machines
D. Evolutionary algorithms
D. Hybrid systems
Knowledge-based systems
Logic-based systems
Expert
systems Decision trees
Bayes
Fuzzy Artificial Neural Networks
Support Vector Machines
Rule-based systems
Evolutionary Algorithms
Objects,
frames,
agents
Content
Typology
Representation
Storing
Typology
Perfect knowledge
Imperfect knowledge
Not-exactly
Incomplete
Non-measurable
Knowledge representation
Formal logic (formal languages)
Rules
Semantic nets
April, 2017 Artificial Intelligence - Rule-based Systems (RBS) 8
Intelligent systems – KBS
Knowledge base (KB)
Knowledge representation
Formal logic (formal languages)
Definition
Science of formal principles for rationing
Components
Syntax – atomic symbols used by language and the constructing rules of the language
Semantic – associates a meaning to each symbol and a truth value (true or false) to each rule
Syntactic inference – rules for identifying a subset of logic expressions theorems (for generating new
expressions)
Typology
True value
Dual logic
Polyvalent logic
Basic elements
Classic primitives = sentences (predicates)
Probabilistic primitives = random variables
Working manner
Propositional logic declarative propositions and fix or unique objects (Ionica is student)
First-order logic declarative propositions, predicates and quantified variables, unique objects or
variables associated to a unique object
Rules
Semantic nets
Semantic nets
Oriented graphs with nodes that contain concepts and edges that represent semantic relations among concepts
Meronymy (A is a meronym of B if A is a part of B)
Eg. Finger is a meronym of hand, wheel is a meronym of car
Holonymy (A is holonym of B dacă B is a part of A)
Ex. Tree is a holonym of branch
Hyponymy (A is hyponym of B if A is a kind of B)
Ex. Tractor is a hyponym of vehicle
Hypernymy (A is hypernym of B if A is a generalization of B)
Ex. Fruit is a hypernym of orange
Synonymy (A is a synonym of B if A and B have the same meaning)
Ex. run is synonym to jog
Antonymy (A is an antonym of B if A and B reflect opposed things)
Ex. Dry is an antonym to wet
Relations
Simple data bases
Formal logic
Rules
Procedural logic
Algorithms
Typology
Inference direction
IE with forward chaining
Start from available information and determine a conclusion
Based on data (data driven)
IE with backward chaining
Start from a possible conclusion and identify some explanations for it
Based on aim (goal driven)
Case-based reasoning
Architecture
Typology
Tools
Content
Explore a lot of information for obtaining conclusions about
difficult activities by using methods of formal logic
A logic system is composed of
Language (syntax and semantic)
Deduction method (inference)
Aim of a LBS
Problem solving by help of declarative programming
Ex. Automatic theorems proving
Temporal systems
Represent the truth value of fact along time (Ionică is sometimes nervous)
Modal systems
Represents doubtful facts also (Ionică could pass the exam)
Inference engine
Performs inference
Establish the truth value of a proposition taking into account the KB
Typology
Model checking
All the possible combinations of truth value for all the involved symbols and
propositions
Model deduction
Model checking
Steps
Construct the table for all possible combinations of truth values for all the symbols
Determine if all the models of KB are models for O too
KB models – that models where all propositions are true
P Q R PQR QP Q BC R BCR
Example T T T T T T T T T
P = Afară este foarte cald T T F F T T F F T
Q = Afară este umezeală
T F T T T F F T T
R = Afară plouă
T F F T T F F F T
BC = {PQR, QP, Q} F T T T F T F T T
R = Va ploua? F T F T F T F F T
F F T T T F F T T
F F F T T F F F T
Difficulties
Exponential number for all combinations large computing time
Solution: deduction by using inference rules
Example
Problem
Solution
P = Afară este foarte cald
Q = Afară este umezeală
1. Q Premise
R = Afară plouă
2. QP Premise
BC = {PQR, QP, Q} 3. P Modus Ponens (1,2)
R = Va ploua? 4. (PQ)R Premise
5. PQ introductiv AND(1,3)
6. R Modus Ponens (4,5)
Case-based reasoning
Design
Architecture
RBS’s aim
Solving problems that require human experts
To transfer expertise from an expert to a computer system and
Than on to other humans (non-experts)
Knowledge acquisition
Knowledge representation
Knowledge inference
User interface
Allows dialog with users and accessing facts
and knowledge from KB (to be added or updated)
A facility for the user to interact with the system
Explanation Facility
Explains reasoning of the system to the user
Aim
Storing all knowledge (facts, rules, solving methods,
heuristics) about a specific domain taken from human
experts or other sources
Example
Ionică works at Facebook
Typology
Persistence (changing rate)
Static facts - ~ permanently (Ionica works at Facebook)
Dynamic facts – specific for an instance/run (Ionica takes a
lunch brake)
Generation
Given facts (Ionica assists to a meeting)
Derived facts – resulted by applying some rules (If Ionica is
PM, then he must lead the meeting)
Rules’ advantages
Easy to understand (natural form of knowledge)
Easy to derive inference and explanations
Easy to modify and maintain
Rules’ limits
Complex knowledge requires many rules
Search limitations in systems with many rules
User interface
Allows dialog with users and accessing facts
and knowledge from KB (to be added or updated)
A facility for the user to interact with the system
Explanation Facility
Explains reasoning of the system to the user
Aim
Helps to explore KB for reasoning solutions, recommendations
or conclusions
Typology
IE with forward chaining
IE with backward chaining
Main idea
starts with the initial facts and keep using the rules to draw new
conclusions (or take certain actions) given those facts.
The rules are of the form
left hand side (LHS) ==> right hand side (RHS).
Data-driven - Start from available information as it becomes
available, then try to draw conclusions
Example
Question: Does employee Popescu get a phone?
Remarks
Facts are represented in a working memory which is continually updated.
Rules represent possible actions to take when specified conditions hold on items
in the working memory.
The conditions are usually patterns that must match items in the working
memory,
The actions usually involve adding or deleting items from the working memory.
Example
Question: Does employee John get a computer?
Check the rule base to see what has to be “true” for John to get a computer. A
programmer. Is it a fact that john is programmer. If true, then he gets a
computer
Remarks
Needs to keep track of what goals it needs to prove to prove
its main hypothesis.
Rules
R1: if A is true and C is true, then B is true
R2: if C is true and D is true then F is true
R3: if C is true and D is true then E is true
R4: if A is true and B is true and X is true then Y is true
R5: if Y is true and D is true then Z is true
Goal
Fact Z
repeat
Select rules that can be applied for facts of KB
Rules that contain in LHS facts from KB
If for a fact more rules can be applied, choose one of
them (that has not been used)
Apply the selected rules and add into the KB the new
resulted facts
Until the goal fact or a stop rule is reached
B F X
A,B,C,D,E A,B,C,D,E,F A,B,C,D,E,F,X
Y
A,B,C,D,E,F,X, Y
activation
Z
A,B,C,D,E,F,X,Y,
Z
activation
repeat
Select the rules that match the goal
Rules that contains in RHS the goal fact
If more rules can be applied for a given goal, choose one of
them
Check the selected rules
Replace the goal by causes in the selected rules (these causes become the
new goals)
Until all the goals are true
Are known facts (from the KB)
Are information provided by user
Repeat
Apply the previous selected rules (in reverse order)
Until all the rules are applied and the goal is reached (as
fact in KB)
A,B,C,D,E
goal
Z
April, 2017 Artificial Intelligence - Rule-based Systems (RBS) 43
Intelligent systems – KBS – RBS
Architecture – inference engine – example
Iteration 1.1
A,B,C,D,E
YBC Y goal
Z,Y
= sub-goal
April, 2017 Artificial Intelligence - Rule-based Systems (RBS) 44
Intelligent systems – KBS – RBS
Architecture – inference engine – example
Iteration 1.2
A,B,C,D,E
goal
XBC X Z,Y,X
= sub-goal
April, 2017 Artificial Intelligence - Rule-based Systems (RBS) 45
Intelligent systems – KBS – RBS
Architecture – inference engine – example
Iteration 1.2
A,B,C,D,E
goal
XBC X Z,Y,X
= sub-goal
April, 2017 Artificial Intelligence - Rule-based Systems (RBS) 46
Intelligent systems – KBS – RBS
Architecture – inference engine – example
Iteration 2.1
A,B,C,D,E,X X
application
A,B,C,D,E,X,Y Y
application
A,B,C,D,E,X,Y,Z Z
application
Conflict resolution
Approaches
first rule
random rule
the most specific rule
the oldest rule
the best rule
Example
R1: if color is yellow, then the fruit is apple
R2: if color is yellow and shape is longish then the fruit is banana
R3: if shape is round then the fruit is apple
Remarks
Ordering the rules only works for small systems (of up to 100 rules ).
Rules are sorted only in small systems.
Example
R1: if color is yellow, then the fruit is apple
R2: if color is yellow and shape is longish then the fruit is banana
R3: if shape is round then the fruit is apple
Remarks
Selection can be a good one or a bad one
Example
R1: if color is yellow, then the fruit is apple
R2: if color is yellow and shape is longish then the fruit is banana
R3: if shape is round then the fruit is apple
Remarks
A specific rule processes more information than a general one
longest matching strategy
Example
R1: if color is yellow, then the fruit is apple [12.01.2012 – 13.45]
R2: if color is yellow and shape is longish then the fruit is banana
[7.02.2012 – 21.10]
R3: if shape is round then the fruit is apple [10.01.2012 – 10.25]
Remarks
the new rules have been added by an expert whose opinion is less trusted than that of the
expert who added the earlier rules. In this case,, it clearly makes more sense to allow the earlier
rules priority.
Example
R1: if color is yellow, then the fruit is apple [30%]
R2: if color is yellow and shape is longish then the fruit is banana
[30%]
R3: if shape is round then the fruit is apple [40%]
Remarks
Require human expertise for prioritization
User interface
Allows dialog with users and accessing facts
and knowledge from KB (to be added or updated)
A facility for the user to interact with the system
Explanation Facility
Explains reasoning of the system to the user
Design
Architecture
CLIPS –
NASA took the forward chaining capabilities and syntax of ART and introduced the "C
Language Integrated Production System" (i.e., CLIPS) into the public domain.
MYCIN (1972-1980)
MYCIN is an interactive program that diagnoses certain infectious diseases, prescribes antimicrobial therapy, and can explain
its reasoning in detail
PROSPECTOR (1974-1983)
Provides advice on mineral exploration
TEIRESIAS
For information retrieval
XCON (1978-1999)
configure computers
Financial RBSs
ExpertTAX, Risk Advisor (Coopers & Lybrand), Loan Probe, Peat/1040 (KPMG), VATIA, Flow Eval
(Ernst & Young), Planet, Compas, Comet (Price Waterhouse), Rice (Arthur Andersen), Audit
Planning Advisor, World Tax Planner (Deloitte Touche)
Limits
Narrow domain
Limited focus
Instability to learn
Maintenance problems
Developmental cost
RBSs
Explore knowledge by using methods of human logic
Can solve problems that do not have a deterministic solution
Try to simulate a human expert
Components
KB facts and rules
IE forward and backward chaining
C. Intelligent systems
A. Rule-based systems in certain environments
B. Rule-based systems in uncertain environments (Bayes, Fuzzy)
C. Learning systems
A. Decision Trees
B. Artificial Neural Networks
C. Support Vector Machines
D. Evolutionary algorithms
D. Hybrid systems