Prepared by:
Bhaumikkumar P Parmar
Department of Computer Engineering
Government Engineering College, Modasa
Outline
 Fuzzy Logic
 Fuzzy Set
 Fuzzy Set & Classical Set
 Membership Function
 Fuzzy Set Operations
 Fuzzy Logic System
 Example
 Advantage
 disadvantages
 Application
Fuzzy Logic
 We talk about real world , our expression about real world , the
way we describe real world are not very precise.
 Ex. Height (short, medium, tall), temperature(very hot, hot,
cold).
 Fuzzy logic is logic which is not very precise.
 Normally in real world we deal with this imprecise way .
 Computation that involves logic of impreciseness is much more
powerful than computation that is being carried through a
precise manner.
Fuzzy Logic
• Since we use imprecise data in our communication language,
then it must be associated with some logic.
• The father of fuzzy logic is Lotfi Zadeh from U C Berkeley in
1965, he pioneered research in fuzzy logic.
• The logic which can manipulate imprecise data is Fuzzy Logic.
• Fuzzy Logic has been applied to many fields , from control
theory to artificial intelligence.
Fuzzy set
• Classical Set : A={a1,a2,a3,a4…,an}
• Set A can be represented by Characteristic function.
μa(x)={ 1 if element x belongs to the set A
0 otherwise }
• Ex. A={ 1,2,3,4,5,6,7,8,9,10}.
• Fuzzy Set: A={{ x, μa(x) }}
where, μa(x) is the membership grade of a element x in fuzzyset
μa(x)=[0,1]
• Ex. Set of all tall people.
A={{5.9,0.4},{6.0,0.7},{6.1,0.9}}
Fuzzy set & Classical set
• Consider universal set T which stands for tempratute.
• Cold , Normal , Hot are the subset of universal set T.
• Classical Set (Crisp set)
• Cold={ temp ∈ T : 5° C < temp < 15° C }
• Normal={temp ∈ T : 15° C < temp < 25° C }
• Hot={temp ∈ T : 25° 𝐶 < 𝑡𝑒𝑚𝑝 < 35° 𝐶 }
• 14.9 ° C is Cold while 15.1 ° C is Normal .
• This shows that classical set have very rigid boundries.
Fuzzy set & Classical set
• In Contrast Fuzzy Set have soft boundary .
• cold normal hot
• 𝜇𝑥 1
•
• 0.5
• 5 10 15 20 25 30 35 40
• temp (°𝐶)
• The temprature 15° C is a member of two fuzzy sets , cold and
normal with a membership grade
• 𝜇𝑥(Cold)= 𝜇𝑥(Normal) = 0.5
Membership Function
• A member function is a function that defines degree of an
element’s membership in fuzzy set.
adult(x)= { 0, if age(x) < 16years
(age(x)-16years)/4, if 16years < = age(x)< = 20years,
1, if age(x) > 20years }
Membership Function
There are different form of membership function.
Linguistic Variable
 Linguistic variables are the input or output variables of the
system whose values are words or sentences from a natural
language, instead of numerical values. A linguistic variable
is generally decomposed into a set of linguistic terms.
 Ex . For air conditioner , temperature is linguistic variable.
 Temperature can quantify into too-cold, cold, warm, hot.
 They are the linguistic terms.
 They cover a portion of overall values of Temperature
Fuzzy Set Operations
• Let us consider two fuzzy sets
• A={
0
1
,
1
2
,
0.5
3
,
0.3
4
,
0.2
5
} and B={
0
1
,
0.5
2
,
0.7
3
,
0.2
4
,
0.4
5
}
• We can evaluate different fuzzy operation.
• Union: A∪ 𝐵 = max{ μ𝐴 𝑥 , μ𝐵 𝑥 }
= {
0
1
,
1
2
,
0.7
3
,
0.3
4
,
0.4
5
}
• Intersection: A∩ 𝐵 = m𝑖𝑛{ μ𝐴 𝑥 , μ𝐵 𝑥 }
= {
0
1
,
0.5
2
,
0.5
3
,
0.2
4
,
0.2
5
}
Fuzzy Set Operations
• Let us consider two fuzzy sets
• A={
0
1
,
1
2
,
0.5
3
,
0.3
4
,
0.2
5
} and B={
0
1
,
0.5
2
,
0.7
3
,
0.2
4
,
0.4
5
}
• We can evaluate different fuzzy operation.
• Complement: ¬𝐴 = 1 − μ𝐴 𝑥 = {
1
1
,
0
2
,
0.5
3
,
0.7
4
,
0.8
5
}
• Difference : A|B = 𝐴 ∩ ¬𝐵
= {
0
1
,
1
2
,
0.5
3
,
0.3
4
,
0.2
5
} ∩ {
1
1
,
0.5
2
,
0.3
3
,
0.8
4
,
0.6
5
}
= {
0
1
,
0.5
2
,
0.3
3
,
0.3
4
,
0.2
5
}
Fuzzy Set & Probabilities
• The values attached to properties in fuzzy logic are in some
ways like probabilities, but it is clearly not probabilities that
we are dealing with here.
• We may know Jack's height exactly. The assertion ‘Jack is
tall (0.75)’ measures how well Jack’s height matches the
sense of the word ‘tall’.
• On the other hand, ‘the probability that Jack is tall is 0.75’
would normally be used in a situation where we don't
actually know Jack's height.
Fuzzy Logic System
Fuzzy Logic System
• The rule base and database are jointly referred to as
knowledge base.
• A rule base containing a number of fuzzy IF-THEN rules;
• A database which defines the membership functions of
fuzzy sets used in fuzzy rules.
• fuzzification: converts crisp input to a linguistic variable
using membership function stored in fuzzy knowledge
base.
• Inference engine: using If-Then type fuzzy rules converts
the fuzzy input to fuzzy out
• Defuzzification: Converts the fuzzy output of the inference
engine to crisp using membership functions analogous to
the ones used by the fuzzifier.
Example
To estimate the level of risk in project.
 For the sake of simplicity we will arrive at our conclusion
