Introduction to Fuzzy Logicweb.fsktm.um.edu.my/~cschan/doc/IJCAI2.pdf · Introduction to Fuzzy...

53
Introduction to Fuzzy Logic IJCAI2018 Tutorial 1

Transcript of Introduction to Fuzzy Logicweb.fsktm.um.edu.my/~cschan/doc/IJCAI2.pdf · Introduction to Fuzzy...

Page 1: Introduction to Fuzzy Logicweb.fsktm.um.edu.my/~cschan/doc/IJCAI2.pdf · Introduction to Fuzzy Logic IJCAI2018 Tutorial 1. Crisp set vs. Fuzzy set A traditional crisp set A fuzzy

Introduction to Fuzzy Logic

IJCAI2018Tutorial

1

Page 2: Introduction to Fuzzy Logicweb.fsktm.um.edu.my/~cschan/doc/IJCAI2.pdf · Introduction to Fuzzy Logic IJCAI2018 Tutorial 1. Crisp set vs. Fuzzy set A traditional crisp set A fuzzy

Crisp set vs. Fuzzy set

A traditional crisp set A fuzzy set

2

Page 3: Introduction to Fuzzy Logicweb.fsktm.um.edu.my/~cschan/doc/IJCAI2.pdf · Introduction to Fuzzy Logic IJCAI2018 Tutorial 1. Crisp set vs. Fuzzy set A traditional crisp set A fuzzy

Crisp set vs. Fuzzy set

3

Page 4: Introduction to Fuzzy Logicweb.fsktm.um.edu.my/~cschan/doc/IJCAI2.pdf · Introduction to Fuzzy Logic IJCAI2018 Tutorial 1. Crisp set vs. Fuzzy set A traditional crisp set A fuzzy

Crisp Logic Example I• Crisp logic is concerned with absolutes-true 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– Temperature = 80.1F– Temperature = 79.9F– Temperature = 50F

Not hotNot hot

HotHot

4

Page 5: Introduction to Fuzzy Logicweb.fsktm.um.edu.my/~cschan/doc/IJCAI2.pdf · Introduction to Fuzzy Logic IJCAI2018 Tutorial 1. Crisp set vs. Fuzzy set A traditional crisp set A fuzzy

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

Crisp Logic Example I cont.

5

Page 6: Introduction to Fuzzy Logicweb.fsktm.um.edu.my/~cschan/doc/IJCAI2.pdf · Introduction to Fuzzy Logic IJCAI2018 Tutorial 1. Crisp set vs. Fuzzy set A traditional crisp set A fuzzy

Example II : Crisp set

height0

1

5ft 11ins 7ft0height

0

1

5ft 11ins 7ft

A crisp way of modelling tallness

A crisp version of short

6

Page 7: Introduction to Fuzzy Logicweb.fsktm.um.edu.my/~cschan/doc/IJCAI2.pdf · Introduction to Fuzzy Logic IJCAI2018 Tutorial 1. Crisp set vs. Fuzzy set A traditional crisp set A fuzzy

height0

1

5ft 11ins 7ft

crisp definitions for tallness

tall

very tallquite tall

Example II : Crisp set

7

Page 8: Introduction to Fuzzy Logicweb.fsktm.um.edu.my/~cschan/doc/IJCAI2.pdf · Introduction to Fuzzy Logic IJCAI2018 Tutorial 1. Crisp set vs. Fuzzy set A traditional crisp set A fuzzy

0

1

height

Example II : Fuzzy set

8

Page 9: Introduction to Fuzzy Logicweb.fsktm.um.edu.my/~cschan/doc/IJCAI2.pdf · Introduction to Fuzzy Logic IJCAI2018 Tutorial 1. Crisp set vs. Fuzzy set A traditional crisp set A fuzzy

Example II : Fuzzy set

0

1

height5ft 11ins 7 ft

A possible fuzzy set tall

9

