0% found this document useful (0 votes)
208 views108 pages

Topic 2 - Expert System and Uncertainty (UiTM)

Download as pdf or txt
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 108

CSC583 – Artificial

Intelligence Algorithms
Topic 2 – Expert System and Uncertainty
Faculty of Computer & Mathematical Sciences
Universiti Teknologi MARA
A. Introduction
• What comes to your mind when you look at this picture?
A. Introduction: Objectives
• To understand what is an expert system and it’s components;
• To understand what is uncertainty and how fuzzy logic can
be used to solve uncertainty;
• To construct a simple expert system using Prolog.
• To construct a simple system using fuzzy logic toolbox in
Matlab.
A. Introduction: What is Knowledge?
• In the 1970s it was accepted that to make a machine solve an
intellectual problem, we must know the solution first
• We must have the knowledge, ‘know-how’ in some specific domain
• Knowledge: a theoretical or practical understanding of a subject or a
domain
• Expert: those who possess knowledge
B. Rule-Based Expert System
• Rules are used as a knowledge representation technique
• Any rule consists of two-parts:
• IF part, called antecedent (premise or condition)
• THEN part, called consequent (conclusion or action)
• As soon as knowledge is provided by a human expert, we can input it
into a computer
B. Rule-Based Expert System: Expert System
Development Team
• Lets look at who is needed to develop an expert system
B. Rule-Based Expert System: Expert System
Development Team – Domain Expert
• Domain expert is a knowledgeable and skilled person capable of
solving problems in a specific area or domain
• This person has the greatest expertise in a given domain
• This expertise is to be captured in the expert system
• Therefore, the expert must:
• Be able to communicate his or her knowledge
• Be willing to participate in the expert system development
• Commit substantial amount of time to the project
• The domain expert is the most important player in the
expert system development team
B. Rule-Based Expert System: Expert System
Development Team – Project Manager
• The project manager is the leader of the expert system
development team, responsible for keeping the project on
track
• He or she makes sure that all deliverables and milestones are
met, interacts with the expert, knowledge engineer,
programmer and end-user
B. Rule-Based Expert System: Expert System
Development Team – Knowledge Engineer
• A knowledge engineer is a computer scientist who knows
how to design and implement programs that incorporates
artificial intelligence techniques
• He or she interviews the domain expert to find out how a
particular problem is solved
• The knowledge engineer establishes what reasoning
methods the expert uses to handle facts and rules and
decides how to represent them in the expert system
B. Rule-Based Expert System: Expert System
Development Team – Programmer
• The programmer is the person responsible for the actual
programming, describing the domain knowledge in terms
that a computer can understand
B. Rule-Based Expert System: Expert System
Development Team – Relationship
B. Rule-Based Expert System: Structure
• A rule-based expert system has five components:
1. knowledge base
2. database
3. inference engine
4. explanation facilities
5. user interface
B. Rule-Based Expert System: Structure
B. Rule-Based Expert System: Structure –
Knowledge Base
• It contains the domain knowledge useful for problem solving.
• It is represented as a set of rules with IF (condition) THEN
(action) structure.
• Each rule specifies a relation, recommendation, directive or
heuristic.
• When the condition part of a rule is satisfied, the rule is said
to fire and the action part is executed.
B. Rule-Based Expert System: Structure –
Database
• The database includes a set of facts used to match against
the IF (condition) parts of rules stored in the knowledge
base.
B. Rule-Based Expert System: Structure –
Inference Engine
• The inference engine carries out the reasoning by which the
expert system reaches a solution
• It links the rules given in the knowledge base with the facts
provided in the database
B. Rule-Based Expert System: Structure –
Explanation Facilities
• The explanation facilities enable the user to ask the expert
system how a particular conclusion is reached and why a
specific fact is needed.
B. Rule-Based Expert System: Structure – User
Interface
• The user interface is the means of communication between a
user seeking a solution to the problem and an expert system
• The communication should be as meaningful and friendly as
possible.
B. Rule-Based Expert System: Example –
Family Tree

