Introduction To Fuzzy Systems
Introduction To Fuzzy Systems
FUZZY SYSTEMS
By
Dr. M. Tahir Khaleeq
Total Slides 37 1
Fuzzy Sets
• Fuzzy logic is an approach to uncertainty that combines real values
[0,1] and logic operations
• Fuzzy logic is based on the ideas of fuzzy set theory and fuzzy set
membership.
Ex: He is very tall how does this differ from tall?
• In normal sets, membership is binary.
– An item is either in the set or not in the set.
Ex: U = { 1,2,3,4,5,6,7,8,9}
A = {1,3,5,7,9}
B = {2,4,6,8}.
2
Fuzzy Sets (continue)
• In fuzzy sets, membership is based on a degree
between 0 and 1
– 0 means that the object is not a member of the set
– 1 means that the object belongs entirely to the set
– If degree is between 0 and 1, then this degree is the
degree to which the item is thought to be in the set.
– Each value of the function is called a membership
degree.
Ex: Jun is 43, 1.0 in set Hot
August is 40, 0.7 in set Hot
September is 35, 0.2 in set Hot 3
Fuzzy Sets (continue)
• The notion of the fuzzy set was introduced by Lotfi Zadeh
in 1965.
• Fuzzy sets have imprecise boundaries.
• Transition between fuzzy sets is gradual.
• Fuzzy v Crisp:
Fuzzy (approximate) Crisp (precise)
- Elements can belong to Elements belong to one
two sets at same time. set or the other only.
- cold, warm, hot 20, 30, 40 (°C)
- slow, normal, fast 50, 70, 100 (km/h)
- dry, normal, humid 10, 25, 75 (% R.H.)4
Fuzzy Sets (continue)
• Difference between an ordinary (crisp set) and a fuzzy set
is shown in the figure
• Crisp sets use clear cut
on the boundaries.
cool medium
Crisp set • Fuzzy sets use grades.
1
Short Medium Tall – The value 170cm belongs
0.7
to fuzzy set medium to a
degree of 0.2 and at the
0.2 set tall to a degree of 0.7.
30 170 250
Height (cm)
6
Conceptualizing in Fuzzy terms
• The representation of a problem in fuzzy terms is called
conceptualization in fuzzy terms.
1. Single-valued (Singleton)
2. Triangular
3. Trapezoidal
4. S-function (sigmoid function)
5. Z-function
6. function (bell function
10
Single-valued (Singleton)
• U = b. B is a scalar value
Triangular Function b U
• The triangular functions are uniformly distributed over
the universe U.
11
• Membership function (for a<b<c):
x a c x
mtri ( x; a , b, c) max{min{ , }, 0 },
b a c b
Example: If X= 32.5 then
µtri (32.5; 25,30,35) = max { min { 32.5 - 25 , 35 - 32.5 },0}
30 - 25 35 - 30
= max { min { 1.5, 0.5},0}
= max {0.5,0} = 0.5
32.5
12
Trapezoidal Function
• Member ship function (for a b < c d )
x a d x
m trap ( x; a , b, c,d ) max{min{ ,1, }, 0 },
b a d c
14
Fuzzy Logic
• Just as fuzzy sets are an extension to sets, fuzzy logic is an
extension to classical logic.
• Fuzzy logic is a multi-valued logic while the classical logic is a
binary logic.
• Classical logic holds that every thing can be expressed in binary
terms: 0 or 1, black or white, yes or ne, in terms of Boolean
algebra, every thing is in one set or another but not in both.
• Fuzzy logic allows for values between 0 and 1, shades of gray
and may be partial membership in a set.
15
Fuzzy Logic (continue)
• When the approximate reasoning of fuzzy logic is used
with an expert system, logical inferences can be drawn
from imprecise relationships.
• EX: To optimize automatically the wash cycle of a
washing machine by sensing
– the load size
– fabric mix, and
– quantity of detergent.
• The most distinguishing property of fuzzy logic is that
deal with fuzzy propositions, which contain fuzzy
variables and fuzzy values.
16
Fuzzy Rules
• Several types of fuzzy rules have been used for fuzzy
knowledge engineering.
• IF x is A THEN y is B
– Where (x is A) and (y is B) are two fuzzy
propositions:
• x and y are fuzzy variables defined over universe
of discourse U and V respectively; and
• A and B are fuzzy sets defined by their fuzzy
membership functions
µA : U [0,1], µB : V [0,1]
17
Fuzzy Rules (continue)
• May contain AND, OR, NOT and other operators
• The conclusion is computed by applying these fuzzy
operators to the fuzzified inputs
• Implication operation will be applied to rule output
Example: IF day is hot THEN drink lots of water
18
Fuzzy Rules (continue)
• The rule would recommend to drink 6 - 10 glasses of
water.
• The implication of the rule will be the minimum of the
intersection of the 0.7 membership line with the “lots
of” implication weight function.
mA B ( x , y ) min[mA ( x ), mB ( y )]
19
Fuzzification
• When the input data are crisp then the fuzzification is
applied over fuzzy rules of the type
IF x1 is A1 AND x2 is A2 THEN y is B.
20
Fuzzification (continue)
– Crisp input x is input to fuzzy membership function m(x)
Example: Temperature = 37.4 degC
– Result is fuzzy degree of membership
Example: Membership in “hot” is 0.7
21
RULE EVALUATION
• Rule evaluation takes place after the fuzzification
procedure.
• It deals with single values of membership degrees
mA(x) and mA(y) and produces output membership
function.
• There are two major methods which can be applied:
1. Minimum inference:
mA B ( x , y ) min[mA ( x ), mB ( y )]
2. Product inference:
mA B ( x , y ) mA ( x )mB ( y ) 22
DEFUZZIFICATION
• If the output is crisp then the defuzzification is applied
over fuzzy rules.
v . mB(v)
The Mean-of-Maxima Method
y=
– This method finds the value y’for
mBoutput
(v) variable y which has
maximum membership degree according to the fuzzy membership
function B.
– If values have maximum values then find mean of them.
24
Example
y'(MOM)
0.7
y'(COG)
y
0 1 2 3 4
1.5
1.9
(0 × 0) + (1 × 1) + (1 × 2) + (0.7 × 3)
y'(COG) = 1.9
1 + 1 + 0.7
1+2
y'(MOM) = = 1.5
2
25
Fuzzy Expert System
• A fuzzy expert system is like an ordinary expert system
but methods of fuzzy logic are applied.
• Fuzzy expert systems use:
– Fuzzy data (fuzzy input and output variables)
– Fuzzy rules
– Fuzzy inference
– Other components of the ordinary expert system
26
Block diagram of a fuzzy expert system
Fuzzification
Membership Defuzzyfication
Function
User Interface
Fuzzy data/Exact data
Fuzzy queries/Exact queries
27
1. Fuzzy Rule-Base
– The fuzzy rules and the membership functions make up
the system knowledge base.
– Some systems use production rules extended with fuzzy
variables and confidence factors.
– Different types of production rules can be used:
antecedent part consequent part
Crisp Crisp (CF)
Crisp Fuzzy (CF)
Fuzzy Crisp (CF)
Fuzzy Fuzzy (CF)
28
2. Data-Base
– Data can be exact or fuzzy data with certainty factors.
Ex: economic situation good CF = 0.95
3. Fuzzy Inference Machine
– A fuzzy inference machine is built on the theoretical basis
of fuzzy inference methods
– A fuzzy inference machine activates all the satisfied rules
at every cycle.
– A characteristic of fuzzy expert system is the realization
of partial match between exact or fuzzy facts.
– A rule is fired only if the matching degree of the left hand
side of the rule is greater than a predefined threshold.
29
– A measure of the degree of matching is calculated for
every case.
Ex: fuzzy fact --- fuzzy condition
Crisp fact --- fuzzy condition
fuzzy fact --- exact condition
crisp fact --- exact condition
30
5. User Interface
– The interface unit communicates with the user or the
environment, or both for collecting input data and
reporting output results.
– Fuzzy queries might be possible when the user input
information in fuzzy terms.
Ex: high temperature, severe headache etc.
6. Learning Fuzzy Rules
– This is optional module.
– Learning can take place either before the inference
machine starts the reasoning process, or during the
fuzzy inference process.
– If learning takes place before the inference machine
starts the learning module uses AI machine learning
31
methods or neural networks.
– If the learning takes place during the fuzzy inference
process the fuzzy neural networks can be used for
learning.
7. Explanation
– The explanation module explains the way the expert
system is functioning during the inference process or
explains how the final solution has been reached.
– The system may use fuzzy terms for explanation as well as
exact terms and values.
32
Fuzzy System Design
• The following are the main steps of the fuzzy system design:
1. Identification the Problem
– Identify the problem and choosing the type of fuzzy system,
which best suits the problem requirements.
– A modular system can be designed consisting of several
modules linked together.
– The modular approach simply the design of the whole system,
reduce the complexity and make the system more
comprehensible.
2. Defining the Input and Output Variables:
– Define the input and output variables, their fuzzy values and
their membership functions.
33
3. Articulating the Set of Fuzzy Rules
36
END
37
All lectures are available on
www.geocities.com/mtkhaleeq/AI.htm
38