Tn2103 Knowledge Engineering & Expert System

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 48

TN2103 KNOWLEDGE

ENGINEERING & EXPERT SYSTEM

TOPIC 7
REASONING UNDER UNCERTAINTY:
FUZZY LOGIC
Table of Content
 What is Fuzzy Logic?
 Brief History of Fuzzy Logic
 Current Applications of Fuzzy Logic
 Overview of Fuzzy Logic
 Forming Fuzzy Set
 Fuzzy Set Representation
 Hedges
 Fuzzy Set Operations
 Fuzzy Inference
 Fuzzy Logic Controllers (FLC)
What is Fuzzy Logic?
 What is FUZZINESS?
 According to OXFORD DICTIONARY, FUZZY
means
Blurred, Fluffy, Frayed or Indistinct
 Fuzziness is deterministic uncertainty
 Fuzziness is concerned with the degree to which
events occur rather than the likelihood of their
occurrence (probability)
What is Fuzzy Logic?
 For example:
The degree to which a person is young is a fuzzy event rather
than a random event.

 Suppose you have been in a desert for a week without a


drink and you came upon a bottle A and B, marked with the
following information:

P(A belongs to a set of drinkable liquid) = 0.9


B in fuzzy set of drinkable liquid = 0.9

Which one would you choose?


What is Fuzzy Logic?
 Some unrealistic and realistic quotes:
Q: How was the weather like yesterday in San Fransisco?

A1: Oh! The temperature was -5.5 degrees centigrade


A2: Oh! It was really cold.

A1: You should start braking at 30% pedal level when


you are 10 m from the junction.
A2: You should start braking slowly when you are near
the junction.
What is Fuzzy Logic?
 Expert rely on common sense to solve problem.
 This type of knowledge exposed when expert describe
problem with vague terms.
 Example of vague terms:
 When it is really/quite hot ...
 If a person is very tall he is suitable for ...
 Only very small person can enter into that hole
 I am quite young
 Mr. Azizi drive his car moderately fast
 How can we represent and reason with vague terms in a
computer?
 Use FUZZY LOGIC!!
Brief History of Fuzzy Logic
1965 Seminal paper by Prof. Lotfi Zadeh on fuzzy sets
1966 Fuzzy Logic (P. Marinos Bell Labs)
1972 Fuzzy measures (M. Sugeno, TIT)
1974 Fuzzy Logic Control (E.H. Mamdani, London, Q. Mary)
1980 Control of Cement Kiln (F.L. Smidt, Denmark)
1987 Automatic Train Operation for Sendai Subway, Japan (Hitachi)
1988 Stock Trading Expert System (Yamaichi Security)
1989 LIFE (Lab. For Intl. Fuzzy Eng.) Japanese provides US70m on Fuzzy

Research
1989 First Fuzzy Logic air-conditioner
1990 First Fuzzy Logic washing machine
1990 Japanese companies develop fuzzy logic application in a big way
2000?
Current Applications of Fuzzy Logic
 Camera aiming for telecast of sporting events
 Expert system for assessment of stock exchange activities
 Efficient and stable control of car-engines
 Cruise control for automobiles
 Medicine technology: cancer diagnosis
 Recognition of hand-written symbols with pocket computers
 Automatic motor-control for vacuum cleaners
 Back light control for camcorders
 Single button control for washing machines
 Flight aids for helicopters
 Controlling of subway systems in order to improve driving comfort,
precision halting and power economy
 Improved fuel-consumption for automobiles
Current Applications of Fuzzy Logic
 Expert systems also utilised fuzzy logic since the domain is
often inherently fuzzy.
 Some examples:
 decision support systems
 financial planners
 diagnosing systems for determining soybean
pathology
 a meteorological expert system in China for
determining areas in which to establish rubber tree
orchards
Current Applications of Fuzzy Logic
THE SENDAI SUBWAY SYSTEM

 First Proposed in 1978


 Granted Permission to operate in 1986 after 300,000