Database/Facts Knowledge Base/Rules


B. Rule-Based Expert System: Comparisons
with Conventional System & Human Expert
Human Experts Expert System Conventional System
Use knowledge in the form of Process knowledge expressed in Process data and use algorithms to
“rules of thumb” or heuristics to the form of rules and use symbolic solve general numerical problems
solve problems in a narrow domain reasoning to solve problems in a
narrow domain
In a human brain, knowledge exists Provide a clear separation of Do not separate knowledge from
in a compiled form knowledge and knowledge the control structures and code
processing (reasoning) used to process such knowledge
Capable of explaining their line of Trace the rules fired during a Do not explain how particular
reasoning and providing relevant problem-solving session; explain results are obtained and why input
details how a particular conclusion was data is needed
reached and why specific input
data was needed
B. Rule-Based Expert System: Comparisons with
Conventional System & Human Expert (cont)
Human Experts Expert System Conventional System
Use inexact reasoning and can deal Permit inexact reasoning and can Work only on problems where data
with incomplete, uncertain, and deal with incomplete, uncertain, is complete and exact
fuzzy information and fuzzy information
Can make mistakes when Can make mistakes when Provide no solution at all (or an
information is incomplete of fuzzy information is incomplete of fuzzy incorrect solution) when data is
incomplete or fuzzy
Enhance the quality of problem Enhance the quality of problem Enhance the quality of problem
solving via years of learning and solving by adding new rules or solving by changing the program
practical training. This process is adjusting old ones in the code, which affects both the
slow, inefficient and expensive knowledge base. When new knowledge and its processing,
knowledge is acquired, changes are making changes difficult.
easy to accomplish
B. Rule-Based Expert System: Can ES make
mistakes?
• Even a brilliant expert is only human and thus can make
mistakes
• An expert system built to perform at a human expert level
also should be allowed to make mistakes.
• Thus, we can rely on solutions provided by expert systems
but mistakes are possible and we should be aware of it.
B. Rule-Based Expert System: Decision Tree
• Rules in a knowledge base can be represented as a Decision Tree
(DT).
• A DT is made up of connected decision points
• Tree has starting decision (root).
• For each decision (starting from root), one of a set of ongoing options is
chosen.
• Choice is made based on conditions derived from the character’s
knowledge/values.
• Continue along the tree until the decision process has no more
decisions to make.
• Each leaf is an action, to be executed.
B. Rule-Based Expert System: Decision Tree –
Example: Soldier Character in Game
input conditions
root (decision points)

leaf
(action)
B. Rule-Based Expert System: Decision Tree –
Combinations of Decisions
• A decision tree is efficient because the decisions are simple –
only one test condition at a time.
• When Boolean combination of tests (AND/OR) are required,
some tree structures can be used to represent them.
B. Rule-Based Expert System: Decision Tree –
Combinations of Decisions (AND)
• To AND two decisions together, place them in series
• the first decision needs to be true to consider the second, in order
to get to action 1.
B. Rule-Based Expert System: Decision Tree –
Combinations of Decisions (OR)
• To OR two decisions together, place them in series
• either the first or second decision can be true in order to carry out
action 1
B. Rule-Based Expert System: Decision Tree
(Design) – Example: Car Diagnostic
B. Rule-Based Expert System: Decision Tree
(Design) – Example: Medical ES
B. Rule-Based Expert System: How ES Reach
Conclusion?
• In a rule-based expert system:
• Domain knowledge – represented by IF-THEN production rules
(knowledge base)
• Data – represented by a set of facts about the current situation
(database)
• Inference engine compares each rule in knowledge base with
facts contained in database
• When the IF (condition) part of rule matches a fact, rule is
fired and its THEN (action) part is executed
B. Rule-Based Expert System: How ES Reach
Conclusion? (cont)
• The matching of the rule IF parts to the facts produces
inference chains
• The inference chain indicates how an expert system applies
the rules to reach a conclusion
B. Rule-Based Expert System: How ES Reach
Conclusion? (cont)
• The inference engine cycles via a match-fire procedure:
B. Rule-Based Expert System: Example of
Inference Chain
Rule 1: IF Y is true Database facts: A, B, C, D, E
AND D is true
THEN Z is true