Page 10: Introduction to Fuzzy Logicweb.fsktm.um.edu.my/~cschan/doc/IJCAI2.pdf · Introduction to Fuzzy Logic IJCAI2018 Tutorial 1. Crisp set vs. Fuzzy set A traditional crisp set A fuzzy

Example II : Fuzzy set

0

1

height5ft 11ins 7 ft

A possible fuzzy set short

10

Page 11: Introduction to Fuzzy Logicweb.fsktm.um.edu.my/~cschan/doc/IJCAI2.pdf · Introduction to Fuzzy Logic IJCAI2018 Tutorial 1. Crisp set vs. Fuzzy set A traditional crisp set A fuzzy

Example II : Fuzzy set

0

1

height5ft 11ins 7 ft

Membership functions that represent tallness and short

short tall

0.40

0.75

11

Page 12: Introduction to Fuzzy Logicweb.fsktm.um.edu.my/~cschan/doc/IJCAI2.pdf · Introduction to Fuzzy Logic IJCAI2018 Tutorial 1. Crisp set vs. Fuzzy set A traditional crisp set A fuzzy

Fuzzy Sets• Fuzzy sets is fully defined by its membership

functions.• Membership function is a function in [0,1]

that represents the degree of belonging.

Age25 40 55

Young Old1 Middle

0.5

DOM

Degree of Membership

Fuzzy values

0

12

Page 13: Introduction to Fuzzy Logicweb.fsktm.um.edu.my/~cschan/doc/IJCAI2.pdf · Introduction to Fuzzy Logic IJCAI2018 Tutorial 1. Crisp set vs. Fuzzy set A traditional crisp set A fuzzy

Some maths! Formal definitions of a fuzzy set

• For any fuzzy set, (let’s say) A, the function µArepresents the membership function for which µA(x) indicates the degree of membership that x, of the universal set X, belongs to set A and is, usually, expressed as a number between 0 and 1

µA(x) : X [0,1]• Fuzzy sets can be either discrete or continuous

13

Page 14: Introduction to Fuzzy Logicweb.fsktm.um.edu.my/~cschan/doc/IJCAI2.pdf · Introduction to Fuzzy Logic IJCAI2018 Tutorial 1. Crisp set vs. Fuzzy set A traditional crisp set A fuzzy

• The notation for fuzzy sets: for the member, x, of a discrete set with membership µ, we use the notation µ/x . In other words, x is a member of the set to degree µ.

• Discrete sets are defined as:

A = µ1 /x1+µ2/x2+…..+µn/xn

• or (in a more compact form)

x1 ,x2 , ….. xn : members of the set Aµ1, µ2,…..µn : x1 , x2 ….. xn ’s degree of membership.

14

Page 15: Introduction to Fuzzy Logicweb.fsktm.um.edu.my/~cschan/doc/IJCAI2.pdf · Introduction to Fuzzy Logic IJCAI2018 Tutorial 1. Crisp set vs. Fuzzy set A traditional crisp set A fuzzy

• A continuous fuzzy set A can be defined as:

Example:Discrete and Continuous fuzzy sets to represent the set of numbers “close to 1”

numbers

µ

15

Page 16: Introduction to Fuzzy Logicweb.fsktm.um.edu.my/~cschan/doc/IJCAI2.pdf · Introduction to Fuzzy Logic IJCAI2018 Tutorial 1. Crisp set vs. Fuzzy set A traditional crisp set A fuzzy

• Example: describing people as “young”, “middle-aged”, and “old”

• Fuzzy Logic allows modelling of linguistic terms using linguistic variables and linguistic values. The fuzzy sets “young”, “middle-aged”, and “old” are fully defined by their membership functions. The linguistic variable “Age” can then take linguistic values.

Age0

1 youngMiddle-aged

old

µ

16

Page 17: Introduction to Fuzzy Logicweb.fsktm.um.edu.my/~cschan/doc/IJCAI2.pdf · Introduction to Fuzzy Logic IJCAI2018 Tutorial 1. Crisp set vs. Fuzzy set A traditional crisp set A fuzzy

