Title: CS621: Artificial Intelligence
1CS621 Artificial Intelligence
- Pushpak BhattacharyyaCSE Dept., IIT Bombay
- Lecture 38 Fuzzy Logic
2Uncertainty Studies
Uncertainty Study
Qualitative Reasoning
Information Theory based
Fuzzy Logic Based
Probability Based
Markov Processes Graphical Models
Probabilistic Reasoning
Entropy Centric Algos
Bayesian Belief Network
3To-play-or-not-to-play-tennis data vs.
Climatic-Condition from Ross Quinlans paper on
ID3 (1986), C4.5 (1993)
4(No Transcript)
5Outlook
Cloudy
Sunny
Rain
Yes
Humidity
Windy
F
High
Low
T
No
No
Yes
Yes
6Rule Base
- R1 If outlook is sunny and if humidity is high
then Decision is No. - R2 If outlook is sunny and if humidity is low
then Decision is Yes. - R3 If outlook is cloudy then Decision is Yes.
-
7Fuzzy Logic
8Fuzzy Logic tries to capture the human ability of
reasoning with imprecise information
- Models Human Reasoning
- Works with imprecise statements such as
- In a process control situation, If the
temperature is moderate and the pressure is high,
then turn the knob slightly right - The rules have Linguistic Variables, typically
adjectives qualified by adverbs (adverbs are
hedges).
9Underlying Theory Theory of Fuzzy Sets
- Intimate connection between logic and set theory.
- Given any set S and an element e, there is a
very natural predicate, µs(e) called as the
belongingness predicate. - The predicate is such that,
- µs(e) 1, iff e ? S
- 0, otherwise
- For example, S 1, 2, 3, 4, µs(1) 1 and
µs(5) 0 - A predicate P(x) also defines a set naturally.
- S x P(x) is true
- For example, even(x) defines S x x is
even
10Fuzzy Set Theory (contd.)
- Fuzzy set theory starts by questioning the
fundamental assumptions of set theory viz., the
belongingness predicate, µ, value is 0 or 1. - Instead in Fuzzy theory it is assumed that,
- µs(e) 0, 1
- Fuzzy set theory is a generalization of classical
set theory also called Crisp Set Theory. - In real life belongingness is a fuzzy concept.
- Example Let, T set of tall people
- µT (Ram) 1.0
- µT (Shyam) 0.2
- Shyam belongs to T with degree 0.2.
11Linguistic Variables
- Fuzzy sets are named by Linguistic Variables
(typically adjectives). - Underlying the LV is a numerical quantity
- E.g. For tall (LV), height is numerical
quantity. - Profile of a LV is the plot shown in the figure
shown alongside.
µtall(h)
1
0.4
4.5
1 2 3 4 5 6
0
height h
12Example Profiles
µpoor(w)
µrich(w)
wealth w
wealth w
13Example Profiles
µA (x)
µA (x)
x
x
Profile representing moderate (e.g. moderately
rich)
Profile representing extreme
14Concept of Hedge
- Hedge is an intensifier
- Example
- LV tall, LV1 very tall, LV2 somewhat tall
- very operation
- µvery tall(x) µ2tall(x)
- somewhat operation
- µsomewhat tall(x) v(µtall(x))
tall
somewhat tall
1
very tall
µtall(h)
0
h
15Representation 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)
Ux1,x2
x2
A(0.3,0.4)
(1,0)
(0,0)
F
x1
x1
A fuzzy set A is represented by a point in the
n-dimensional space as the point µA(x1),
µA(x2),µA(xn)
16- Degree of fuzziness
- The centre of the hypercube is the most fuzzy
set. Fuzziness decreases as one nears the corners - Measure of fuzziness
- Called the entropy of a fuzzy set
Fuzzy set
Farthest corner
Entropy
Nearest corner
17(0,1)
(1,1)
x2
(0.5,0.5)
A
d(A, nearest)
(0,0)
(1,0)
x1
d(A, farthest)
18Definition Distance between two fuzzy sets
L1 - norm
Let C fuzzy set represented by the centre
point d(c,nearest) 0.5-1.0 0.5 0.0
1 d(C,farthest) gt E(C) 1
19Definition Cardinality of a fuzzy set
generalization of cardinality of classical sets
Union, Intersection, complementation, subset hood
20Note on definition by extension and intension S1
xixi mod 2 0 Intension S2
0,2,4,6,8,10,.. extension How to define
subset hood?
21Meaning of fuzzy subset Suppose, following
classical set theory we say if Consider
the n-hyperspace representation of A and B
(1,1)
(0,1)
A
Region where
x2
. B1 .B2 .B3
(1,0)
(0,0)
x1
22This effectively means 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 Isnt
with a degree? (only differs in the 2nd element)
23Fuzzy definition of subset
Measured in terms of fit violation, i.e.
violating the condition Degree of subset hood
1- degree of superset hood m(A)
cardinality of A
24We can show that Exercise 1 Show the
relationship between entropy and subset
hood Exercise 2 Prove that
Subset hood of B in A
25Fuzzy sets to fuzzy logic
Forms the foundation of fuzzy rule based system
or fuzzy expert system Expert System Rules are of
the form If then Ai Where Cis are conditions Eg
C1Colour of the eye yellow C2 has fever C3high
bilurubin A hepatitis
26In 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 Fuzzy
AND Fuzzy NOT
27Fuzzy 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( ) min1,1 -t(P)t(Q)
Lukasiewitz definition of implication
28Eg If pressure is high then Volume is low
High Pressure
Pressure
29Fuzzy Inferencing
30Fuzzy Inferencing illustration through inverted
pendulum control problem
Core The Lukasiewitz rule t( )
min1,1 t(P) t(Q) An example Controlling an
inverted pendulum
angular velocity
?
icurrent
Motor
31The 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 Controlling
factors for appropriate current Angle ?, Angular
velocity ?. Some intuitive rules If ? is ve
small and ?. is ve small then current is zero If
? is ve small and ?. is ve small then current
is ve medium
32Control Matrix
?
-ve med
-ve small
ve small
ve med
Zero
?.
-ve med
-ve small
Region of interest
ve med
ve small
Zero
Zero
-ve small
ve small
Zero
ve small
-ve med
-ve small
Zero
ve med
33- Each cell is a rule of the form
- If ? is ltgt and ?. is ltgt
- then i is ltgt
- 4 Centre rules
- if ? Zero and ?. Zero then i Zero
- if ? is ve small and ?. Zero then i is ve
small - if ? is ve small and ?. Zero then i is ve
small - if ? Zero and ?. is ve small then i is ve
small - if ? Zero and ?. is ve small then i is ve
small
34- Linguistic variables
- Zero
- ve small
- -ve small
- Profiles
1
ve small
-ve small
-e3
e3
e2
-e2
-e
e
Quantity (?, ?., i)
35Inference procedure
- Read actual numerical values of ? and ?.
- Get the corresponding µ values µZero, µ(ve
small), µ(-ve small). This is called
FUZZIFICATION - For different rules, get the fuzzy I-values from
the R.H.S of the rules. - Collate by some method and get ONE current
value. This is called DEFUZZIFICATION - Result is one numerical value of i.