Rule 2: IF X is true
AND B is true
AND E is true
THEN Y is true

Rule 3: IF A is true
THEN X is true
B. Rule-Based Expert System: Types of
Inference Engine
• The inference engine decides when the rules have to be fired
• There are two principal ways rules are executed:
• Forward chaining: data-driven reasoning where it starts from the
known data and proceeds with that data
• Backward chaining: goal-driven reasoning where the goal is
known and the inference engine attempts to find the evidence to
prove it
B. Rule-Based Expert System: Types of
Inference Engine – Forward Chaining
• The reasoning starts from the known data (eg. A) and
proceeds forward with that data.
• When fired, the rule adds a new fact in the database (eg. X).
• Any rule can be executed only once per cycle.
• The match-fire cycle stops when no further rules can be
fired.
B. Rule-Based Expert System: Types of
Inference Engine – Forward Chaining (cont)
B. Rule-Based Expert System: Types of
Inference Engine – Forward Chaining
Cycle Rules Facts
A, B, C, D, E
Rule 1: Y&D→Z
Rule 2: X&B&E→Y 1 R3 X
Rule 3: A→X R4 L
Rule 4: C→L
2 R2 Y
Rule 5: L&M→N
3
B. Rule-Based Expert System: Types of Inference
Engine – Forward Chaining Weakness
• Rules that have nothing to do with the established goal may
be executed also.
• Thus, if the goal is to infer only one particular fact, forward
chaining inference technique would not be efficient.
• E.g. In previous example, if our goal is to establish Z, rule C → L
has nothing to do with the goal but is still executed.
B. Rule-Based Expert System: Types of
Inference Engine – Backward Chaining
• First, the knowledge base is searched to find rules that might
have the desired solution.
• Such rules must have the goal in their THEN (action) parts.
• If such a rule is found and its IF (condition) part matches data
in the database, then the rule is fired and the goal is proved.
• However this is rarely the case
B. Rule-Based Expert System: Types of
Inference Engine – Backward Chaining (cont)
• Inference engine puts aside the rule it is working with (the
rule is said to stack) and sets up a new goal, a sub-goal, to
prove the IF part of this rule.
• Then, the knowledge base is searched again for rules that
can prove the sub-goal.
• The inference engine repeats the process of stacking the
rules until no more rules are found in the knowledge base to
prove the current sub-goal.
B. Rule-Based Expert System: Types of
Inference Engine – Backward Chaining (cont)
B. Rule-Based Expert System: Types of
Inference Engine – Backward Chaining (cont)
B. Rule-Based Expert System: Types of
Inference Engine – Backward Chaining
Pass Goal/Subgoal Rule (Stack) Rule (Fire) Facts
A, B, C, D, E
Rule 1: Y&D→Z
1 Z R1
Rule 2: X&B&E→Y
Rule 3: A→X 2 Y R2
Rule 4: C→L 3 X R3
Rule 5: L&M→N
4 X 3 X
5 Y 2 Y
6 Z 1 Z
B. Rule-Based Expert System: How to Choose
between Forward & Backward Chaining?
• The answer is to study how a domain expert solves a
problem
• If an expert first needs to gather some information and then tries
to infer from it whatever can be inferred, choose forward chaining
inference engine.
• If an expert begins with a hypothetical solution and then attempts
to find facts to prove it, choose backward chaining inference
engine.
B. Rule-Based Expert System: Question
Example 1
Suppose the database initially includes facts S, U, P, E and R
and the following rules in the knowledge base
• Rule 1: If W is true and E is true then R is true.
• Rule 2: If B is true and U is true and R is true then W is true.
• Rule 3: If S is true then B is true.
• Rule 4: If P is true then O is true.
i. Construct an inference chain diagram
ii. Apply forward chaining by showing the number of rules fired, final
database facts and the number of cycles occurred.
B. Rule-Based Expert System: Question
Example 1 – Inference Chain Diagram