• Key Points for a fuzzy set:– The members of a fuzzy set are members to some

degree, known as a membership grade or degree of membership

– A fuzzy set is fully determined by the membership function

– The membership grade is the degree of belonging to the fuzzy set. The larger the number (in [0,1]) the more the degree of belonging.

– The translation from x to µA(x) is known as fuzzification

– A fuzzy set is either continuous or discrete.– Fuzzy sets are NOT probabilities– Graphical representation of membership functions

is very useful.

17

Page 18: Introduction to Fuzzy Logicweb.fsktm.um.edu.my/~cschan/doc/IJCAI2.pdf · Introduction to Fuzzy Logic IJCAI2018 Tutorial 1. Crisp set vs. Fuzzy set A traditional crisp set A fuzzy

Fuzzy Sets

18

Page 19: Introduction to Fuzzy Logicweb.fsktm.um.edu.my/~cschan/doc/IJCAI2.pdf · Introduction to Fuzzy Logic IJCAI2018 Tutorial 1. Crisp set vs. Fuzzy set A traditional crisp set A fuzzy

Fuzzy Sets – definition

19

Page 20: Introduction to Fuzzy Logicweb.fsktm.um.edu.my/~cschan/doc/IJCAI2.pdf · Introduction to Fuzzy Logic IJCAI2018 Tutorial 1. Crisp set vs. Fuzzy set A traditional crisp set A fuzzy

Membership Degree

20

Page 21: Introduction to Fuzzy Logicweb.fsktm.um.edu.my/~cschan/doc/IJCAI2.pdf · Introduction to Fuzzy Logic IJCAI2018 Tutorial 1. Crisp set vs. Fuzzy set A traditional crisp set A fuzzy

Fuzzy Sets Representation I

21

Page 22: Introduction to Fuzzy Logicweb.fsktm.um.edu.my/~cschan/doc/IJCAI2.pdf · Introduction to Fuzzy Logic IJCAI2018 Tutorial 1. Crisp set vs. Fuzzy set A traditional crisp set A fuzzy

Fuzzy Sets Representation II

22

Page 23: Introduction to Fuzzy Logicweb.fsktm.um.edu.my/~cschan/doc/IJCAI2.pdf · Introduction to Fuzzy Logic IJCAI2018 Tutorial 1. Crisp set vs. Fuzzy set A traditional crisp set A fuzzy

Example of Membership Functions

23

Page 24: Introduction to Fuzzy Logicweb.fsktm.um.edu.my/~cschan/doc/IJCAI2.pdf · Introduction to Fuzzy Logic IJCAI2018 Tutorial 1. Crisp set vs. Fuzzy set A traditional crisp set A fuzzy

Unimodal Functions

24

Page 25: Introduction to Fuzzy Logicweb.fsktm.um.edu.my/~cschan/doc/IJCAI2.pdf · Introduction to Fuzzy Logic IJCAI2018 Tutorial 1. Crisp set vs. Fuzzy set A traditional crisp set A fuzzy

Singletons

25

Page 26: Introduction to Fuzzy Logicweb.fsktm.um.edu.my/~cschan/doc/IJCAI2.pdf · Introduction to Fuzzy Logic IJCAI2018 Tutorial 1. Crisp set vs. Fuzzy set A traditional crisp set A fuzzy

Classical Set Function

26

Page 27: Introduction to Fuzzy Logicweb.fsktm.um.edu.my/~cschan/doc/IJCAI2.pdf · Introduction to Fuzzy Logic IJCAI2018 Tutorial 1. Crisp set vs. Fuzzy set A traditional crisp set A fuzzy

Linear Functions

27

Page 28: Introduction to Fuzzy Logicweb.fsktm.um.edu.my/~cschan/doc/IJCAI2.pdf · Introduction to Fuzzy Logic IJCAI2018 Tutorial 1. Crisp set vs. Fuzzy set A traditional crisp set A fuzzy