simulations and 3,000 empty runs

 Improved stop position by 3X


 Reduced power setting by 2X
 Total power use reduced by 10%
 Hitachi granted contracts for Tokyo subway in 1991
Current Applications of Fuzzy Logic
AIR CONDITIONER

 Initial design in April 1988


 Simulation in Summer of 1998
 Production in October 1989

 Heating and Cooling times reduced by 5X


 Temperature Stability increased by 2X
 Total power savings of 24%
 Reduced number of sensor
Overview of Fuzzy Logic
 Study mathematical representation of fuzzy terms such as
old, tall, heavy etc.
 This term don’t have truth representation. i.e. truth or false
[0,1]
 But, have extended truth values to all real numbers in the
range of values 0 to 1.
 This real numbers are used to represent the possibility that a
given statement is true or false. (Possibility Theory)
 Example:
The possibility that a person 6ft tall is really tall is set to
0.9 i.e. (0.9) signify that it is very likely that the person
is tall.
Overview of Fuzzy Logic
 Zadeh (1965) extended the work and brought a collections
of valuables concepts for working with fuzzy terms called
Fuzzy Logic.

 Definition of Fuzzy Logic


A branch of logic that uses degrees of membership in sets
rather that a strict true/false membership
Overview of Fuzzy Logic
Linguistic Variables
 Fuzzy terms are called linguistic variables. (or fuzzy
variables)

Definition of Linguistic Variable


 Term used in our natural language to describe some concept
that usually has vague or fuzzy values
Overview of Fuzzy Logic
 Example of Linguistic Variables With Typical Values

Linguistic Variable Typical Values


Temperature hot, cold
Height short, medium, tall
Weight light, heavy
Speed slow, creeping, fast
Overview of Fuzzy Logic
 Possible numerical values of linguistic variables is called
UNIVERSE OF DISCOURSE.

Example:
 The Universe of Discourse for the linguistic variable speed
in R1 is in the range [0,100mph].

 Thus, the phrase “speed is slow” occupies a section of the


variable’s Universe of Discourse. - It is a fuzzy set. (slow)
Overview of Fuzzy Logic
Fuzzy Sets
 Traditional set theory views world as black and white.
 Example like set of young people i.e. children.
 A person is either a member or non-member. Member is
given value 1 and non-member 0; called Crisp set.
 Whereas, Fuzzy Logic interpret young people reasonably
using fuzzy set.

 HOW?
By assigning membership values between 0 and 1.
Overview of Fuzzy Logic
Example:
Consider young people (age <= 10).
If person age is 5 assign membership value 0.9
if 13, a value of 0.1

Age = linguistic variable


young = one of it fuzzy sets

Other fuzzy sets: old and middle age.


Overview of Fuzzy Logic
Definition: Fuzzy Sets
 Let X be the universe of discourse, with elements of X denoted as
x. A fuzzy set A is characterised by a membership A(x) that
associates each element x with degree of membership value in A.
 Probability theory relies on assigning probabilities to given event,
whereas Fuzzy logic relies on assigning values to given event x
using membership function:
A(x): X  [0,1]
 This value represent the degree (possibility) to which element x
belongs to fuzzy set A.
A(x) = Degree (x  A)
 Membership values is bounded by:
0  A(x)  1
Overview of Fuzzy Logic
Fig.1: Fuzzy and crisp sets of young people
Overview of Fuzzy Logic
Fuzzy versus crisp sets
Overview of Fuzzy Logic
Overview of Fuzzy Logic
Fuzzy rules represented in expert systems:

R1: IF Speed is slow


THEN make the acceleration high

R2: IF Temperature is low


AND pressure is medium
THEN Make the speed very slow

IF the water is very hot (temperature)


THEN add plenty of cold water (amount)
Fact: The water is moderately hot
Conclusion: Add a little cold water
Overview of Fuzzy Logic
The difference between classical and fuzzy rules:
 IF-THEN using binary logic:

