fuzzy sets and fuzzy logic - krchowdhary.com
TRANSCRIPT
Fuzzy Sets and Fuzzy Logic
KR Chowdhary, Professor,Department of Computer Science & Engineering, MBM
Engineering College, JNV University, Jodhpur,
CSE Dept., MBM Engg. Col., JNV Univ.
Outline
Crisp Logic Fuzzy Logic Fuzzy Logic Applications Conclusion
“traditional logic”: {true,false}
CSE Dept., MBM Engg. Col., JNV Univ.
Crisp Logic Crisp logic is concerned with absolutestrue or false, there is no in
between.
Example: Rule:
If the temperature is higher than 80F, it is hot; otherwise, it is not hot.Cases:
Temperature = 100F Hot Temperature = 80.1F Hot Temperature = 79.9F Not Hot Temperature = 50F Not Hot
CSE Dept., MBM Engg. Col., JNV Univ.
Membership function A fuzzy set is a generalization of an ordinary set by by allowing
a degree (or grade) of membership for each element, which varies from 0 to 1, i.e. [0, 1].
Let the people in an organization be the universe. A subset of this is a crisp set.
Consider a set of “young” people in this organization. The “youngness” is not a step function from 0 to 1, for certain age, say 30.
CSE Dept., MBM Engg. Col., JNV Univ.
A degree of youngness is associated to each element, like {Ann/0.8, Bob/0.1, Cathy/1}. Perhaps they are 28,40,23. Each element is represented as <element/degree>.
The membership function of a set maps each element to its degree.
CSE Dept., MBM Engg. Col., JNV Univ.
Membership function of crisp logic
80F Temperature
HOT
1
If temperature >= 80F, it is hot (1 or true);
If temperature < 80F, it is not hot (0 or false).
0
True
False
CSE Dept., MBM Engg. Col., JNV Univ.
Drawbacks of crisp logic
The membership function of crisp logic fails to distinguish between members of the same set.
CSE Dept., MBM Engg. Col., JNV Univ.
Concept of Fuzzy Logic
Many decisionmaking and problemsolving tasks are too complex to be defined precisely
However, people succeed by using imprecise knowledge
Fuzzy logic resembles human reasoning in its use of approximate information and uncertainty to generate decisions.
CSE Dept., MBM Engg. Col., JNV Univ.
Natural Language is not crisp
Consider: Joe is tall what is tall? Joe is very tall what does this differ from tall?
Natural language (like most other activities in life and indeed the universe) is not easily translated into the absolute terms of 0 and 1.
CSE Dept., MBM Engg. Col., JNV Univ.
What is Fuzzy Logic? 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 often found in natural (e.g., spoken) language.
CSE Dept., MBM Engg. Col., JNV Univ.
Example: “Young” Example:
Ann is 28, 0.8 in set “Young” Bob is 35, 0.1 in set “Young” Charlie is 23, 1.0 in set “Young”
Unlike statistics and probabilities, the degree is not describing probabilities that the item is in the set, but instead describes to what extent the item is the set.
CSE Dept., MBM Engg. Col., JNV Univ.
Membership function for “young”
Membership function m(x) to be young:
x M(x)
25 1.0
30 0.5
40 0.1
50 0.1
m x ={1.0 for 0<x≤251
1 x−255
2for x>25 }
Membership function for youngness
M(x)
0 25 30 35 40 Age->
CSE Dept., MBM Engg. Col., JNV Univ.
Membership function of fuzzy logic
Age25 40 55
Young Old1
Middle
0.5
DOM
Degree of Membership
Fuzzy sets
Fuzzy values have associated degrees of membership in the set.
0
CSE Dept., MBM Engg. Col., JNV Univ.
Crisp set vs. Fuzzy set
A traditional crisp set A fuzzy set
CSE Dept., MBM Engg. Col., JNV Univ.
Crisp set vs. Fuzzy set
CSE Dept., MBM Engg. Col., JNV Univ.
Benefits of fuzzy logic You want the value to switch gradually as
Young becomes Middle and Middle becomes Old. This is the idea of fuzzy logic.
CSE Dept., MBM Engg. Col., JNV Univ.
Fuzzy Set Operations Fuzzy union (∪): Union of two fuzzy sets is the maximum
(MAX) of each element from two sets.
A∪B={x/max(mA(x),mB(x)| x ∈U}
Let a fuzzy set is A = Comfortable house for six persons. A = {(1, .2), (2, .5), (3, .8), (4, 1), (5, .7), (6, .3)}
Let B = Large type of house = {(3, .2), (4, .4), (5, .6), (6, .8), (7, 1), (8, 1)}A ∪ B = {(1, .2), (2, .5), (3, .8), (4, 1), (5, .7), (6, .8), (7, 1), (8, 1)}
CSE Dept., MBM Engg. Col., JNV Univ.
Fuzzy Set Operations.. Fuzzy intersection (∩): Intersection of two fuzzy sets is just the MIN
of each element from the two sets. A∩B={x/min(mA(x),mB(x)| x ∈U} E.g. A = {(1, .2), (2, .5), (3, .8), (4, 1), (5, .7), (6, .3)} Let B = Large type of house B = {(3, .2), (4, .4), (5, .6), (6, .8), (7, 1), (8, 1)} A ∩ B = { (3, .2), (4, .4), (5, .6), (6, .3) }
CSE Dept., MBM Engg. Col., JNV Univ.
Fuzzy Set Operations.. The complement of a fuzzy variable with DOM x is (1x). Complement ( A’): The complement of a fuzzy set is
composed of all elements’ complement. A′={x/(1mA(x))|x ∈U} Example.A = {(1, .2), (2, .5), (3, .8), (4, 1), (5, .7), (6, .3)} A′ = {(1, .8), (2, .5), (3, .2), (4, 0), (5, .3), (6, .7)}
CSE Dept., MBM Engg. Col., JNV Univ.
Crisp Relations Ordered pairs showing connection between two sets: (a,b): a is related to b (2,3) are related with the relation “<“
Relations are set themselves < = {(1,2), (2, 3), (2, 4), ….}
Relations can be expressed as matrices
< 1 2
1 × √
2 × ×
CSE Dept., MBM Engg. Col., JNV Univ.
Fuzzy Relations Triples showing connection between two sets: (a,b,#): a is related to b with degree #
Fuzzy relations are set themselves Fuzzy relations can be expressed as matrices
…
CSE Dept., MBM Engg. Col., JNV Univ.
Fuzzy Relations Matrices
Example: ColorRipeness relation for tomatoes
R1(x, y) unripe semi ripe ripe
green 1 0.5 0
yellow 0.3 1 0.4
Red 0 0.2 1
CSE Dept., MBM Engg. Col., JNV Univ.
Inference rule The inference rule is rule of composition
[a bc d ] ο [ xy ]= [ax ∨by
cx ∨dy ]
Relation of composition on crisp sets:R°S={(a,c) | (a,b)∈R,(b,c)∈S,a∈A,b∈B,c∈C}
Fuzzy Compositional rule:
CSE Dept., MBM Engg. Col., JNV Univ.
Inference rule
u n se ri hi low
gryere [
1 .5 o. 3 1 .40 .2 1 ] °
unseri [
.1 1
.6 .41 .2 ]
hi lo
=gryere [
. 5 1
. 6 . 41 . 2 ]
Consider that there are two relation sets. One related the color oftomato to ripeness, and other relates ripeness to prices(hi,low).Given this find out the relation from color to price.
CSE Dept., MBM Engg. Col., JNV Univ.
Example: Fuzzy Inference
Two temperature Inputs (x, y) and one output (z) Membership functions:
low(t) = 1 ( t / 10 ); is o/p as function of i/phigh(t) = t / 10 ; is o/p as a fn. of i/p
Low High
1
0t
0.39 0.61
0.32
0.68
Low(x) = 0.68, High(x) = 0.32, Low(y) = 0.39, High(y) = 0.61Crisp Inputs
yx
CSE Dept., MBM Engg. Col., JNV Univ.
Create rule base
Rule 1: If x is low AND y is low Then z is high (i.e., if I/P x,y have membership of low, then the o/p z has membership of high. x and y are ANDed)
Rule 2: If x is low AND y is high Then z is low
Rule 3: If x is high AND y is low Then z is low
Rule 4: If x is high AND y is high Then z is high
X
YX Y Z
0 0 1
0 1 0
1 0 0
1 1 1
Z
Z = X ⊕ Y
CSE Dept., MBM Engg. Col., JNV Univ.
Inference step #1(conjunction part of composition)
Rule1: low(x)=0.68, low(y)=0.39 => high(z)=min(0.68,0.39)=0.39
Rule2: low(x)=0.68, high(y)=0.61 => low(z)=min(0.68,0.61)=0.61
Rule3: high(x)=0.32, low(y)=0.39 => low(z)=min(0.32,0.39)=0.32
Rule4: high(x)=0.32, high(y)=0.61 => high(z)=min(0.32,0.61)=0.32
Conjunction is performed of x and y.
CSE Dept., MBM Engg. Col., JNV Univ.
Inference step #2 (disjunction part of composition)
Low High1
0t
•Low(z) = max(rule2, rule3) = max(0.61, 0.32) = 0.61
•High(z) = max(rule1, rule4) = max(0.39, 0.32) = 0.39
0.61
0.39
Z low = .61
Z high =.39
CSE Dept., MBM Engg. Col., JNV Univ.
Fuzzy Resolution and other
Fuzzy De Morgans: ¬(F∧G) = ¬F∨¬G and ¬(F∨G) = ¬F ∧ ¬G
L∨C1, ¬L∨C2
C1∨C2
Fuzzy Resolution:
CSE Dept., MBM Engg. Col., JNV Univ.
Other operations on fuzzy sets
Concentration CON(A)={x/mA(x)2|x∈U}
Dilation DIL(A)={x/sqrt(mA(x) |x∈U}
Normalization NORM(A)={x/(mA(x)/Max) |x∈U}
CSE Dept., MBM Engg. Col., JNV Univ.
Operations on Fuzzy System
Crisp Input
Fuzzy Input
Fuzzy Output
Crisp Output
Fuzzification
Rule Evaluation
Defuzzification
Input Membership Functions
Rules / Inferences
Output Membership Functions
CSE Dept., MBM Engg. Col., JNV Univ.
In what areas are fuzzy systems effective and why?
Difficult cases where traditional techniques do not work
Used in fuzzy control of physical or chemical characteristics such as temperature, electric current, flow of liquid/gas, motion of machines, etc.
Fuzzy logic can be applied in fuzzy knowledge based systems, which uses fuzzy if then rules; fuzzy software engineering, that may incorporate fuzziness in programs and data; fuzzy databases that store and retrieve fuzzy information; fuzzy pattern recognition that deals with fuzzy visual or audio signals; applications to medicine, economics, and management problems that involve fuzzy information processing.
CSE Dept., MBM Engg. Col., JNV Univ.
In what areas are fuzzy systems effective and why?.. Fuzzy systems are useful for approximate reasoning where
mathematical model are hard to derive
It allows for decision making with estimated values under incomplete information
For hard systems, conventional non fuzzy systems are expensive and depend on mathematical approximation (e.g., linearization of nonlinear problems), which may lead to poor performance.
Response of fuzzy systems are smoother.
CSE Dept., MBM Engg. Col., JNV Univ.
Control System Based on rules of logic obtained from train
drivers so as to model real human decisions as closely as possible
Task: Controls the speed at which the train takes curves as well as the acceleration and braking systems of the train
CSE Dept., MBM Engg. Col., JNV Univ.
Control System…
This system is still not perfect; humans can do better because they can make decisions based on previous experience and anticipate the effects of their decisions
This led to use of fuzzy systems
CSE Dept., MBM Engg. Col., JNV Univ.
Decision Support: Predictive Fuzzy Control Can assess the results of a decision and determine if the
action should be taken
Has model of the motor and break to predict the next state of speed, stopping point, and running time input variables
Controller selects the best action based on the predicted states.
CSE Dept., MBM Engg. Col., JNV Univ.
Decision Support: Predictive Fuzzy Control…
The results of the fuzzy logic controller for the Sendai subway (Japan) are excellent!!
The train movement is smoother than most other trains
Even the skilled human operators who sometimes run the train cannot beat the automated system in terms of smoothness or accuracy of stopping
CSE Dept., MBM Engg. Col., JNV Univ.
Fuzzy Expert Systems Fuzzy expert system is a collection of membership
functions and rules that are used to reason about data. Usually, the rules in a fuzzy expert system have the
following form: “if x is low and y is high then z is medium”Classical: “if x and y then z “