S B S, U, P, E, R

U W • Rule 1: If W is true and E is


true then R is true.
R • Rule 2: If B is true and U is
R E true and R is true then W is
true.
• Rule 3: If S is true then B is
true.
• Rule 4: If P is true then O is
P O true.
B. Rule-Based Expert System: Question
Example 1 – Forward Chaining

Cycle Rules Facts • Rule 1: If W is true and E is


true then R is true.
S,U,P,E,R • Rule 2: If B is true and U is
true and R is true then W is
1 R3 B true.
• Rule 3: If S is true then B is
R4 O true.
• Rule 4: If P is true then O is
2 R2 W true.
3 R1 R
B. Rule-Based Expert System: Q2
Given a rule-based Expert System with 9 rules whose purpose is to
advise you on how your health is influenced by certain foods and other
factors. The rules are:
• R1: IF you eat beef or eggs THEN high cholesterol
• R2: IF you eat fish or poultry and no beef THEN low cholesterol
• R3: IF you eat no beef or no poultry and no fish THEN low cholesterol
• R4: IF you are Catholic and today is Friday THEN you eat no fish and no beef
• R5: IF you are Buddhist THEN you eat no beef
• R6: IF you are a vegetarian THEN you eat no fish, no beef and no poultry
• R7: IF low cholesterol THEN healthy
• R8: IF high cholesterol THEN unhealthy
• R9: IF you eat veal THEN you eat beef
• R10: If you work 6 hours or less today THEN it is Friday
• What if you are catholic, eat poultry and work 4 hours today?
C. Uncertainty Management: What is
Uncertainty?
• Information available for human experts is often imperfect:
• incomplete, inconsistent, uncertain
• Experts however can cope with the defects and usually make
correct judgements and right decisions
• Expert system must also be able to handle uncertainty and
draw valid conclusions
C. Uncertainty Management: What is
Uncertainty in ES?
• Uncertainty can be defined as the lack of the exact
knowledge that would enable us to reach a perfectly reliable
conclusion (Stephanou and Sage, 1987)
C. Uncertainty Management: What are
Sources of Uncertain Knowledge in ES?
• We can identify four main sources in general:
1. Weak implications
2. Imprecise language
3. Unknown data
4. Combining views of different experts
C. Uncertainty Management: What are
Sources of Uncertain Knowledge in ES? (cont)
1. Weak implications
• Domain experts and knowledge engineers have the painful task of
establishing concrete correlations between IF (condition) and
THEN (action) parts of the rules
• Therefore, expert systems need to have the ability to handle vague
associations
• For example by accepting the degree of correlations as numerical
certainty factors
C. Uncertainty Management: What are
Sources of Uncertain Knowledge in ES? (cont)
2. Imprecise Language
• Our natural language is ambiguous and imprecise
• We describe facts with such terms as often and sometimes,
frequently and hardly ever
• As a result, it can be difficult to express knowledge in the precise
IF-THEN form of production rules
• However, if the meaning of the facts is quantified, it can be used in
expert systems.
C. Uncertainty Management: What are
Sources of Uncertain Knowledge in ES? (cont)
3. Unknown Data
• When the data is incomplete or missing, the only solution is to
accept the value ‘unknown’ and proceed to an approximate
reasoning with this value
C. Uncertainty Management: What are
Sources of Uncertain Knowledge in ES? (cont)
4. Combining the views of different experts
• Large expert systems usually combine the knowledge and
expertise of a number of experts
• Unfortunately, experts seldom reach exactly the same conclusions
• To resolve the conflict, the knowledge engineer has to attach a
weight to each expert and then calculate the composite conclusion
• But no systematic method exists to obtain these weights
C. Uncertainty Management: How can ES
handle Uncertainty?
• Experts rely on common sense when they solve problems
which may be uncertain where they may use vague and
ambiguous terms.
• Expert system can handle uncertainty using fuzzy logic and
we can call it fuzzy expert system.
D. Fuzzy Expert System: What is Fuzzy Logic?
• Fuzzy logic describes fuzziness that involves the theory of
fuzzy sets.
• Fuzzy logic is based on idea that all things come on a sliding
scale:
• temperature, height, speed, distance, beauty
• It reflects how people think and attempts to model our sense
of words, decision making and common sense.
D. Fuzzy Expert System: What is the
Difference between Boolean & Fuzzy Logic?
• Boolean Logic: uses sharp distinction
• 0 OR 1
• a line can be drawn between members of a class and non-members.
• Fuzzy Logic: multi-valued logic, extend range of truth to all
real number values between 0 and 1
• E.g: possibility of 181 cm tall man being tall is set at value 0.86
• Employs the spectrum of colours, accepting that things can be partly true and
false at the same time.
D. Fuzzy Expert System: What is Fuzzy Logic?
(cont)
• Fuzzy logic is a set of mathematical principles for knowledge
representation based on degrees of membership.
• Fuzzy logic uses the continuum of logical values between 0
(completely false) and 1 (completely true)
D. Fuzzy Expert System: Fuzzy Logic Example –
Tall Men
• The classical example in fuzzy sets is ‘Tall men’.
• The elements of the fuzzy set ‘Tall men’ are all men but their
degree of membership depend on their height.
D. Fuzzy Expert System: Fuzzy Logic Example –
Tall Men (cont)
• Crisp and fuzzy sets of “tall men”
D. Fuzzy Expert System: Fuzzy Logic Example –
Tall Men
• The horizontal axis (x-axis) in previous figures represents the
universe of discourse – the range of all possible values to the
chosen variable (in our case, height).
• The vertical axis (y-axis) represents the membership value of
our fuzzy set.
• In our case, the fuzzy set of “tall men” maps height values into
corresponding membership values.
D. Fuzzy Expert System: What is a Fuzzy Set?
• A fuzzy set can be simply defined as a set with fuzzy
boundaries
• Let X be the universe of discourse and its elements be
denoted as x
D. Fuzzy Expert System: What is a Fuzzy Set?
(cont)
• In classical set theory, crisp set A of universe X is defined as
function fA(x) called the characteristic function of set A
fA(x): X → {0, 1} where