based on two inputs: project funding and project staffing.
 Suppose our our inputs are project_funding =
26% and project_staffing = 54%.
 Find risk percentage.
Example
1)Define linguistic variables and terms.
For Input:-
For Project funding : inadequate, marginal , adequate
For Project staffing : small , large
For Output:-
For Project risk :low , normal , high.
Example
2)Construct membership function.
Input output
Example
3)Construct the rule base .
 If project funding is adequate or project staffing is small
then risk is low.
 If project funding is marginal and project staffing is large
then risk is normal.
 If project funding is inadequate then risk is high.
Example
4)Convert crisp input data to fuzzy values.(fuzzification)
Project funding=26% .
Inadequate =0.4
marginal=0.2
adequate=0.0
Project staffing=54%
small=0.2
Large=0.7
Example
5)Evaluate the rule in rule base (inference)
 If project funding is adequate or project staffing is small then risk
is low.
adequate(Project funding) ∨ small(Project staffing) ⇒ low(risk)
0.0 ∨ 0.2 ⇒ 0.2 low = 0.2
 If project funding is marginal and project staffing is large then
risk is normal.
marginal(Project funding) ∧ large(Project staffing) ⇒ normal(risk)
0.2 ∧ 0.7 ⇒ 0.2 normal = 0.2
Example
5)Evaluate the rule in rule base (inference) (continue)
 If project funding is inadequate then risk is high.
inadequate(Project funding) = high(risk)
inadequate(Project funding)=0.4
high =0.4
• so for risk : low =0.2 , normal =0.2 , high=0.4
Example
6)Convert the output data to non-fuzzy values(defuzzification).
centroid method :
cog=(((0+10+20)*0.2)+((30+40+50+60)*0.2)+((70+80+90+100)*0.4))
((3*0.2)+(4*0.2)+(4*0.4))
cog=58.666667%
Risk=58.67%
Example
Advantage
 Mathematical concepts within fuzzy reasoning are very
simple.
 You can modify a FLS by just adding or deleting rules due to
flexibility of fuzzy logic.
 Fuzzy logic Systems can take imprecise, distorted, noisy
input information.
 FLSs are easy to construct and understand.
 Fuzzy logic is a solution to complex problems in all fields of
life, including medicine, as it resembles human reasoning
and decision making.
Disadvantage
 There is no systematic approach to fuzzy system designing.
 They are understandable only when simple.
 They are suitable for the problems which do not need high
accuracy.
 Requires tuning of membership functions.
Fuzzy Application
• Many of the early successful applications of fuzzy logic were
implemented in Japan.
• The first notable application was on the high-speed train
in Sendai, in which fuzzy logic was able to improve the
economy, comfort, and precision of the ride.
• recognition of hand written symbols in Sony pocket
computers,
• flight aid for helicopters,
• In vehicle used as antilock brake system .
• single-button control for washing machines,
• As temperature controllers in Air conditioners,
Refrigerators.
Bibliography
BOOK :
Artificial Intelligence by Elaine Rich, Kelvin Knight and
Shivashankar B Nair.
WEBSITES :
•http://www.seattlerobotics.org/encoder/mar98/fuz/flindex.html
https://www.tutorialspoint.com/artificial_intelligence/artificial_int
elligence_fuzzy_logic_systems.htm
• http://en.wikipedia.org/wiki/Fuzzy_logic
• http://www.dementia.org/~julied/logic/index.html
• http://mathematica.ludibunda.ch/fuzzy-logic.html
Thank You

