Professional Documents
Culture Documents
Part II
Dr S.Natarajan
Professor and Key Resource Person
Department of Information Science and Engineering
PES Institute of Technology
Bengaluru
natarajan@pes.edu
9945280225
CLASSICAL LOGIC AND FUZZY LOGIC
Part I Logic
●
Is perhaps the most powerful form of conveying
information.
●
Despite its vagueness and ambiguity it is the
vehicle for human communication, and it seems
appropriate that a mathematical theory that deals
with fuzziness and ambiguity is also the same
tool used to express and interpret the linguistic
character of our language. Natural language is
used in the expression of knowledge form
known as RULE BASED SYSTEMS
NATURAL LANGUAGE
●
Cognitive scientists tell us that human base
their thinking primarily on conceptual patterns
and mental images rather than on any
numerical quantities. In fact the expert system
paradigm known as “Frames” is based on the
notion of a cognitive picture in one's mind.
Furthermore, humans communicate with their
own natural language by referring to previous
mental images with rather vague but simple
terms. Despite the vagueness and ambiguity in
natural language, humans communicating in a
common language have very little trouble in
basic understanding.
●
since a vast amount of information involved in
human communication involves natural language
terms that, by their very nature, are often vague,
imprecise, ambiguous, and fuzzy, we will propose
the use of fuzzy sets as the mathematical
foundation of our natural language (NL).
●
NL consists of
- atomic terms :The fundamental terms.
Ex: slow, medium, young, beautiful etc.
- composite : a collection of of atomic terms or
set of terms.
Ex: very slow horse, heavy-weight female,
fairly beautiful painting, etc
Natural Language
The time interval x was the period exhibiting a 100 percent maximum of
possible values as measured along some arbitrary social scale, [and]
the interval x was the period of time exhibiting 100 percent minimum of
these values as measured along the same scale.
7
Knowledge & Mappings
• Knowledge is a collection of “facts” from
some domain.
• What we need is a representation of facts
that can be manipulated by a program.
– Some symbolic representation is necessary.
– Need to be able to map facts to symbols.
– Need to be able to map symbols to facts?
8
A.I. Problems & K.R.
• Game playing - need rules of the game,
strategy, heuristic function(s).
• Expert Systems - list of rules, methods to
extract new rules.
• Learning - the space of all things learnable
(domain representation), concept
representation.
• Natural Language - symbols, groupings,
semantic mappings, ...
9
Representation Properties
Representational Adequacy - Is it possible to
represent everything of interest ?
Inferential Adequacy - Can new information
be inferred?
Inferential Efficiency - How easy is it to infer
new knowledge?
Acquisitional Efficiency - How hard is it to
gather information (knowledge)?
10
Search and State Representation
• Each state could be represented as a
collection of facts.
• Keeping many such states in memory may
be impossible.
• Most facts will not change when we move
from one state to another.
11
The Frame Problem
• Determining how to best represent facts that
change from state to state along with those
facts that do not change is the Frame
Problem.
• Sometimes the hard part is determining
which facts change and which do not.
12
Fuzzy Rule-based systems
Using fuzzy sets as a calculus to interpret natural
language. It is vague, imprecise, ambiguous and fuzzy.
Fundamental terms atoms
Collection of atomic terms composite or set of terms
An atomic term (a linguistic variable) can be interpreted
using fuzzy sets.
An atomic term in the universe of natural language, X.
Define a fuzzy set A in the universe of interpretations or
~
meanings, Y as a specific meaning of .
13
Suppose we define a specific atomic term in the
universe of NL, X, as element a and we define
fuzzy set A in the universe of interpretations , or
meanings, Y, as a specific meaning for the term a.
then NL can be expressed as a mapping, M from a
set of atomic terms in X to a corresponding set of
interpretations defined on Y.
●
Each atomic term a in X corresponds to a fuzzy
set A in Y, which is the “interpretation” of a
Fuzzy Rule-based systems
A
~
X MA
~
~ Y
2 1
1 y 25
y 25
25
M youg y
~
1 y 25
15
Fuzzy Rule-based systems
Composite
or :
or y max y , y
and :
and y min y , y
Not : y 1 y
16
LINGUISTIC HEDGES
●
In linguistics, fundamental atomic terms are often
modified with adjectives (nouns) or
adverbs (verbs) .
like very, low, slight, almost, more-or-less, etc
●
Using fuzzy sets as the calculus of interpretation,
these linguistic hedges have the effect of
modifying the membership function for a basic
atomic term
Define a= ma(y)/y, then
y
●
“very” a = a2 =ʃ [μα(y)]2/y
●
“Very, very” a = a4
●
“plus” a=a1.25
●
“slightly” a =sqrt (a) = ʃ [ μα(y))]0.5/y
●
“minus” a = a0.75
●
The first three equations are called
“concentrations”
●
Another operation on linguistic fuzzy sets is
known as intensification.
●
Intensification can be expressed by numerous
algorithms, one of which, proposed by Zadeh, is
0 x 0 x
Intensification
of A
Concentration – reduces the degree of membership of the elements
which are “partly” in the set
Hedge “very” with membership of .9 reduced by 10 percent to a value
.81 – whereas, membership value of .1 is reduced by an order of
magnitude .01.
Decrease – Manifestation of the properties of the properties of the
membership value itself for 0 ≤µ ≤ 1 then µ >= µ2
Dilation- Stretch or dilate fuzzy set by increasing the membership
of elements that are ‘partly’ in the set
For the hedge ‘slightly’ membership value .81 is increased by 11% to
get 0.9 and the membership value of 0.01 is increased by an order
of magnitude to 0.1
21
Precedence for linguistic hedges
and logical operations
Precedence Operation
Second and
Third or
Linguistic Hedges
Very 2
y
2
y y
Very very 4
plus 1.25
1
Slightly 2
y
5
2
1
y y
Minus 0.75
2 2 y 0 y 0.5
Intensify It increases contrast.
1 21 y 2 0.5 y 1
23
Precedence of the Operations
Example:
Suppose we have a universe of integers, Y = {1,2,3,4,5}.
We define the following linguistic terms as a mapping onto
Y:
“small” = 1 .8 .6 .4 .2
1 2 3 4 5
“large” = .2 .4 .6 .8 .1
1 2 3 4 5
24
Example (contd)
25
Example (contd)
26
Rule-based systems
●
In the field of AI there are various ways to
represent knowledge.
IF premise (antecedent), THEN conclusion
(consequent)
●
Commonly referred to as the IF-THEN rule-based
form
●
The rule-based system is distinguished from
expert systems in the sense that the rules
comprising a rule-based system might derive from
sources other that human experts and, in this
context, are distinguished from expert systems.
Rule-based Systems
28
Canonical Rule Forms
●
Assignment statements
x = large
banana’s color = yellow
x approx= s
●
Conditional statements
IF the tomato is red THEN the tomato is ripe
IF x is very hot THEN stop
●
Unconditional statements
go to 9
stop
divide by x
turn the pressure higher
●
The rule base under consideration could be
described using a collection of conditional
restrictive statements. These statements may also
be modeled as fuzzy conditional statements, such
as
IF condition C1 THEN restriction R1.
●
The unconditional restrictions might be in the form
R1: The output is B1
AND
R2: The output is B2
AND
etc.
Where B1, B2, …. Are fuzzy consequents.
●
The canonical form for a fuzzy rule-based system
A x min A x , , A x
S 1 L
~ ~ ~
then y is B S
S 1 2 L
~
A A A A
~ ~ ~ ~
AS x max A1 x , , AL x
S S
IF A
~
THEN B
~
35
●
Multiple conjunctive antecedents
IF x is A1 and A2 … and AL THEN y is Bs
As = A1 n A2 n …n AL
mAs(x) = min [mA1(x), … , mAl(x)]
IF As THEN Bs
●
Multiple disjunctive antecedents
IF x is A1 or A2 … or AL THEN y is Bs
As = A1 U A2 U …U AL
mAs(x) = max [mA1(x), … , mAl(x)]
IF x is As THEN y is Bs
Condition Statements
1 2
1. IF A B ) decomposed into:
1
~
THEN ( B ELSE ~
1 1~ 1 2
IF A THEN B or IF NOT THENA B
~ ~ ~ ~
1
2. IF A
1 2
~ (THEN B ) unless A decomposed into:
~ ~
IF A1 THEN B1 or IF NOT THENANOT 2
B
1
~ ~ ~ ~
1 2
3. IF A A THEN ( B 2 )) decomposed into:
1
~
THEN ( B ELSE IF ~
1 1 ~ 1 ~ 2 2
IF A THEN B or IF NOT and A THENA NOT B
~ ~ ~ ~ ~
“likely” “very likely” “highly likely” “true” “fairly true” “very true”
“false” “fairly false” “very false”
x X
anything x 1
Let be a fuzzy truth value “very true” “true” “fairly true”
“fairly false” “false”
A truth qualification proposition can be expressed as:
“x is isA”
~
or
x is is A = A x
~ ~
A x 0. 5
~ 38
Aggregation of fuzzy rule
1 x2 = input(i)
(x2) = (x2 – input(i)) =
0 otherwise
40
Graphical Technique of Inference
41
“highly unlikely” = “minus very very unlikely” = “(very
very unlikely)0.75” = 1/0 + 1/.1 + 1/.2 + .5/.3 + .3/.4}
t: x is A is
true mA(xt) = .85
t: x is A is mA(a)
false 1
mA(xt) = .15
t: x is A is .96
fairly true .85
t: x is A is mA(xt) = .96
very false
.15
mA(xt) = .04
0 .85 1a
Aggregation of Fuzzy Rules
●
Conjunctive system of rules.
y = y1 and y2 and … and yr
Or
y = y1 ∩y2 ∩ … ∩ yr
Defined by my(y) = min (my1(y),…myr(y))
for y belongs to Y
●
Disjunctive system of rules
y = y1 or y2 or … or yr
Or
y = y 1 U y2 U … U y r
Defined by my(y) = max (my1(y), … my(r-1)(y), myr(y))
for y belongs to Y
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
Graphical Technique of Inference
Case 1 : CRISP SETS max-min
Graphical Technique of Inference
Case 2: CRISP SETS: Using max-product (or correlation product)
implication technique, aggregated output for r rules would be:
B k y max Ak input i Ak input j k 1,2, , r
~
k ~1 ~2
B k y max Ak input i Ak input j
~
k ~1 ~2
k 1,2, , r
Graphical Technique of Inference
Case 3: input(i) and input(j) are fuzzy variables
B k y max min max Ak x x1 , max Ak x x 2
~
~1 ~2
B k y max min max Ak x x1 , max Ak x x 2
~
~1 ~2
Graphical Technique of Inference
Case 4: input(I) and input(j) are fuzzy, inference using correlation
product
B k y max min max Ak x x1 max Ak x x 2
~
k
~1 ~2
69
70
Graphical Technique of Inference
Example: 1 1 1
A A
Rule 1: if x1 is ~ 1 and x2 is ~ 2 , then y is ~ B
2 2 2
Rule 2: if x1 is A~ 1 or x2 is A~ 2 , then y is B~
input(i) = 0.35 input(j) = 55
72
73
74
75
76
Summary
• Fuzzy Modelling – subjectivity blessing rather than a curse
Vagueness present in the definition of the terms is consistent with
the information contained in the conditional rules developed by
the Engineer when observing some complex process
• Set of linguistic variables and their meanings is compatible and
consistent with set of conditional rules used, the outcome of the
qualitative process is translated into objective and quantifiable
results
• Fuzzy mathematical tools and the calculus of fuzzy IF-THEN
rule provide a most useful paradigm for the automation and
implementation of an extensive body of human knowledge which are
not embodied in the quantitative modelling process
77
78
79
80
Operation of a fuzzy expert system:
October 2005 81
Fuzzy Expert Systems
Recap
Example: Air Conditioner
Example: Cart Pole Problem
Case Study: Building a Fuzzy Expert System
Summary
October 2005 82
Example: Air Conditioner
1a. Specify the problem
Air-conditioning involves the delivery of air, which can be
warmed or cooled and have its humidity raised or lowered.
An air-conditioner is an apparatus for controlling, especially
lowering, the temperature and humidity of an enclosed
space. An air-conditioner typically has a fan which
blows/cools/circulates fresh air and has a cooler. The cooler
is controlled by a thermostat. Generally, the amount of air
being compressed is proportional to the ambient
temperature.
October 2005 84
Example: Air Conditioner
2. Determine Fuzzy Sets: Temperature
1
0.9
0.8 Cold
Truth Value
0.7
0.6
Cool
Temperatu re Fuzzy Sets
Pleasent
1
0.5
0.9
0.8 Cold
0.7
0.6 Cool
0.5 Pleasent
0.4
Warm
Vu
ae
0.3
u
T
rh
t l
0.2 Hot
0.1
0
0 5 10 15 20 25 30
TemperatureDegrees C
0.4
0.3
Warm
0.2 Hot
0.1
0
0 5 10 15 20 25 30
Temperature Degrees C
October 2005 85
Example: Air Conditioner
2. Determine Fuzzy Sets: Fan Speed
Rev/sec MINIMAL SLOW MEDIUM FAST BLAST
(RPM)
0 Y* N N N N
10 Y N N N N
20 Y Y N N N
30 N Y* N N N
40 N Y N N N
50 N N Y* N N
60 N N N Y N
70 N N N Y* N
80 N N N Y Y
90 N N N N Y
100 N N N N Y*
October 2005 86
Example: Air Conditioner
2. Determine Fuzzy Sets: Fan Speed
Speed Fuzzy Sets
1
0.8 MINIMAL
Truth Value
0.6 SLOW
MEDIUM
0.4
FAST
0.2 BLAST
0
0 10 20 30 40 50 60 70 80 90 100
Speed
October 2005 87
Example: Air Conditioner
3. Elicit and construct fuzzy rules
October 2005 88
Example: Air Conditioner
3. Encode into an Expert System
4. Evaluate and tune the system
Consider a temperature of 16oC, use the system
to compute the optimal fan speed.
October 2005 89
Example: Air Conditioner
• Fuzzification
Affected fuzzy sets: COOL and PLEASANT
October 2005 90
Example: Air Conditioner
• Inference
October 2005 91
Example: Air Conditioner
• Inference
October 2005 93
Example: Air Conditioner
• Defuzzification
= 45.54rpm
October 2005 94
Fuzzy Expert Systems
Recap
Example: Air Conditioner
Example: Cart Pole Problem
Case Study: Building a Fuzzy Expert System
Summary
October 2005 95