• This set maps universe X to a set of two elements.


• For any element x of universe X, characteristic function fA(x)
is equal to 1 if x is an element of A, and equal to 0 if x is not
an element of A
D. Fuzzy Expert System: What is a Fuzzy Set?
(cont)
• In fuzzy set theory, fuzzy set A of universe X is defined as function
µA(x) called the membership function of set A
µA(x): X → [0, 1] where µA(x) = 1 if x is totally in A;
µA(x) = 0 if x is not in A;
0 < µA(x) < 1 if x is partly in A.

• This set allows a continuum of possible choices


• For any element x of universe X, membership function µA(x)
equals the degree to which x is an element of A
• This degree, a value between 0 and 1 represents the degree of
membership, also called as membership value of element x in set
A.
D. Fuzzy Expert System: How to Represent a
Fuzzy Set in a Computer? Example – Tall Men
• The membership function must be determined first
• Knowledge of single expert,
• Knowledge of multiple experts,
• Artificial neural networks, etc
• In our “tall men” example, we can obtain fuzzy sets of tall,
short and average men
• The universe of discourse: men’s heights now consists of
three fuzzy sets: short, average and tall men
D. Fuzzy Expert System: How to Represent a Fuzzy
Set in a Computer? Example – Tall Men (cont)
• A man that is 184 cm tall is a member of average men set
with a degree of membership of 0.1, and at the same time a
member of tall men set with a degree of 0.4

crisp set fuzzy set


D. Fuzzy Expert System: Linguistic Variables
and Hedges
• At the root of fuzzy set theory lies the idea of linguistic
variables
• Linguistic variable is a fuzzy variable. For example:
John is tall
Linguistic variable Linguistic value