Triangular Functions

28

Page 29: Introduction to Fuzzy Logicweb.fsktm.um.edu.my/~cschan/doc/IJCAI2.pdf · Introduction to Fuzzy Logic IJCAI2018 Tutorial 1. Crisp set vs. Fuzzy set A traditional crisp set A fuzzy

Triangular Functions

29

Page 30: Introduction to Fuzzy Logicweb.fsktm.um.edu.my/~cschan/doc/IJCAI2.pdf · Introduction to Fuzzy Logic IJCAI2018 Tutorial 1. Crisp set vs. Fuzzy set A traditional crisp set A fuzzy

Trapezoidal Functions

30

Page 31: Introduction to Fuzzy Logicweb.fsktm.um.edu.my/~cschan/doc/IJCAI2.pdf · Introduction to Fuzzy Logic IJCAI2018 Tutorial 1. Crisp set vs. Fuzzy set A traditional crisp set A fuzzy

Trapezoidal Functions

31

Page 32: Introduction to Fuzzy Logicweb.fsktm.um.edu.my/~cschan/doc/IJCAI2.pdf · Introduction to Fuzzy Logic IJCAI2018 Tutorial 1. Crisp set vs. Fuzzy set A traditional crisp set A fuzzy

Support of Fuzzy Sets

32

Page 33: Introduction to Fuzzy Logicweb.fsktm.um.edu.my/~cschan/doc/IJCAI2.pdf · Introduction to Fuzzy Logic IJCAI2018 Tutorial 1. Crisp set vs. Fuzzy set A traditional crisp set A fuzzy

Empty Fuzzy Set

An empty fuzzy set has an empty support

33

Page 34: Introduction to Fuzzy Logicweb.fsktm.um.edu.my/~cschan/doc/IJCAI2.pdf · Introduction to Fuzzy Logic IJCAI2018 Tutorial 1. Crisp set vs. Fuzzy set A traditional crisp set A fuzzy

Compact Support

34

Page 35: Introduction to Fuzzy Logicweb.fsktm.um.edu.my/~cschan/doc/IJCAI2.pdf · Introduction to Fuzzy Logic IJCAI2018 Tutorial 1. Crisp set vs. Fuzzy set A traditional crisp set A fuzzy

Alpha-cuts Sets

35

Page 36: Introduction to Fuzzy Logicweb.fsktm.um.edu.my/~cschan/doc/IJCAI2.pdf · Introduction to Fuzzy Logic IJCAI2018 Tutorial 1. Crisp set vs. Fuzzy set A traditional crisp set A fuzzy

Level Set

36

Page 37: Introduction to Fuzzy Logicweb.fsktm.um.edu.my/~cschan/doc/IJCAI2.pdf · Introduction to Fuzzy Logic IJCAI2018 Tutorial 1. Crisp set vs. Fuzzy set A traditional crisp set A fuzzy

Resolution Principle

37

Page 38: Introduction to Fuzzy Logicweb.fsktm.um.edu.my/~cschan/doc/IJCAI2.pdf · Introduction to Fuzzy Logic IJCAI2018 Tutorial 1. Crisp set vs. Fuzzy set A traditional crisp set A fuzzy

Cardinality

38

Page 39: Introduction to Fuzzy Logicweb.fsktm.um.edu.my/~cschan/doc/IJCAI2.pdf · Introduction to Fuzzy Logic IJCAI2018 Tutorial 1. Crisp set vs. Fuzzy set A traditional crisp set A fuzzy

Cardinality – cont.

39

Page 40: Introduction to Fuzzy Logicweb.fsktm.um.edu.my/~cschan/doc/IJCAI2.pdf · Introduction to Fuzzy Logic IJCAI2018 Tutorial 1. Crisp set vs. Fuzzy set A traditional crisp set A fuzzy

Height of a fuzzy set

