Upload
pierce-george
View
218
Download
1
Tags:
Embed Size (px)
Citation preview
1
Chap 4: Fuzzy Expert SystemsPart 1
Asst. Prof. Dr. Sukanya PongsuparbDr. Srisupa Palakvangsa Na AyudhyaDr. Benjarath Pupacdi
SCCS451 Artificial IntelligenceWeek 9
2
Agenda
Traditional LogicWhat is Fuzzy Logic?Boolean Logic VS Fuzzy LogicWhat is Fuzzy Set?Linguistic Variable and HedgesOperations of Fuzzy SetsProperties of Fuzzy Sets
3
Logic
Is it hot or cold?Do you like playing crossword?Do you like Harry Potter or not?
ONE ZERO
Only two values
4
Represented Using Set
HOT
COLD
Do notLike
Harry
Like Harry
5
Digital gates
Only two inputs: zero and oneOnly two outputs: zero and one
6
What do you think of the AI midterm exam?
Definitely easyReally easyVery very easyVery easyEasyQuite easy
7
Doctors say…..
You could possibly have a cold.You are certainly have chicken pox.It is likely that you may have ไข้�หวั�ด 2009.
Someone says…..It is quite likely that I cannot go to a partyIt looks like it is going to rainI am certain that Mum will not like this bag
8
Which one is Monkey?
Which one is Human?
9
“Fuzzy” = Unclear
veryreally quite
more or lessvery very extremely
VAGUE & AMBIGUOUS
10
Fuzzy Logic
Unclear
The formal systematic study of the principles of valid inference and correct reasoning
a form of multi-valued logic derived from fuzzy set theory to deal with reasoning that is approximate rather than precise. (Wikipedia)
a theoretical system used in mathematics, computing and philosophy to deal with statements which are neither true nor false (dictionary.cambridge.org)
11
“Fuzzy logic” is not logic that is fuzzybut logic that is used to
describe fuzziness
12
“Fuzzy logic” is determined as a set of mathematical principles for knowledge
representation based on degrees of membership rather than on
crisp membership of classical binary logic
Zadeh 1965(Master of Fuzzy Logic)
13
Boolean Logic VS Fuzzy Logic
Boolean Logic Fuzzy LogicTwo – Valued Logic: Zero & One
Multi – Valued Logic
Sharp boundary(crisp)
Range of valuesDegree of memberships degree of truthModel senses of words
(a) Boolean Logic. (b) Multi-valued Logic.0 1 10 0.2 0.4 0.6 0.8 100 1 10
14
Degree of Membership
Fuzzy
Mark
John
Tom
Bob
Bill
1
1
1
0
0
1.00
1.00
0.98
0.82
0.78
Peter
Steven
Mike
David
Chris
Crisp
1
0
0
0
0
0.24
0.15
0.06
0.01
0.00
Name Height, cm
205
198
181
167
155
152
158
172
179
208
Who is tall?
Tall
Short
15
150 210170 180 190 200160
Height, cmDegree ofMembership
Tall Men
150 210180 190 200
1.0
0.0
0.2
0.4
0.6
0.8
160
Degree ofMembership
170
1.0
0.0
0.2
0.4
0.6
0.8
Height, cm
Fuzzy Sets
Crisp Sets
Let’s the graph.....
X = Universe of Discourse
Y = Membership Value
16
Classic Paradoxes of Logic
Q: Does the Cretan philosopher tell the truth when he asserts that “All Cretans always lie’?
Boolean Logic: This assertion contains a contradiction.Fuzzy Logic: The philosopher does and does not tell the
truth!
The barber of a village gives a hair cut only to those whodo not cut their hair themselves?Q: Who cuts the barber’s hair?Boolean Logic: This assertion contains a contradiction.Fuzzy Logic: The barber cuts and does not cut his own hair!
17
Set Representation
Use a concept of Set to represent the idea of classical set and fuzzy set
18
Classical (Crisp) Set
fA (x) called the characteristic function of APrinciple of Dichotomy: a classic set theory imposes a sharp boundary
fA(x): X {0, 1}, where
Ax
Axxf A if0,
if 1,)(
19
Fuzzy Set
A(x): X [0, 1]where
A(x) = 1 if x is totally in A;A(x) = 0 if x is not in A;0 < A(x) < 1 if x is partly in A.
A(x) : membership function of set Amembership value (0<= degree <=1): shows the degree of membershipBasic idea: an element belongs to a fuzzy set with a certain degree of membershipfuzzy set is a set with fuzzy boundaries
20
How to represent a fuzzy set in a computer?
1. Define the membership function2. Perform knowledge acquisition from…
1) Single expert2) Multiple experts
21
Example of Tall Man
1. Define the membership function: short, average, tall2. Knowledge Acquisition
1) Fuzzy Sets: short, average, tall2) Universe of Discourse (height): short, average, tall
22
Example of Tall Man (cont.)
150 210170 180 190 200160
Height, cmDegree ofMembership
Tall Men
150 210180 190 200
1.0
0.0
0.2
0.4
0.6
0.8
160
Degree ofMembership
Short Average ShortTall
170
1.0
0.0
0.2
0.4
0.6
0.8
Fuzzy Sets
Crisp Sets
Short Average
Tall
Tall
23
Example of Tall Man (cont.)
Fuzzy Subset A
Fuzziness
1
0Crisp Subset A Fuzziness x
X
(x)
Representation of crisp and fuzzy subset of X
24
Example of Tall Man (cont.)
Crisp SetLet X be the universe of discourse
X = {x1, x2, x3, x4, x5}
Let A be a crisp subset of X, A = {x2, x5}A can be described using a set of pair {(xi, A(xi)} where A(xi) is the membership function
A = { (x1,0), (x2,1), (x3,0), (x4,0), (x5,0) }
25
Example of Tall Man (cont.)
Fuzzy SetA can be a fuzzy subset of X if and only if,
A = { (x, A(x) } x Є X, A(x): X [0, 1]
it can be re-written as
A = {A(x1) / x1}, {A(x2) / x2}, ….., {A(xn) / xn}e.g.
Tall man = (0/180, 0.5/185, 1/190)Short man = (1/160, 0.5/165, 0/170)
26
Example of Tall Man (cont.)
Fuzzy sets must be represented as functions and then mapped the elements of the sets to their degree of membershipExamples of functions:-
SigmoidGaussianPi
In practice, most applications use linear fit functions (shown in Slide No. 20)
27
Typical Membership Functions
Sigmoid function
Gaussian function
Pi function
28
Membership Functions: Linear fit functions
Trapezoidal function
Triangular function
29
Membership Functions: Trapezoidal function
Triangular function
The trapezoidal curve is a function of a vector x, and depends on four scalar parameters a, b, c, and d, as given by
Trapezoidal function
30
Membership Functions: Triangular function
The triangular curve is a function of a vector x, and depends on three scalar parameters a, b, and c, as given by
Triangular function
31
How to convert “words” to the degree of membership?
Linguistic Variables & Hedges
32
Linguistic Variables
IF <antecedent> THEN <consequent>
valueobject valueobject
Examples:• IF wind is strong THEN sailing is good• IF speed is slow THEN stopping_distance is short• IF project_duration is long THEN completion_risk is high
Linguistic variable Linguistic value
* linguistic variable == fuzzy variable
33
Hedges
Andy quite likes Thai foodhedges
Mary looks very much like her mother
Jim has been to several attractions in Thailand
Hedges: terms that modify the shape of fuzzy sets e.g. very, somewhat, quite, more or less, and slightly
34
Hedges (cont.)
Hedges can modify verbs, adjectives, adverbs, or whole sentences. They are used as
All-purpose modifiers: very, quite, extremelyTruth-values: quite true, mostly falseProbabilities: likely, not very likelyQuantifiers: most, several, fewPossibilities: almost impossible, quite possible
35
Example: Fuzzy sets with the hedge “very”
Short
Very Tall
Short Tall
Degree ofMembership
150 210180 190 200
1.0
0.0
0.2
0.4
0.6
0.8
160 170
Height, cm
Average
TallVery Short Very Tall
A man who is 185 cm tall is a member of the tall men set with a degree of membership of 0.5. He is also a member of the very tall men set with a degree of 0.15.
36
Hedges (cont.)
There are two types of “hedges”:-Concentration
reduce the size of the fuzzy set e.g. very, very very, extremely, slightlydecrease the degree of membership
Dilationexpand the size of the fuzzy set e.g. more or less, somewhatIncrease the degree of the membership
IntensificationIntensifies the meaning of the whole sentence e.g. indeedIncrease the degree of the membership above 0.5 and decrease those below 0.5
37
Representation of hedges in fuzzy logicHedge Mathematical
Expression
A little
Slightly
Very
Extremely
Hedge MathematicalExpression Graphical Representation
[A ( x )]1.3
[A ( x )]1.7
[A ( x )]2
[A ( x )]3
Concentration
38
Representation of hedges in fuzzy logic (cont.)Hedge Mathematical
ExpressionHedge MathematicalExpression Graphical Representation
Very very
More or less
Indeed
Somewhat
2 [A ( x )]2
A ( x )
A ( x )
if 0 A 0.5
if 0.5 < A 1
1 2 [1 A ( x )]2
[A ( x )]4 Concentration
dilation
dilation
intensification
39
What can we do withthese formulas (?_?)
To expand or reduce the subset by modifying the degree of membership
40
Examples
If Alice has a 0.86 membership in the set of tall girls
the equation of “very” is..
A(x) of very = [A(x)]2
So Alice will have a [0.86]2 = 0.7396 membership in the set of very tall girls
41
Examples (cont.)
If Alice has a 0.86 membership in the set of tall girls
the equation of “very very” is..
A(x) of very very = [A(x) of very] 4 = [A(x)]4
So Alice will have a [0.86]4 = 0.5470 membership in the set of very very tall girls
42
Operations of fuzzy sets
The classical set theory developed in the late 19th century by Georg Cantor describes how crisp sets caninteract. These interactions are called operations:
- Complement- Containment- Intersection- Union
43
Complement
Complement is the opposite set of a given set e.g. if a set is X, the complement set is NOT X
Questions:-
Crisp Sets: Who does not belong to the set?
Fuzzy Sets: How much do elements not belong to the set?
44
Complement (cont.)
EquationA(x) = 1 A(x)
Exampletall man = (0/180, 0.25/182.5, 0.5/185, 0.75/187.5, 1/190)
NOTtall man = (1/180, 0.75/182.5, 0.5/185, 0.25/187.5, 0/190)
45
Containment
Containment: one set is the subset of another set
Questions:-
Crisp Sets: Which sets belong to which other sets?
Fuzzy Sets: Which sets belong to other sets?
46
Containment (cont.)
In crisp set, all elements of a subset entirely belong to a larger set i.e. the degree of membership is equal to 1.In fuzzy sets, each element can belong less to the subset than to the larger set.Example
tall man = (0/180, 0.25/182.5, 0.5/185, 0.75/187.5, 1/190)
verytall man = (0/180, 0.06/182.5, 0.25/185, 0.56/187.5, 1/190)
47
Intersection
Intersection: the area where sets overlapIn crisp sets, an element must belong to both sets In fuzzy sets, an element may partly belong to both sets with different memberships
Questions:-Crisp Sets: Which element belongs to both sets?
Fuzzy Sets: How much of the element is in both sets?
48
Intersection (cont.)
EquationAB(x) = min [A(x), B(x)] = A(x) B(x), where xX
tall man = (0/165, 0/175, 0.0/180, 0.25/182.5, 0.5/185, 1/190)averagetall man = (0/165, 1/175, 0.5/180, 0.25/182.5, 0.0/185, 0/190)
tall man average man = (0/165, 0/175, 0.0/180, 0.25/182.5, 0.0/185, 0/190)
49
Intersection (cont.)
50
Union
Union: the integration area of all setsIn crisp sets, an element can belong to either sets.In fuzzy sets, the union is the largest membership value of the element in either set.
Questions:-Crisp Sets: Which element belongs to either set?
Fuzzy Sets: How much of the element is in either set?
51
Union (cont.)
EquationAB(x) = max [A(x), B(x)] = A(x) B(x), where xX
tall man = (0/165, 0/175, 0.0/180, 0.25/182.5, 0.5/185, 1/190)averagetall man = (0/165, 1/175, 0.5/180, 0.25/182.5, 0.0/185, 0/190)
tall man average man = (0/165, 1/175, 0.5/180, 0.25/182.5, 0.5/185, 1/190)
52
Operations of fuzzy sets
Complement
0x
1
( x )
0x
1
Containment
0x
1
0x
1
A B
Not A
A
Intersection
0x
1
0x
A B
Union0
1
A BA B
0x
1
0x
1
B
A
B
A
( x )
( x )
( x )
53
Set Properties
The properties of set used in crisp sets can also be used in fuzzy setsFrequently used properties:-
CommutativityAssociativelyDistributivityIdempotencyIdentityInvolutionTransitivityDe Morgan’s Laws
54
Set Properties (cont.)
CommutativityA B = B A
AssociativelyA (B C) = (A B ) CA (B C) = (A B ) C
DistributivityA (B C) = (A B ) (A C)A (B C) = (A B ) (A C)
55
Set Properties (cont.)
IdempotencyA A = AA A = A
Identity A Ф = AA X = AA Ф = ФA X = X
where Ф is an empty set and X is a superset of A.
56
Set Properties (cont.)
Involution ( A) = A
Transitivity If (A B) ⊂ (B C) then A C⊂ ⊂
De Morgan’s LawsØ (A B) = A BØ (A B) = A B
57
How can we use theseconfusing stuff (?_?)
58
Example
Properties and hedges can be used to obtain a variety of fuzzy sets from the existing ones.Assume that we have a fuzzy set A of tall men, we can derive a fuzzy set of very tall man:-
Given fuzzy set A of tall men = A(x)
very tall men = [A(x)]2
NOT very tall men A(x) = 1 - [A(x)]2
59
Exercise
Givenfuzzy set A of raining day = A(x)fuzzy set B of cold day = B(x)
Derive a fuzzy set C of extremely cold and not raining dayDerive a fuzzy set D of not very very cold or slightly raining day