• The statement implies that the linguistic variable John takes the
linguistic value tall
D. Fuzzy Expert System: Linguistic Variables
and Hedges (cont)
• In fuzzy expert systems, linguistic variables are used in fuzzy rules.
Examples:
IF wind is strong
THEN sailing is good
IF project_duration is long
THEN completion_risk is high
IF speed is slow
THEN stopping_distance is short
D. Fuzzy Expert System: Linguistic Variables
and Hedges (cont)
• The range of possible values of a linguistic variable represents the
universe of discourse of that variable
• For example, the universe of discourse of the linguistic variable speed
might have the range between 0 and 220 km per hour
• It may also include such fuzzy subsets as very slow, slow, medium,
fast, and very fast
D. Fuzzy Expert System: Linguistic Variables
and Hedges (cont)
• A linguistic variable also carries with it the concept of fuzzy set
qualifiers, called hedges
• Hedges are terms that modify the shape of fuzzy sets. They include
adverbs such as very, somewhat, quite, more or less and slightly

Fuzzy set with the hedge ‘very’


D. Fuzzy Expert System: Linguistic Variables and
Hedges – Representation of Hedges in Fuzzy Logic
D. Fuzzy Expert System: Linguistic Variables and
Hedges – Representation of Hedges in Fuzzy Logic
(cont)
D. Fuzzy Expert System: What is a Fuzzy Rule?
• A fuzzy rule can be defined as a conditional statement in the form:

IF x is A
THEN y is B

where x and y are linguistic variables; and A and B are linguistic


values determined by fuzzy sets on the universe of discourses X and
Y, respectively.
D. Fuzzy Expert System: What is the
Difference between Classical and Fuzzy Rules?
• A classical IF-THEN rule uses binary logic, for example
Rule: 1 Rule: 2
IF speed is > 100 IF speed is < 40
THEN stopping_distance is long THEN stopping_distance is short

• The variable speed can have any numerical value between 0 and 220
km/h, but the linguistic variable stopping_distance can take either
value long or short
• In other words, classical rules are expressed in the black-and-white
language of Boolean logic.
D. Fuzzy Expert System: What is the
Difference between Classical and Fuzzy Rules?
• We can also represent the stopping distance rules in a fuzzy form:
Rule: 1 Rule: 2
IF speed is fast IF speed is slow
THEN stopping_distance is long THEN stopping_distance is short

• In fuzzy rules, the linguistic variable speed also has the range (the
universe of discourse) between 0 and 220 km/h, but this range
includes fuzzy sets, such as slow, medium and fast
• The universe of discourse of the linguistic variable stopping_distance
can be between 0 and 300 m and may include such fuzzy sets as
short, medium and long.
D. Fuzzy Expert System: How to Reason with
Fuzzy Rules?
• Fuzzy rules relate fuzzy sets
• In classical rule-based systems, if the rule antecedent is true, then the
consequent is also true
• In fuzzy systems, where the antecedent is a fuzzy statement, all rules
fire to some extent, or in other words they fire partially.
• If the antecedent is true to some degree of membership, then the
consequent is also true to that same degree.
D. Fuzzy Expert System: How to Reason with
Fuzzy Rules? Example – Tall and Heavy Men
• These fuzzy sets provide the basis for a weight estimation model. The
model is based on a relationship between a man’s height and his
weight, which is expressed as a single fuzzy rule:
IF height is tall
THEN weight is heavy
D. Fuzzy Expert System: How to Reason with Fuzzy
Rules? Example – Tall and Heavy Men (cont)
• The value of the output or a truth membership grade of the rule
consequent can be estimated directly from a corresponding truth
membership grade in the antecedent
• This form of fuzzy inference uses a method called monotonic
selection.
D. Fuzzy Expert System: Can the Antecedent
of a Fuzzy Rule have Multiple Parts?
• A fuzzy rule can have multiple antecedents, for example:

IF project_duration is long
AND project_staffing is large
AND project_funding is inadequate
THEN risk is high
IF service is excellent
OR food is delicious
THEN tip is generous
D. Fuzzy Expert System: Can the Consequent
of a Fuzzy Rule have Multiple Parts?
• The consequent of a fuzzy rule can also include multiple parts, for
instance:
IF temperature is hot
THEN hot_water is reduced;
cold_water is increased
D. Fuzzy Expert System: Fuzzy Inference
• The output of each rule is a fuzzy set, but usually we need to obtain a
single number representing the expert system output
• To obtain a single crisp solution for the output variable, a fuzzy expert
system first aggregates all output fuzzy sets into a single output fuzzy
set, and then defuzzifies the resulting fuzzy set into a single number
• This process is called Fuzzy Inference
D. Fuzzy Expert System: Fuzzy Inference
• The most commonly used fuzzy inference technique is the Mamdani
method
• In 1975, Professor Ebrahim Mamdani of London University built one
of the first fuzzy systems to control a steam engine and boiler
combination
• He applied a set of fuzzy rules supplied by experienced human
operators
D. Fuzzy Expert System: Mamdani Fuzzy
Inference
• The Mamdani-style fuzzy inference process is performed in
four steps:
1. Fuzzification of the input variables
2. Rule evaluation
3. Aggregation of the rule outputs
4. Defuzzification
D. Fuzzy Expert System: Mamdani Fuzzy
Inference
• We examine a simple two-input one output problem that
includes three rules:
D. Fuzzy Expert System: Mamdani Fuzzy
Inference
• Three universe of discourse: X: Project Funding, Y: Project
Staffing, Z: Risk
D. Fuzzy Expert System: Mamdani Fuzzy
Inference – Step 1: Fuzzification
• The first step is to take the crisp inputs, x1 and y1 (project
funding and project staffing), and determine the degree to
which these inputs belong to each of the appropriate fuzzy
sets
D. Fuzzy Expert System: Mamdani Fuzzy
Inference – Step 2: Rule Evaluation
• The second step is to take the fuzzified inputs:
• µ(x=A1) = 0.5, µ(x=A2) = 0.2, µ(y=B1) = 0.1 and µ(y=B2) = 0.7,
• and apply them to the antecedents of the fuzzy rules
• If a given fuzzy rule has multiple antecedents, the fuzzy
operator (AND or OR) is used to obtain a single number that
represents the result of the antecedent evaluation
• This number (the truth value) is then applied to the
consequent membership function
D. Fuzzy Expert System: Mamdani Fuzzy
Inference – Step 2: Rule Evaluation (cont)
• OR fuzzy operation:
• µA∪B(x) = max [µA(x), µB(x)]
• AND fuzzy operation:
• µA∩B(x) = min [µA(x), µB(x)]
• Fuzzified inputs:
• µ(x=A1) = 0.5, µ(x=A2) = 0.2, µ(y=B1) = 0.1 and µ(y=B2) = 0.7
D. Fuzzy Expert System: Mamdani Fuzzy
Inference – Step 2: Rule Evaluation (cont)
D. Fuzzy Expert System: Mamdani Fuzzy
Inference – Step 2: Rule Evaluation (cont)
• Now the result of the antecedent evaluation can be applied to
the membership function of the consequent
• The most common method of correlating the rule consequent
with the truth value of the rule antecedent is to cut the
consequent membership function at the level of the antecedent
truth
• This method is called clipping. Since the top of the membership
function is sliced, the clipped fuzzy set loses some information
• However, clipping is still often preferred because it involves less
complex and faster mathematics, and generates an aggregated
output surface that is easier to defuzzify
D. Fuzzy Expert System: Mamdani Fuzzy
Inference – Step 2: Rule Evaluation (cont)
• While clipping is a frequently used method, scaling offers a
better approach for preserving the original shape of the
fuzzy set
• The original membership function of the rule consequent is
adjusted by multiplying all its membership degrees by the
truth value of the rule antecedent.
• This method, which generally loses less information, can be
very useful in fuzzy expert systems
D. Fuzzy Expert System: Mamdani Fuzzy
Inference – Step 2: Rule Evaluation (cont)
• Clipped and scaled membership functions
D. Fuzzy Expert System: Mamdani Fuzzy Inference
– Step 3: Aggregation of the Rule Outputs
• Aggregation is the process of unification of the outputs of all
rules
• We take the membership functions of all rule consequents
previously clipped or scaled and combine them into a single
fuzzy set
• The input of the aggregation process is the list of clipped or
scaled consequent membership functions, and the output is
one fuzzy set for each output variable
D. Fuzzy Expert System: Mamdani Fuzzy Inference
– Step 3: Aggregation of the Rule Outputs (cont)
D. Fuzzy Expert System: Mamdani Fuzzy
Inference – Step 4: Defuzzification
• Fuzziness helps us to evaluate the rules, but the final output
of a fuzzy system has to be a crisp number
• The input for the defuzzification process is the aggregate
output fuzzy set and the output is a single number
D. Fuzzy Expert System: Mamdani Fuzzy
Inference – Step 4: Defuzzification (cont)
• Most popular defuzzification methods is the centroid
technique
• It finds the point where a vertical line would slice the
aggregate set into two equal masses. Mathematically this
centre of gravity (COG) can be expressed as:
D. Fuzzy Expert System: Mamdani Fuzzy
Inference – Step 4: Defuzzification (cont)
• Centroid defuzzification method finds a point representing
the centre of gravity of the fuzzy set, A, on the interval, ab.
• A reasonable estimate can be obtained by calculating it over
a sample of points
D. Fuzzy Expert System: Mamdani Fuzzy
Inference – Step 4: Defuzzification (cont)
D. Fuzzy Expert System: Mamdani Fuzzy
Inference – Disadvantage
• Mamdani-style inference, requires to find the centroid of a
two-dimensional shape by integrating across a continuously
varying function
• In general, this process is not computationally efficient
D. Fuzzy Expert System: Sugeno Fuzzy
Inference
• Michio Sugeno suggested to use a single spike, a singleton,
as the membership function of the rule consequent
• A fuzzy singleton, is a fuzzy set with a membership function
that is unity at a single particular point on the universe of
discourse and zero everywhere else
• Sugeno-style fuzzy inference is very similar to the Mamdani
method and changed only a rule consequent
• Instead of a fuzzy set, a mathematical function of the input
variable is used
D. Fuzzy Expert System: Sugeno Fuzzy
Inference (cont)
• The format of the Sugeno-style fuzzy rule is
IF x is A
AND y is B
THEN z is f(x,y)
• where x, y and z are linguistic variables; A and B are fuzzy
sets on universe of discourses X and Y, respectively; and
f(x,y) is a mathematical function
D. Fuzzy Expert System: Sugeno Fuzzy
Inference (cont)
• The most commonly used zero-order Sugeno fuzzy model
applies fuzzy rules in the following form:
IF x is A
AND y is B
THEN z is k
• where k is a constant
• In this case, the output of each fuzzy rule is constant. All
consequent membership functions are represented by
singleton spikes (determined by experts)
D. Fuzzy Expert System: Sugeno Fuzzy
Inference – Sugeno-style Rule Evaluation
D. Fuzzy Expert System: Sugeno Fuzzy Inference –
Sugeno-style Aggregation of the Rule Outputs
D. Fuzzy Expert System: Sugeno Fuzzy
Inference – Sugeno-style Defuzzification
• The aggregation operation includes all the singletons
• We can find the weighted average (WA) of these singletons
D. Fuzzy Expert System: Sugeno Fuzzy Inference –
How to Choose between Mandani and Sugeno?
• Mamdani method is widely accepted for capturing expert
knowledge.
• Advantage: allows us to describe the expertise in more intuitive,
more human-like manner.
• Disadvantage: entails a substantial computational burden
• On the other hand, Sugeno method is computationally
effective
• Works well with optimisation and adaptive techniques, which
makes it very attractive in control problems, particularly for
dynamic nonlinear systems
F. Review Questions
• What is expert system?
• What is uncertainty?
• What is fuzzy expert system?
• What type of problem is suitable to be solved using fuzzy
expert system?

You might also like