Documente Academic
Documente Profesional
Documente Cultură
Pushpak Bhattacharyya
CSE Dept.,
IIT Bombay
Lecture 38: Fuzzy Logic
Uncertainty Studies
Uncertainty Study
Qualitative
Reasoning
Probability Based Information Theory Fuzzy Logic Based
based
Probabilistic Markov
Entropy
Reasoning Processes
Centric
& Graphical
Algos
Models
High Low T F
No Yes No Yes
Rule Base
R1: If outlook is sunny and if humidity is high
then Decision is No.
μrich(w) μpoor(w)
wealth w wealth w
Example Profiles
μA (x) μA (x)
x x
‘very’ operation:
μtall(h) very tall
μvery tall(x) = μ2tall(x)
‘somewhat’ operation:
μsomewhat tall(x) =
0
√(μtall(x)) h
Representation of Fuzzy sets
Let U = {x1,x2,…..,xn}
|U| = n
The various sets composed of elements from U are presented
as points on and inside the n-dimensional hypercube. The crisp
sets are the corners of the hypercube. μA(x1)=0.3
μA(x2)=0.4
(0,1) (1,1)
x2 (x1,x2)
U={x1,x2}
x2 A(0.3,0.4)
(0,0) (1,0)
Φ x1 x1
E ( S ) d ( S , nearest ) / d ( S , farthest)
x2
A (0.5,0.5)
d(A, nearest)
(0,0) (1,0)
x1
d(A, farthest)
Definition
Distance between two fuzzy sets
n
d ( S1 , S 2 ) | s1 ( xi ) s2 ( xi ) |
i 1
L1 - norm
s ( x) 1 s ( x)
c
Note on definition by extension and intension
S1 = {xi|xi mod 2 = 0 } – Intension
S2 = {0,2,4,6,8,10,………..} – extension
(0,1) (1,1)
A
x2 . B1 Region where A ( x) B ( x)
.B2
.B3
(0,0) (1,0)
x1
This effectively means
B P ( A) CRISPLY
P(A) = Power set of A
Eg: Suppose
A = {0,1,0,1,0,1,…………….,0,1} – 104 elements
B = {0,0,0,1,0,1,……………….,0,1} – 104 elements
Isn’t B A with a degree? (only differs in the 2nd element)
Fuzzy definition of subset
Measured in terms of “fit violation”, i.e. violating the
condition A ( x) B ( x)
Degree of subset hood = 1- degree of superset hood
= x
max( 0, A ( x) B ( x))
1
m( A)
m(A) = cardinality of A
=
x
A ( x)
We can show that E ( A) S ( A Ac , A Ac )
Exercise 1:
Show the relationship between entropy and subset hood
Exercise 2:
Prove that
S ( B, A) m( A B) / m( A)
Subset hood of B in A
Fuzzy sets to fuzzy logic
Forms the foundation of fuzzy rule based system or fuzzy expert system
Expert System
Rules are of the form
If
C1 C2 ...........Cn
then
Ai
Where Cis are conditions
Eg: C1=Colour of the eye yellow
C2= has fever
C3=high bilurubin
A = hepatitis
In fuzzy logic we have fuzzy predicates
Classical logic
P(x1,x2,x3…..xn) = 0/1
Fuzzy Logic
P(x1,x2,x3…..xn) = [0,1]
Fuzzy OR
P( x) Q( y ) max( P( x), Q( y ))
Fuzzy AND
P( x) Q( y ) min( P( x), Q( y ))
Fuzzy NOT
~ P( x) 1 P ( x)
Fuzzy Implication
Many theories have been advanced and many
expressions exist
The most used is Lukasiewitz formula
t(P) = truth value of a proposition/predicate. In
fuzzy logic t(P) = [0,1]
t(P Q ) = min[1,1 -t(P)+t(Q)]
High
Pressure
Pressure
Fuzzy Inferencing
Fuzzy Inferencing: illustration through inverted
pendulum control problem
Core
The Lukasiewitz rule
t( P Q ) = min[1,1 + t(P) – t(Q)]
An example
Controlling an inverted pendulum
.
θ d / dt = angular velocity
Motor i=current
The goal: To keep the pendulum in vertical position (θ=0)
in dynamic equilibrium. Whenever the pendulum departs
from vertical, a torque is produced by sending a current ‘i’
.θ
-ve -ve +ve +ve
med Zero
θ small small med
-ve
med
+ve
med
Each cell is a rule of the form
.
If θ is <> and θ is <>
then i is <>
4 “Centre rules”
.
1. if θ = = Zero and θ = = Zero then i = Zero
.
2. if θ is +ve small and θ = = Zero then i is –ve small
.
3. if θ is –ve small and θ = = Zero then i is +ve small
.
4. if θ = = Zero and θ is +ve small then i is –ve small
.
5. if θ = = Zero and θ is –ve small then i is +ve small
Linguistic variables
1. Zero
2. +ve small
3. -ve small
Profiles
1
-ve small +ve small
-ε3 -ε2 ε2 ε3
-ε +ε .
Quantity (θ, θ , i)
Inference procedure
.
1. Read actual numerical values of θ and θ
2. Get the corresponding μ values μZero, μ(+ve small),
μ(-ve small). This is called FUZZIFICATION
3. For different rules, get the fuzzy I-values from
the R.H.S of the rules.
4. “Collate” by some method and get ONE current
value. This is called DEFUZZIFICATION
5. Result is one numerical value of ‘i’.