Fuzzy Logic Seminar with Implementation

  • 1.
    Prepared by: Bhaumikkumar PParmar Department of Computer Engineering Government Engineering College, Modasa
  • 2.
    Outline  Fuzzy Logic Fuzzy Set  Fuzzy Set & Classical Set  Membership Function  Fuzzy Set Operations  Fuzzy Logic System  Example  Advantage  disadvantages  Application
  • 3.
    Fuzzy Logic  Wetalk about real world , our expression about real world , the way we describe real world are not very precise.  Ex. Height (short, medium, tall), temperature(very hot, hot, cold).  Fuzzy logic is logic which is not very precise.  Normally in real world we deal with this imprecise way .  Computation that involves logic of impreciseness is much more powerful than computation that is being carried through a precise manner.
  • 4.
    Fuzzy Logic • Sincewe use imprecise data in our communication language, then it must be associated with some logic. • The father of fuzzy logic is Lotfi Zadeh from U C Berkeley in 1965, he pioneered research in fuzzy logic. • The logic which can manipulate imprecise data is Fuzzy Logic. • Fuzzy Logic has been applied to many fields , from control theory to artificial intelligence.
  • 5.
    Fuzzy set • ClassicalSet : A={a1,a2,a3,a4…,an} • Set A can be represented by Characteristic function. μa(x)={ 1 if element x belongs to the set A 0 otherwise } • Ex. A={ 1,2,3,4,5,6,7,8,9,10}. • Fuzzy Set: A={{ x, μa(x) }} where, μa(x) is the membership grade of a element x in fuzzyset μa(x)=[0,1] • Ex. Set of all tall people. A={{5.9,0.4},{6.0,0.7},{6.1,0.9}}
  • 6.
    Fuzzy set &Classical set • Consider universal set T which stands for tempratute. • Cold , Normal , Hot are the subset of universal set T. • Classical Set (Crisp set) • Cold={ temp ∈ T : 5° C < temp < 15° C } • Normal={temp ∈ T : 15° C < temp < 25° C } • Hot={temp ∈ T : 25° 𝐶 < 𝑡𝑒𝑚𝑝 < 35° 𝐶 } • 14.9 ° C is Cold while 15.1 ° C is Normal . • This shows that classical set have very rigid boundries.
  • 7.
    Fuzzy set &Classical set • In Contrast Fuzzy Set have soft boundary . • cold normal hot • 𝜇𝑥 1 • • 0.5 • 5 10 15 20 25 30 35 40 • temp (°𝐶) • The temprature 15° C is a member of two fuzzy sets , cold and normal with a membership grade • 𝜇𝑥(Cold)= 𝜇𝑥(Normal) = 0.5
  • 8.
    Membership Function • Amember function is a function that defines degree of an element’s membership in fuzzy set. adult(x)= { 0, if age(x) < 16years (age(x)-16years)/4, if 16years < = age(x)< = 20years, 1, if age(x) > 20years }
  • 9.
    Membership Function There aredifferent form of membership function.
  • 10.
    Linguistic Variable  Linguisticvariables are the input or output variables of the system whose values are words or sentences from a natural language, instead of numerical values. A linguistic variable is generally decomposed into a set of linguistic terms.  Ex . For air conditioner , temperature is linguistic variable.  Temperature can quantify into too-cold, cold, warm, hot.  They are the linguistic terms.  They cover a portion of overall values of Temperature
  • 11.
    Fuzzy Set Operations •Let us consider two fuzzy sets • A={ 0 1 , 1 2 , 0.5 3 , 0.3 4 , 0.2 5 } and B={ 0 1 , 0.5 2 , 0.7 3 , 0.2 4 , 0.4 5 } • We can evaluate different fuzzy operation. • Union: A∪ 𝐵 = max{ μ𝐴 𝑥 , μ𝐵 𝑥 } = { 0 1 , 1 2 , 0.7 3 , 0.3 4 , 0.4 5 } • Intersection: A∩ 𝐵 = m𝑖𝑛{ μ𝐴 𝑥 , μ𝐵 𝑥 } = { 0 1 , 0.5 2 , 0.5 3 , 0.2 4 , 0.2 5 }
  • 12.
    Fuzzy Set Operations •Let us consider two fuzzy sets • A={ 0 1 , 1 2 , 0.5 3 , 0.3 4 , 0.2 5 } and B={ 0 1 , 0.5 2 , 0.7 3 , 0.2 4 , 0.4 5 } • We can evaluate different fuzzy operation. • Complement: ¬𝐴 = 1 − μ𝐴 𝑥 = { 1 1 , 0 2 , 0.5 3 , 0.7 4 , 0.8 5 } • Difference : A|B = 𝐴 ∩ ¬𝐵 = { 0 1 , 1 2 , 0.5 3 , 0.3 4 , 0.2 5 } ∩ { 1 1 , 0.5 2 , 0.3 3 , 0.8 4 , 0.6 5 } = { 0 1 , 0.5 2 , 0.3 3 , 0.3 4 , 0.2 5 }
  • 13.
    Fuzzy Set &Probabilities • The values attached to properties in fuzzy logic are in some ways like probabilities, but it is clearly not probabilities that we are dealing with here. • We may know Jack's height exactly. The assertion ‘Jack is tall (0.75)’ measures how well Jack’s height matches the sense of the word ‘tall’. • On the other hand, ‘the probability that Jack is tall is 0.75’ would normally be used in a situation where we don't actually know Jack's height.
  • 14.
  • 15.
    Fuzzy Logic System •The rule base and database are jointly referred to as knowledge base. • A rule base containing a number of fuzzy IF-THEN rules; • A database which defines the membership functions of fuzzy sets used in fuzzy rules. • fuzzification: converts crisp input to a linguistic variable using membership function stored in fuzzy knowledge base. • Inference engine: using If-Then type fuzzy rules converts the fuzzy input to fuzzy out • Defuzzification: Converts the fuzzy output of the inference engine to crisp using membership functions analogous to the ones used by the fuzzifier.
  • 16.
    Example To estimate thelevel of risk in project.  For the sake of simplicity we will arrive at our conclusion based on two inputs: project funding and project staffing.  Suppose our our inputs are project_funding = 26% and project_staffing = 54%.  Find risk percentage.
  • 17.
    Example 1)Define linguistic variablesand terms. For Input:- For Project funding : inadequate, marginal , adequate For Project staffing : small , large For Output:- For Project risk :low , normal , high.
  • 18.
  • 19.
    Example 3)Construct the rulebase .  If project funding is adequate or project staffing is small then risk is low.  If project funding is marginal and project staffing is large then risk is normal.  If project funding is inadequate then risk is high.
  • 20.
    Example 4)Convert crisp inputdata to fuzzy values.(fuzzification) Project funding=26% . Inadequate =0.4 marginal=0.2 adequate=0.0 Project staffing=54% small=0.2 Large=0.7
  • 21.
    Example 5)Evaluate the rulein rule base (inference)  If project funding is adequate or project staffing is small then risk is low. adequate(Project funding) ∨ small(Project staffing) ⇒ low(risk) 0.0 ∨ 0.2 ⇒ 0.2 low = 0.2  If project funding is marginal and project staffing is large then risk is normal. marginal(Project funding) ∧ large(Project staffing) ⇒ normal(risk) 0.2 ∧ 0.7 ⇒ 0.2 normal = 0.2
  • 22.
    Example 5)Evaluate the rulein rule base (inference) (continue)  If project funding is inadequate then risk is high. inadequate(Project funding) = high(risk) inadequate(Project funding)=0.4 high =0.4 • so for risk : low =0.2 , normal =0.2 , high=0.4
  • 24.
    Example 6)Convert the outputdata to non-fuzzy values(defuzzification). centroid method : cog=(((0+10+20)*0.2)+((30+40+50+60)*0.2)+((70+80+90+100)*0.4)) ((3*0.2)+(4*0.2)+(4*0.4)) cog=58.666667% Risk=58.67%
  • 25.
  • 26.
    Advantage  Mathematical conceptswithin fuzzy reasoning are very simple.  You can modify a FLS by just adding or deleting rules due to flexibility of fuzzy logic.  Fuzzy logic Systems can take imprecise, distorted, noisy input information.  FLSs are easy to construct and understand.  Fuzzy logic is a solution to complex problems in all fields of life, including medicine, as it resembles human reasoning and decision making.
  • 27.
    Disadvantage  There isno systematic approach to fuzzy system designing.  They are understandable only when simple.  They are suitable for the problems which do not need high accuracy.  Requires tuning of membership functions.
  • 28.
    Fuzzy Application • Manyof the early successful applications of fuzzy logic were implemented in Japan. • The first notable application was on the high-speed train in Sendai, in which fuzzy logic was able to improve the economy, comfort, and precision of the ride. • recognition of hand written symbols in Sony pocket computers, • flight aid for helicopters, • In vehicle used as antilock brake system . • single-button control for washing machines, • As temperature controllers in Air conditioners, Refrigerators.
  • 29.
    Bibliography BOOK : Artificial Intelligenceby Elaine Rich, Kelvin Knight and Shivashankar B Nair. WEBSITES : •http://www.seattlerobotics.org/encoder/mar98/fuz/flindex.html https://www.tutorialspoint.com/artificial_intelligence/artificial_int elligence_fuzzy_logic_systems.htm • http://en.wikipedia.org/wiki/Fuzzy_logic • http://www.dementia.org/~julied/logic/index.html • http://mathematica.ludibunda.ch/fuzzy-logic.html
  • 30.