R1: IF speed is > 100


THEN stopping distance is long
R2: IF speed is < 40
THEN stopping distance is short

 IF-THEN using fuzzy logic

R1: IF speed is fast


THEN stopping distance is long
R2: IF speed is slow
THEN stopping distance is short
Forming Fuzzy Set
 How to represent fuzzy set in computer??
 Need to define its membership function.
 One approach is:
Make a poll to a group of people is ask them of the fuzzy
term that we want to represent.
For example: The term tall person.
 What height of a given person is consider tall?
 Need to average out the results and use this function to
associate membership value to a given individual height.
 Can use the same method for other height description such
as short or medium.
Forming Fuzzy Set
Fig. 2: Fuzzy Sets on Height
Forming Fuzzy Set
 Multiple fuzzy sets on the same universe of discourse are
refers to as Fuzzy Subsets.
 Thus, membership value of a given object will be assigned
to each set. (refer to fig. 2)
 Individual with height 5.5 is a medium person with
membership value 1.
 At the same time member of short and tall person with
membership value 0.25.
 Single object is a partial member of multiple sets.
Exercise
a. Define some typical fuzzy variables
b. Define typical fuzzy sets for the fuzzy variables:
i. Temperature
ii. Weight
iii. Speed
c. Define the universe of discourse for fuzzy sets in (b).
d. Draw each fuzzy set defined in problem (b).
Fuzzy Set Representation
 How do we represent fuzzy set formally?
 Assume we have universe of discourse X and a fuzzy set A
defined on it.
X = {x1,x2,x3,x4,x5...xn}
 Fuzzy set A defines the membership function A(x) that maps
elements xi of X to degree of membership in [0,1].
A = {a1,a2,a3...an}
where
ai = A(xi)

 For clearer representation, includes symbol “/” which


associates membership value ai with xi:
A = {a1/x1,a2/x2....an/xn}
Fuzzy Set Representation
 Example: (refer fig. 2)
Consider Fuzzy set of tall, medium and short people:
TALL = {0/5, 0.25/5.5, 0.7/6, 1/6.5, 1/7}
MEDIUM = {0/4.5, 0.5/5, 1/5.5, 0.5/6, 0/6.5}
SHORT = { }
Hedges
 We have learn how to capture and representing vague
linguistic term using fuzzy set.
 In normal conversation, we add additional vagueness by
using adverbs such as:
very, slightly, or somewhat..
 What is adverb??
A word that modifies a verb, an adjective, another adverb,
or whole sentence.
 Example: Adverb modifying an adjective.
The person is very tall
Hedges
 How do we represent this new fuzzy set??
 Use a technique called HEDGES.
 A hedge modifies mathematically an existing fuzzy set to
account for some added adverb.
Hedges
Fig. 3: Fuzzy sets on height with ‘very’ hedge
Hedges Commonly Used in Practice
Concentration (Very)

 Further reducing the membership values of those element


that have smaller membership values.
CON(A) (x) = (A(x))2
 Given fuzzy set of tall persons, can create a new set of very
tall person.
 Example:
Tall = {0/5, 0.25/5.5, 0.76/6, 1/6.5, 1/7)
Very tall = { /5, /5.5, /6, /6.5, /7}
Hedges Commonly Used in Practice
Dilation (somewhat)

 Dilates the fuzzy elements by increasing the membership


values with small membership values more than elements
with high membership values.
DIL(A) (x) = (A(x))0.5

 Example:
Tall = {0/5, 0.25/5.5, 0.76/6, 1/6.5, 1/7}
somewhat tall = { /5, /5.5, /6, /6.5, /7}
Hedges Commonly Used in Practice
Intensification (Indeed)

 Intensifying the meaning of phrase by increasing the


membership values above 0.5 and decreasing those below 0.5.

INT(A) (x) = 2(A(x))2 for 0  A(x)  0.5