40

Page 41: Introduction to Fuzzy Logicweb.fsktm.um.edu.my/~cschan/doc/IJCAI2.pdf · Introduction to Fuzzy Logic IJCAI2018 Tutorial 1. Crisp set vs. Fuzzy set A traditional crisp set A fuzzy

Fuzzy subsets

41

Page 42: Introduction to Fuzzy Logicweb.fsktm.um.edu.my/~cschan/doc/IJCAI2.pdf · Introduction to Fuzzy Logic IJCAI2018 Tutorial 1. Crisp set vs. Fuzzy set A traditional crisp set A fuzzy

Equal Fuzzy Sets

42

Page 43: Introduction to Fuzzy Logicweb.fsktm.um.edu.my/~cschan/doc/IJCAI2.pdf · Introduction to Fuzzy Logic IJCAI2018 Tutorial 1. Crisp set vs. Fuzzy set A traditional crisp set A fuzzy

Fuzzy Membership Functions• One of the key issues in all fuzzy sets is how to

determine fuzzy membership functions• The membership function fully defines the fuzzy set• A membership function provides a measure of the

degree of similarity of an element to a fuzzy set• Membership functions can take any form, but there

are some common examples that appear in real applications

43

Page 44: Introduction to Fuzzy Logicweb.fsktm.um.edu.my/~cschan/doc/IJCAI2.pdf · Introduction to Fuzzy Logic IJCAI2018 Tutorial 1. Crisp set vs. Fuzzy set A traditional crisp set A fuzzy

• Membership functions can – either be chosen by the user arbitrarily, based on

the user’s experience (MF chosen by two users could be different depending upon their experiences, perspectives, etc.)

– Or be designed using machine learning methods (e.g., artificial neural networks, genetic algorithms, etc.)

• There are different shapes of membership functions; triangular, trapezoidal, piecewise-linear, Gaussian, bell-shaped, etc.

44

Page 45: Introduction to Fuzzy Logicweb.fsktm.um.edu.my/~cschan/doc/IJCAI2.pdf · Introduction to Fuzzy Logic IJCAI2018 Tutorial 1. Crisp set vs. Fuzzy set A traditional crisp set A fuzzy

Fuzzy Operations(Fuzzy Union, Intersection, and Complement)

• Fuzzy logic begins by borrowing notions from crisp logic, just as fuzzy set theory borrows from crisp set theory. As in our extension of crisp set theory to fuzzy set theory, our extension of crisp logic to fuzzy logic is made by replacing membership functions of crisp logic with fuzzy membership functions [J.M. Mendel, Uncertain Rule-Based Fuzzy Logic Systems, 2001]

• In Fuzzy Logic, intersection, union and complement are defined in terms of their membership functions

• This section concentrates on providing enough of a theoretical base for you to be able to implement computer systems that use fuzzy logic

• Fuzzy intersection and union correspond to ‘AND’ and ‘OR’, respectively, in classic/crisp/Boolean logic

• These two operators will become important later as they are the building blocks for us to be able to compute with fuzzy if-then rules

45

Page 46: Introduction to Fuzzy Logicweb.fsktm.um.edu.my/~cschan/doc/IJCAI2.pdf · Introduction to Fuzzy Logic IJCAI2018 Tutorial 1. Crisp set vs. Fuzzy set A traditional crisp set A fuzzy

• Logical AND (∩) • Logical OR (U)Truth Table

A B A ∩ B0 0 00 1 01 0 01 1 1

Truth TableA B A U B0 0 00 1 11 0 11 1 1

Crisp UnionCrisp Intersection

A AB B

Classic/Crisp/Boolean Logic

46

Page 47: Introduction to Fuzzy Logicweb.fsktm.um.edu.my/~cschan/doc/IJCAI2.pdf · Introduction to Fuzzy Logic IJCAI2018 Tutorial 1. Crisp set vs. Fuzzy set A traditional crisp set A fuzzy

