Upload
candice-paul
View
226
Download
1
Embed Size (px)
Citation preview
Fuzzy Expert System
Basic Notions
1. Fuzzy Sets2. Fuzzy representation in
computer3. Linguistic variables and hedges4. Operations of fuzzy sets5. Fuzzy rules6. Reasoning with fuzzy rules7. Fuzzy inference8. Building fuzzy expert system
Fuzzy Logic
Fuzzy Logic
Fuzzy logic is determined as a set of mathematical principles for knowledge representation based on degrees of membership rather than on crisp membership of classical binary logic
Fuzzy Logic
Fuzzy Logic
• Multi-valued• Deals with degree of
membership• Degrees of truth• Uses continuum of logical
values between 0 (completely false) and 1(completely true)
Fuzzy Sets
Fuzzy set
• Refer page 89• The basic idea of fuzzy set
theory ; an element belongs to a fuzzy set with certain degree of membership.
• Not either true or false, but partly true(false) to any degree
• Taken as a real number in the interval
• Refer table 4.1, fig. 4.2.
Range of logical values in Boolean and fuzzy logicRange of logical values in Boolean and fuzzy logic
(a) Boolean Logic. (b) Multi-valued Logic.0 1 10 0.2 0.4 0.6 0.8 100 1 10
Fuzzy set theory
• Crisp set– Let X be the universe of discourse and its
elements be denoted as x. crisp set A of X is defined as function fA(x) of A
• fA(x): X 0,1
• Where
Axif
Axifxf A ,0
,1)(
Fuzzy set theory
• Fuzzy set– Fuzzy set A of universe X is defined by function
A(x) called 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
The representation of fuzzy set
• Determine the membership function
• Method to determine membership function– Single expert– Multiple experts– Self generated by ANN, learn the data & derive
the fuzzy sets.
The classical example in fuzzy sets is The classical example in fuzzy sets is tall mentall men. The . The elements of the fuzzy set “tall men” are all men, but elements of the fuzzy set “tall men” are all men, but their degrees of membership depend on their their degrees of membership depend on their height. height.
Degree of Membership
Fuzzy
Mark
John
Tom
Bob
Bill
1
1
1
0
0
1.00
1.00
0.98
0.82
0.78
Peter
Steven
Mike
David
Chris
Crisp
1
0
0
0
0
0.24
0.15
0.06
0.01
0.00
Name Height, cm
205
198
181
167
155
152
158
172
179
208
150 210170 180 190 200160
Height, cmDegree ofMembership
Tall Men
150 210180 190 200
1.0
0.0
0.2
0.4
0.6
0.8
160
Degree ofMembership
170
1.0
0.0
0.2
0.4
0.6
0.8
Height, cm
Fuzzy Sets
Crisp Sets
Crisp and fuzzy sets of “tall men”
150 210170 180 190 200160
Height, cmDegree ofMembership
Tall Men
150 210180 190 200
1.0
0.0
0.2
0.4
0.6
0.8
160
Degree ofMembership
170
1.0
0.0
0.2
0.4
0.6
0.8
Height, cm
Fuzzy Sets
Crisp Sets
Crisp and fuzzy sets of “tall men”
Degree of Membership
Fuzzy
Mark
John
Tom
Bob
Bill
1
1
1
0
0
1.00
1.00
0.98
0.82
0.78
Peter
Steven
Mike
David
Chris
Crisp
1
0
0
0
0
0.24
0.15
0.06
0.01
0.00
Name Height, cm
205
198
181
167
155
152
158
172
179
208
The representation of fuzzy set• Fuzzy set of tall men can be represented as fit-
vectorTall men = (0/180, 0.5/185, 1/190) or
Tall men = (0/180, 1/190)
• Fuzzy set of short and average menShort men = (1/160, 0.5/165, 0/170) or
Short men = (1/160, 0/170)
average men = (0/165, 1/175, 0/185)
Crisp and fuzzy sets of short, average and tall menCrisp and fuzzy sets of short, average and tall men
150 210170 180 190 200160
Height, cmDegree ofMembership
Tall Men
150 210180 190 200
1.0
0.0
0.2
0.4
0.6
0.8
160
Degree ofMembership
Short Average ShortTall
170
1.0
0.0
0.2
0.4
0.6
0.8
Fuzzy Sets
Crisp Sets
Short Average
Tall
Tall
Representation of crisp and fuzzy subsetsRepresentation of crisp and fuzzy subsets
Fuzzy Subset A
Fuzziness
1
0Crisp Subset A Fuzziness x
X
(x)
Typical functions that can be used to represent a fuzzy set are sigmoid, gaussian and pi. However, these functions increase the time of computation. Therefore, in practice, most applications use linear fit functions.
Linguistic variables and hedges• A fuzzy variable
• E.g. the statement “John is tall” implies that the linguistic variable John takes the linguistic value tall
• In fuzzy ES linguistic variables are used in fuzzy rulesIF wind is strong
THEN sailing is good
IF project duration is long
THEN completion_risk is high
IF the speed is slow
THEN stopping_distance is short
Linguistic variables and hedges• E.g. The linguistic variable speed have range between 0
and 220 km/hour may include fuzzy subsets as very slow, slow, medium, fast and very fast
• Hedges - fuzzy set qualifiers
– Carries by a linguistic variable
– Terms that modifies fuzzy sets
– Includes adverb I.e. very, somewhat, quite, more or less and slightly
– Can modify verbs, adjectives, adverbs or the whole sentence (pg 95)
How to represent a fuzzy set in a computer?How to represent a fuzzy set in a computer?
First, we determine the membership functions. In our “tall men” example, we can obtain fuzzy sets of tall, short and average men.
The universe of discourse the men’s heights consists of three sets: short, average and tall men. As you will see, a man who is 184 cm tall is a member of the
average men set with a degree of membership of 0.1, and at the same time, he is also a member of the tall men set
with a degree of 0.4.
Linguistic variables and hedges• Hedges act as operations
– Very perform concentration and creates new subset
– E.g. tall men derive the subset very tall men
– Dilation : the of more or less tall men is broader than the set of tall men.
– Refer figure 4.5.
– Refer table 4.2
Fuzzy sets with the hedge Fuzzy sets with the hedge veryvery
Short
Very Tall
Short Tall
Degree ofMembership
150 210180 190 200
1.0
0.0
0.2
0.4
0.6
0.8
160 170
Height, cm
Average
TallVery Short Very Tall
Representation of hedges in fuzzy logicRepresentation of hedges in fuzzy logic
Hedge MathematicalExpression
A little
Slightly
Very
Extremely
Hedge MathematicalExpression Graphical Representation
[A ( x )]1.3
[A ( x )]1.7
[A ( x )]2
[A ( x )]3
Representation of hedges in fuzzy logic (continued)Representation of hedges in fuzzy logic (continued)
Hedge MathematicalExpressionHedge MathematicalExpression Graphical Representation
Very very
More or less
Indeed
Somewhat
2 [A ( x )]2
A ( x )
A ( x )
if 0 A 0.5
if 0.5 < A 1
1 2 [1 A ( x )]2
[A ( x )]4
Fuzzy sets operations
operations
1. Complement2. Containment3. Intersection4. Union5. Commutativity6. Associativity7. Distrubutivity8. Indempotency9. Identity10. Involution11. Transitivity12. De Morgan’s law
Operations of fuzzy setsOperations of fuzzy sets
Complement
0x
1
( x )
0x
1
Containment
0x
1
0x
1
A B
Not A
A
Intersection
0x
1
0x
A B
Union0
1
A BA B
0x
1
0x
1
A
B
A
B
( x )
( x )
( x )
Fuzzy rules• Capturing human knowledge in fuzzy rules
• Form of fuzzy rules:
IF x is A
THEN y is B
Where x and y are linguistic variables; A and B are linguistic values determined by fuzzy sets
Fuzzy rules• Difference with classical rules
– Classical IF-THEN rule uses binary logic e.g.
• Rule 1:
IF speed is > 100 THEN the stopping_distance is long
• Rule 2:
IF speed is < 40 THEN stopping_distance is short
– The variable speed can have any numerical value between 0-220km/h
– The linguistic variables stopping_distance can only take either long or short.
Fuzzy rules• Difference with classical rules
– Fuzzy IF-THEN rules uses binary logic e.g.
• Rule 1:
IF speed is fast THEN the stopping_distance is long
• Rule 2:
IF speed is slow THEN stopping_distance is short
– The variable speed can have any numerical value between 0-220km/h but include fuzzy sets range , slow, medium and fast
– The linguistic variables stopping_distance can be between 0 and 300m and may take fuzzy sets as short, medium or long
• Fuzzy expert systems merge the rules and consequently cut the number of rules at least 90%
Tall men Heavy men
180
Degree ofMembership1.0
0.0
0.2
0.4
0.6
0.8
Height, cm
190 200 70 80 100160
Weight, kg
120
Degree ofMembership1.0
0.0
0.2
0.4
0.6
0.8
Fuzzy sets of tall and heavy men
These fuzzy sets provide the basis for a weight estimation These fuzzy sets provide the basis for a weight estimation model. The model is based on a relationship between a model. The model is based on a relationship between a man’s height and his weight:man’s height and his weight:
IF height is tallTHEN weight is heavy
The value of the output or a truth membership grade of the rule The value of the output or a truth membership grade of the rule consequent can be estimated directly from a corresponding truth consequent can be estimated directly from a corresponding truth membership grade in the antecedent. This form of fuzzy inference membership grade in the antecedent. This form of fuzzy inference uses a method called uses a method called monotonic selectionmonotonic selection..
Tall menHeavy men
180
Degree ofMembership1.0
0.0
0.2
0.4
0.6
0.8
Height, cm
190 200 70 80 100160
Weight, kg
120
Degree ofMembership1.0
0.0
0.2
0.4
0.6
0.8
A fuzzy rule can have multiple antecedents, A fuzzy rule can have multiple antecedents,
for example:for example:
IF project_duration is longAND project_staffing is largeAND project_funding is inadequateTHEN risk is high
IF service is excellentOR food is deliciousTHEN tip is generous
The consequent of a fuzzy rule can also include The consequent of a fuzzy rule can also include multiple parts, multiple parts,
for instance:
IF temperature is hotTHEN hot_water is reduced;
cold_water is increased
Reasoning with Fuzzy rules• Includes 2 distinct part
– Evaluating the rule antecedent (the IF part)– Implication or applying the result to the consequent (the THEN
part)
• Mechanism– In classical rule based system
• If the rule antecedent is true, the consequent is also true
– In fuzzy systems, • All rules fires to some extent, • Partially fire• If the antecedent is true to some degree of membership, then the
consequent is also true to that same degree
– Discuss fig. 4.8, 4.9
Reasoning with Fuzzy rules• A fuzzy rule can have
– Multiple parts of antecedent
– Multiple parts of consequent (see example pg 105)
• In general fuzzy expert system incorporates not one but several rules that describe expert knowledge
Reasoning with Fuzzy rules• The output of each rule is a fuzzy set but need to
obtain a single number representing the ES output
• The output of the fuzzy sets are combined and transformed into a single number by..– Aggregates all output fuzzy sets into a single output
fuzzy set
– Then defuzzifies the resulting fuzzy set into a single number
– Fuzzy inference