= 1 - 2(1 - A(x))2 for 0.5 < A(x)  1

 Example:
short = {1/5, 0.8/5.5, 0.5/6, 0.2/6.5, 0/7}
indeed short = { /5, /5.5, /6, /6.5, /7}
Hedges Commonly Used in Practice
Power (Very Very)

 Extension of the concentration operation.


POW(A) (x) = (A(x))n

 Example:
Create fuzzy set of very very tall person with n=3
Tall = {0/5, 0.25/5.5, 0.76/6, 1/6.5, 1/7}
Very very tall = { /5, /5.5, /6, /6.5, /7}
Fuzzy Set Operations
Intersection
 In classical set theory, intersection of 2 sets contains
elements common to both.
 In fuzzy sets, an element may be partially in both sets.
AB (X) = min (A(x), B(x))  x X
 Example:
Tall = {0/5, 0.2/5.5, 0.5/6, 0.8/6.5, 1/7}
Short = {1/5, 0.8/5.5, 0.5/6, 0.2/6.5, 0/7}
tall  short =
Tall and short can mean medium
Highest at the middle and lowest at both end.
Fuzzy Set Operations
Union
 Union of 2 sets is comprised of those elements that belong
to one or both sets.
AB (X) = max (A(x), B(x))  x  X
 Example:
Tall = {0/5, 0.2/5.5, 0.5/6, 0.8/6.5, 1/7}
Short = {1/5, 0.8/5.5, 0.5/6, 0.2/6.5, 0/7}
tall  short =

 Attains its highest vales at the limits and lowest at the


middle.
 Tall or short can mean not medium
Fuzzy Set Operations
Complementation (Not)

 Find complement ~A by using the following operation:


~A (x) = 1 - A(x)
 Example:
Short = {1/5, 0.8/5.5, 0.5/6, 0.2/6.5, 0/7}
Not short = { /5, /5.5, /6, /6.5, /7}
Fuzzy Inference
 Fuzzy proposition: a statement that assert a value for some
linguistic variable such as ‘height is tall’.

 Fuzzy Rule: Rule that refers to 1 or more fuzzy variable in


its conditions and single fuzzy variable in its conclusion.

 General form: IF X is A THEN Y is B

 Specific form: IF height is tall THEN weight is heavy

 Association of 2 fuzzy sets are store in matrix M called


Fuzzy Associative Memory (FAM)
Fuzzy Inference
 Rules are applied to fuzzy variables by a process called
propagation. (inference process).
 When applied, it looks for degree of membership in the
condition part and calculate degree of membership in the
conclusion part.
 Calculation depends upon connectives: AND, OR or NOT.
Fuzzy Inference
A fuzzy Logic program can be viewed as a 3 stage process:
1. Fuzzification
The crisp values input are assigned to the appropriate input fuzzy
variables and converted to the degree of membership.

2. Propagation (Inference)
Fuzzy rules are applied to the fuzzy variables where degrees of
membership computed in the condition part are propagated to the
fuzzy variables in the conclusion part. (max-min and max-
product inference)

3. De-fuzzification
The resultant degrees of membership for the fuzzy variables are
converted back into crisp values.
Fuzzy Inference
Fuzzy Inference (Example)
Assume 2 cars travelling the same speed along a straight road. The distance
between the cars becomes one of the factors for the second driver to brake his car
to avoid collision. The following rule might be used by the second driver:
IF the distance between cars is very small
AND the speed of car is high
THEN brake very hard for speed reduction.

IF distance between cars is slightly long


AND the speed of car is not too low
THEN brake moderately hard to reduce speed
Identify:
Linguistic variables:
Fuzzy subsets:
Connectives:
Hedges:
Fuzzy Logic Controllers (FLC)
 Fuzzy Logic Controllers are build up from 4 main
components:
a. Fuzzifier
b. Fuzzy inference engine
c. Defuzzifier
d. Rule base
Fuzzy Logic Controllers (FLC)
Exercise

You might also like