Fuzzy Union

• The union (OR) is calculated using t-conorms• t-conorm operator is a function s(.,.)• Its features are

– s(1,1) = 1, s(a,0) = s(0,a) = a (boundary)– s(a,b) ≤ s(c,d) if a ≤ c and b ≤ d (monotonicity)– s(a,b) = s(b,a) (commutativity)– s(a,s(b,c)) = s(s(a,b),c) (associativity)

• The most commonly used method for fuzzy union is to take the maximum. That is, given two fuzzy sets A and B with membership functions µA(x) and µB(x)

))(),(max()( xxx BAAUB µµµ =

47

Page 48: Introduction to Fuzzy Logicweb.fsktm.um.edu.my/~cschan/doc/IJCAI2.pdf · Introduction to Fuzzy Logic IJCAI2018 Tutorial 1. Crisp set vs. Fuzzy set A traditional crisp set A fuzzy

Fuzzy Intersection

• The intersection (AND) is calculated using t-norms. • t-norm operator is a function t(.,.)• Its features

– t(0,0) = 0, t(a,1) = t(1,a) = a (boundary)– t(a,b) ≤ t(c,d) if a ≤ c and b ≤ d (monotonicity)– t(a,b) = t(b,a) (commutativity)– t(a, t(b,c)) = t(t(a,b),c) (associativity)

• The most commonly adopted t-norm is the minimum. That is, given two fuzzy sets A and B with membership functions µA(x) and µB(x)

))(),(min()( xxx BABA µµµ =Ç

48

Page 49: Introduction to Fuzzy Logicweb.fsktm.um.edu.my/~cschan/doc/IJCAI2.pdf · Introduction to Fuzzy Logic IJCAI2018 Tutorial 1. Crisp set vs. Fuzzy set A traditional crisp set A fuzzy

Fuzzy Complement

• To be able to develop fuzzy systems we also have to deal with NOT or complement.

• This is the same in fuzzy logic as for Boolean logic

• For a fuzzy set A, A denotes the fuzzy complement of A

• Membership function for fuzzy complement is

)(1)( xx AA

µµ -=

49

Page 50: Introduction to Fuzzy Logicweb.fsktm.um.edu.my/~cschan/doc/IJCAI2.pdf · Introduction to Fuzzy Logic IJCAI2018 Tutorial 1. Crisp set vs. Fuzzy set A traditional crisp set A fuzzy

Product of Two Fuzzy Sets

50

Page 51: Introduction to Fuzzy Logicweb.fsktm.um.edu.my/~cschan/doc/IJCAI2.pdf · Introduction to Fuzzy Logic IJCAI2018 Tutorial 1. Crisp set vs. Fuzzy set A traditional crisp set A fuzzy

Sum of Two Fuzzy Sets

51

Page 52: Introduction to Fuzzy Logicweb.fsktm.um.edu.my/~cschan/doc/IJCAI2.pdf · Introduction to Fuzzy Logic IJCAI2018 Tutorial 1. Crisp set vs. Fuzzy set A traditional crisp set A fuzzy

Linguistics Hedges and Operators

• A fuzzy set can be regarded as corresponding to a linguistic value such as “tall”, and a linguistic variable “height” can be regarded as ranging over such linguistic values.

• One powerful aspect of fuzzy sets in this context is the ability to deal with linguistic quantifiers or “hedges”.

• Hedges such as more or “less”, “very”, “not very”, “slightly” etccorrespond to modifications in the membership function of the fuzzy set involved.

• The fuzzy set operations such CON, DIL, INT etc (see the table of hedges and Operators) can be used to modify the fuzzy set.

52

Page 53: Introduction to Fuzzy Logicweb.fsktm.um.edu.my/~cschan/doc/IJCAI2.pdf · Introduction to Fuzzy Logic IJCAI2018 Tutorial 1. Crisp set vs. Fuzzy set A traditional crisp set A fuzzy

Hedges and Operators

53