Fuzzy logic Notes AI CSE 8th Sem

DigiGurukulBlog 7,087 views 98 slides Mar 04, 2018
Slide 1
Slide 1 of 98
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30
Slide 31
31
Slide 32
32
Slide 33
33
Slide 34
34
Slide 35
35
Slide 36
36
Slide 37
37
Slide 38
38
Slide 39
39
Slide 40
40
Slide 41
41
Slide 42
42
Slide 43
43
Slide 44
44
Slide 45
45
Slide 46
46
Slide 47
47
Slide 48
48
Slide 49
49
Slide 50
50
Slide 51
51
Slide 52
52
Slide 53
53
Slide 54
54
Slide 55
55
Slide 56
56
Slide 57
57
Slide 58
58
Slide 59
59
Slide 60
60
Slide 61
61
Slide 62
62
Slide 63
63
Slide 64
64
Slide 65
65
Slide 66
66
Slide 67
67
Slide 68
68
Slide 69
69
Slide 70
70
Slide 71
71
Slide 72
72
Slide 73
73
Slide 74
74
Slide 75
75
Slide 76
76
Slide 77
77
Slide 78
78
Slide 79
79
Slide 80
80
Slide 81
81
Slide 82
82
Slide 83
83
Slide 84
84
Slide 85
85
Slide 86
86
Slide 87
87
Slide 88
88
Slide 89
89
Slide 90
90
Slide 91
91
Slide 92
92
Slide 93
93
Slide 94
94
Slide 95
95
Slide 96
96
Slide 97
97
Slide 98
98

About This Presentation

Artificial Intelligence Notes on Fuzzy Logic as according to CSVTU Syllabus for CSE 8th Sem


Slide Content

INTRODUCTION TO FUZZY LOGIC 1

Syllabus Fuzzy sets and crisp sets Intersections of Fuzzy sets, Union of Fuzzy sets, T he complement of Fuzzy sets. 2

Motivation The term “ fuzzy logic ” refers to a logic of approximation. Boolean logic assumes that every fact is either entirely true or false. Fuzzy logic allows for varying degrees of truth. Computers can apply this logic to represent vague and imprecise ideas, such as “ hot ” , “ tall ” or “ balding ” .

What is meant by fuzzy? Fuzzy (technical meaning) is imprecise, uncertain or unreliable knowledge, uncertain / noisy / incomplete Information, ambiguity (vague) or partial truth 4

Difference between imprecision and uncertainty Consider the following two situations : 1. John has at least two children and I am sure about it. 2. John has three children but I am not sure about it. In case 1, the number of children is imprecise but certain. In case 2, the number of children is precise but uncertain. 5

Uncertainty There is uncertainty that arises from ignorance, from various classes of randomness, from the inability to perform adequate measurements, from lack of knowledge, or from vagueness. 6

Types of Uncertainty 1. Stochastic uncertainty : It is the uncertainty towards the occurrence of a certain event. 2. Lexical uncertainty : It is the uncertainty lies in human languages like hot days, stable occurrence, a successful financial year and so on. 7

Ambiguity (vague) Food is hot. Here hot may be ‘spicy’ or ‘warm’ 8

Partial truth ??????????????? 9

World of information 10

Introduction Fuzzy Logic was initiated in 1965, by Dr. Lotfi A. Zadeh , professor for computer science at the university of California in Berkley. Fuzzy logic is a mathematical tool for dealing with uncertainty. It provides a technique to deal with imprecision and information granularity. The fuzzy theory provides a mechanism for representing linguistic constructs such as “many,” “low,” “medium,” “often,” “few.” 11

Classical set Classical sets are also called crisp set or nonfuzzy set. The traditional binary set theory describes crisp events, events that either do or do not occur. The crisp sets are sets without ambiguity in their membership. Example 1, for the set of integers, either an integer is even or it is not (it is odd). Example 2, However, either you are in the USA or you are not. 12

Example Lists: A = {apples, oranges, cherries, mangoes} A = {a 1 ,a 2 ,a 3 } A = {2, 4, 6, 8, …} Formulas: A = {x | x is an even natural number} A = {x | x = 2n, n is a natural number} Membership or characteristic function 13

Can they see each other? 14

Binary logic Vs. Fuzzy logic 15

Fuzzy sets It has an ability to classify elements into a continuous set using the concept of degree of membership. Fuzzy set is defined as a set whose elements have degrees of membership. The characteristics function or membership function not only gives 0 or 1 but can also give values between 0 and 1. Value 0-> non-membership Value 1->complete membership Value between 0 and 1-> degree of membership 16

Example of tumblers 17

Example There are following five tumblers, divided into two classes: full and empty. It is obvious: tumbler 1 belongs to the class full and tumbler 5 belongs to the class empty. Then tumblers 2, 3 and 4 belongs to which class? These tumblers are neither 100% full nor 100% empty. In other word we can say that tumbler 2 is 75% full, or 25% empty. 18

Example Now we define two sets: F and E. F is the set of all tumblers that belong to the class full. E is the set of all tumblers that belong to the class empty. 19

Graphical representation of sets 20

Fuzzy sets The sets F and E have some elements, which have not the full, but a partial membership. Such kind of non-crisp sets are called fuzzy sets. The set “all tumblers” that is here the basis of the fuzzy sets F and E, is called the Base set or universe of Discourse. 21

Fuzzy Logic Basically, Fuzzy Logic is a multivalued logic, that allows intermediate values to be defined between conventional evaluations like true/false, yes/no, high/low, etc. Fuzzy Logic is a superset of conventional (Boolean) logic that has been extended to handle the concept of partial truth, i.e. truth values between “completely true” and “completely false”. Fuzzy Logic provides a simple way to arrive at a definite conclusion based upon vague, ambiguous, imprecise, noisy, or missing input information. 22

Fuzzy Logic Systems A system becomes a fuzzy system when its operations are entirely or partially governed by fuzzy logic or are based on fuzzy sets. A fuzzy logic system which accepts imprecise data and vague statements such as low, medium, high and provides decisions. 23

Fuzzy Logic Systems 24

Some Fuzzy Logic applications MASSIVE Created to help create the large-scale battle scenes in the Lord of the Rings films, MASSIVE is program for generating generating crowd-related visual effects

Applications of Fuzzy Logic Vehicle Control A number of subway systems, particularly in Japan and Europe, are using fuzzy systems to control braking and speed. One example is the Tokyo Monorail

Applications of Fuzzy Logic Appliance control systems Fuzzy logic is starting to be used to help control appliances ranging from rice cookers to small-scale microchips (such as the Freescale 68HC12)

Fuzzy Sets A fuzzy set A in X is expressed as a set of ordered pairs : Where, x is an element in X. 28

Membership function The membership function is a graphical representation of the magnitude of participation of each input. It associates a weighting with each of the inputs that are processed, define functional overlap between inputs, and ultimately determines an output response. The rules use the input membership values as weighting factors to determine their influence on the fuzzy output sets of the final output conclusion. Once the functions are inferred, scaled, and combined, they are defuzzified into a crisp output which drives the system. 29

Continued…….. There are different membership functions associated with each input and output response. Some features to note are: SHAPE - triangular is common, but bell, trapezoidal, haversine and, exponential have been used. More complex functions are possible but require greater computing overhead to implement. HEIGHT or magnitude (usually normalized to 1) WIDTH (of the base of function), SHOULDERING (locks height at maximum if an outer function. Shouldered functions evaluate as 1.0 past their center) CENTER points (center of the member function shape) OVERLAP (N&Z, Z&P, typically about 50% of width but can be less).   30

Example For the tumbler example, fuzzy set can be represented as Full={(1,1), (2,0.75), (3,0.5), (4,0.25), (5,0)} 31

Fuzzy Sets with Discrete Universes Fuzzy set C = “desirable city to live in” X = {SF, Boston, LA} (discrete and nonordered ) C = {(SF, 0.9), (Boston, 0.8), (LA, 0.6)} Fuzzy set A = “sensible number of children” X = {0, 1, 2, 3, 4, 5, 6} (discrete universe) A = {(0, .1), (1, .3), (2, .7), (3, 1), (4, .6), (5, .2), (6, .1)} 32

Fuzzy Sets with Cont. Universes Fuzzy set B = “about 50 years old” X = Set of positive real numbers (continuous) B = {(x, m B (x)) | x in X} 33

Alternative Notation A fuzzy set A can be alternatively denoted as follows: X is discrete X is continuous 34

Support(A) = {x  X |  A (x) > 0} The support of fuzzy set, is the crisp set of all points in the universe of discourse U such that membership function of A is non zero. Crossover(A) = {x  X |  A (x) = 0.5} The crossover point of fuzzy set , is the element in universe of discourse U at which its membership function is 0.5. Normal (A) = {x  X |  A (x) = 1} The fuzzy set is called normal if there is at least one element in the U where the membership function is 1. Characteristics of Fuzzy Sets 35

Characteristics of Fuzzy Sets The cardinality of a fuzzy set A, the so-called SIGMA COUNT, is expressed as a SUM of the values of the membership function of A,  A ( x ): card A =  A ( x 1 ) +  A ( x 2 ) + …  A ( x n ) = Σ  A ( x i ), for i =1.. n Example: Consider X = {1, 2, 3} and sets A and B A = 0.3/1 + 0.5/2 + 1/3; B = 0.5/1 + 0.55/2 + 1/3 card A = 1.8 card B = 2.05 36 Cardinality

Characteristics of Fuzzy Sets A fuzzy set A is empty, IF AND ONLY IF:  A ( x ) = 0,  x  X Example: Consider X = {1, 2, 3} and fuzzy set A = 0/1 + 0/2 + 0/3, then A is empty. 37 Empty Fuzzy Set

Characteristics of Fuzzy Sets An  -cut or  -level set of a fuzzy set A  X is an ORDINARY SET A   X , such that: A  ={  A ( x )  ,  x  X }. Strong alpha cut is defined as, A  ={  A ( x ) > ,  x  X }. Example: Consider X = {1, 2, 3} and set A = 0.3/1 + 0.5/2 + 1/3 then: A 0.5 = {2, 3}, A 0.1 = {1, 2, 3}, A 1 = {3}. 38 Alpha-Cut and Strong-alpha cut

Fuzzy singleton Fuzzy set whose support is a single point in X with µ A (x) =1 is called fuzzy singleton. 39 Characteristics of Fuzzy Sets

40 Fuzzy set A is considered equal to a fuzzy set B , IF AND ONLY IF:  A ( x ) =  B ( x ),  x  X Example: A = 0.3/1 + 0.5/2 + 1/3, B = 0.3/1 + 0.5/2 + 1/3, therefore A = B. Equality Characteristics of Fuzzy Sets

Height The height of a fuzzy set ˜A is the maximum value of the membership function, i.e. max {μ(x)}. 41 Characteristics of Fuzzy Sets

Example 1 Let U is defined by X={1,2,3,4,5,6,7,8,9,10} & fuzzy set A={(1,0), (2,0.1), (3,0.2), (4,0.5), (5,0.3), (6,0.1),(7,0.0), (8,0.0), (9,0.0), (10,1)} Find the support, crossover and normal. 42

Solution 1 Support={2,3,4,5,6,10} Crossover point x=4 Normal point x=10 43

Logical Operations on Fuzzy set Fuzzy Intersection Fuzzy Union Complement 44

Logical Operations on Fuzzy set Union: The union the two sets A and B ( A  B ) can be defined by the membership function  U (x)   ( x )= max (   ( x ),   ( x )), x  X 45

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

Logical Operations on Fuzzy set Intersection: the intersection of two sets A and B ( A  B ) can be defined by the membership function   (x)   ( x )= min (   ( x ),   ( x )), x  X 47

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.

Logical Operations on Fuzzy set Complement: the complement of a fuzzy set A can be defined by the membership function mØ A ( x ) 49 mØ A ( x ) = 1 - m A ( x )

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}

Example 2 Consider two fuzzy subsets of the set X , X = {a, b, c, d, e } referred to as A and B A = {1/a, 0.3/b, 0.2/c 0.8/d, 0/e} and B = {0.6/a, 0.9/b, 0.1/c, 0.3/d, 0.2/e} Find out the Support, Cardinality, union, intersection and complement. 51

Solution 2 Support : supp ( A ) = {a, b, c, d } supp ( B ) = {a, b, c, d, e } Cardinality : card ( A ) = 1+0.3+0.2+0.8+0 = 2.3 card ( B ) = 0.6+0.9+0.1+0.3+0.2 = 2.1 Complement : A = {1/a, 0.3/b, 0.2/c 0.8/d, 0/e}  A = {0/a, 0.7/b, 0.8/c 0.2/d, 1/e} Union : A  B = {1/a, 0.9/b, 0.2/c, 0.8/d, 0.2/e} Intersection : A  B = {0.6/a, 0.3/b, 0.1/c, 0.3/d, 0/e} 52

Example 3 Suppose we have the following (discrete) fuzzy sets: A = 0.4/1 + 0.6/2 + 0.7/3 + 0.8/4 B = 0.3/1 + 0.65/2 + 0.4/3 + . 1/4 Represent A and B fuzzy sets graphically Calculate the of union of the set A and set B Calculate the intersection of the set A and set B Calculate the complement of the union of A and B 53

Solution (a) A B

Solution 3 ( b) The union of the fuzzy sets A and B = 0.4/1+0.65/2+0.7/3+0.8/4 (c) The intersection of the fuzzy sets A and B = 0.3/1+0.6/2+0.4/3+0.1/4 (c) The complement of the fuzzy set A = 0.6/1+0.4/2+0.3/3+0.2/4 55

Example 4 Given two fuzzy sets A and B a. Represent A and B fuzzy sets graphically b. Calculate the of union of the set A and set B c. Calculate the intersection of the set A and set B d. Calculate the complement of the union of A and B

Solution (a)

Solution 4 b c d

59 Math Operations on Fuzzy Set kA = { k  A ( x ),  x  X } Let k =0.5, and A = {0.5/a, 0.3/b, 0.2/c, 1/d} then k A = {0.25/a, 0.15/b, 0.1/c, 0.5/d} A m = {  A ( x ) m ,  x  X } Let m =2, and A = {0.5/a, 0.3/b, 0.2/c, 1/d} then A m = {0.25/a, 0.09/b, 0.04/c, 1/d} …

60 Example 5 There are two fuzzy subsets of the set X = {a, b, c, d, e }: A = {1/a, 0.3/b, 0.2/c 0.8/d, 0/e} and B = {0.6/a, 0.9/b, 0.1/c, 0.3/d, 0.2/e }. Find the kA, A m and α -cut. K=0.5 and m=2

Solution 5 kA : for k =0.5 kA = {0.5/a, 0.15/b, 0.1/c, 0.4/d, 0/e} A m : for m =2 A a = {1/a, 0.09/b, 0.04/c, 0.64/d, 0/e} α -cut : A 0.2 = {a, b, c, d} A 0.3 = {a, b, d} A 0.8 = {a, d} A 1 = {a} 61

62 Example 6 A = {0.2/a, 0.4/b, 1/c, 0.8/d, 0/e} B = {0/a, 0.9/b, 0.3/c, 0.2/d, 0.1/e} Draw the Fuzzy Graph of A and B Then, calculate the following: - Support, Core, Cardinality, and Complement for A and B independently - Union and Intersection of A and B - the new set C , if C = A 2 - the new set D , if D = 0.5  B - the new set E , for an alpha cut at A 0.5

63 Solution 6 A = {0.2/a, 0.4/b, 1/c, 0.8/d, 0/e} B = {0/a, 0.9/b, 0.3/c, 0.2/d, 0.1/e} Support Supp(A) = {a, b, c, d} Supp(B) = {b, c, d, e} Core Core(A) = {c} Core(B) = {} Cardinality Card(A) = 0.2 + 0.4 + 1 + 0.8 + 0 = 2.4 Card(B) = 0 + 0.9 + 0.3 + 0.2 + 0.1 = 1.5 Complement Comp(A) = {0.8/a, 0.6/b, 0/c, 0.2/d, 1/e} Comp(B) = {1/a, 0.1/b, 0.7/c, 0.8/d, 0.9/e}

64 Solution 6 cont.... A = {0.2/a, 0.4/b, 1/c, 0.8/d, 0/e} B = {0/a, 0.9/b, 0.3/c, 0.2/d, 0.1/e} Union A  B = {0.2/a, 0.9/b, 1/c, 0.8/d, 0.1/e} Intersection AB = {0/a, 0.4/b, 0.3/c, 0.2/d, 0/e} C=A 2 C = {0.04/a, 0.16/b, 1/c, 0.64/d, 0/e} D = 0.5  B D = {0/a, 0.45/b, 0.15/c, 0.1/d, 0.05/e} E = A 0.5 E = {c, d}

Algebraic Operations on Fuzzy Set Algebraic Product The product of two fuzzy sets in the same universe of discourse is the new fuzzy set A.B with a membership function that equal product of the membership function of A and the membership function of B.  A.B ( x ) ={ A ( x ) .  B ( x )| x  A , x  B } 65

Algebraic Operations on Fuzzy Set Multiplying a fuzzy set by a crisp number When a fuzzy set A is multiplied by a crisp number a, then its membership function is given by 66  a .A ( x ) = a A ( x )

Algebraic Operations on Fuzzy Set Cartesian product The Cartesian product of two fuzzy sets A & B is a fuzzy set C denoted by A X B and defined as 67 C=A X B=  c ( x )/( a,b ) |a  A, b  B  c ( C )=min(  A(a) ,  B(b) )

Algebraic Sum The Algebraic sum of two fuzzy sets A & B is a fuzzy set C denoted by A + B and defined as C=A + B=  c ( x )=  A ( x ) +  B ( x )-  A ( x ).  B ( x ) 68 Algebraic Operations on Fuzzy Set

Algebraic Operations on Fuzzy Set Bounded Sum The bounded sum of two fuzzy sets A and B in the universes X and Y with the membership functions μ A (x) and μ B (x) respectively is defined by 69 where the “+” sign is an arithmetic operator.

Algebraic Operations on Fuzzy Set Bounded product The bounded product of two fuzzy sets A and B in the universes X and Y with membership functions μ A (x) and μ B (x) respectively is defined as 70

Algebraic Operations on Fuzzy Set Bounded difference The bounded of difference of two fuzzy sets A and B is a fuzzy set C denoted by 71

Example 7 Let us consider two fuzzy sets A={(1,0.6),(2,1.0),(3,0.5),(4,0.3),(5,0.8) B={(2,0.5),(3,0.7)} Find out the Algebraic product, Cartesian product, Algebraic sum, Bounded Sum, Bounded difference. 72

Solution 7 73

Solution 7 cont……. 74

Solution 7 cont……. 75

Properties of Fuzzy sets Associative Property Commutative Property Distributive Property Idem Potency Identity Transitive Involution Demorgan’s Law 76

Properties of Fuzzy sets 77 Associative Property A∪ (B ∪ C) = (A ∪ B) ∪C or max [ μ A (X), max{ μ B (Y), μ C (Z)}] = max[ {max { μ A (x), μ B (Y)}, μ C (Z)] and A ∩ (B ∩ C) = (A ∩ B) ∩C or min [ μ A (X), min{ μ B (Y), μ C (Z)}] = min[ {min { μ A (x), μ B (Y)}, μ C (Z)]

Properties of Fuzzy sets 78 Commutative Property

Properties of Fuzzy sets 79 Distributive Property

Properties of Fuzzy sets 80 Idem Potency

Properties of Fuzzy sets 81 Identity

Properties of Fuzzy sets 82 Transitive

Properties of Fuzzy sets 83 Involution A’’=A

Properties of Fuzzy sets 84 Demorgan’s Law

Prove Prove that the De Morgan’s Laws hold for fuzzy sets that is 85

Solution 86

Solve 87

Solve 88

Solve 1. For the given fuzzy set 89 Prove the associative and the distributive property for the above given sets.

Solution To prove associative property 90

Solution To prove distribute property 91

Solve 92

Solve 3. Consider two fuzzy sets A∼ and B∼ find Complement, Union, Intersection, Difference, and De Morgan’s law. 93

Solve 4. Given the classical sets, A = {9, 5, 6, 8, 10} B = {1, 2, 3, 7, 9} C = {1, 0} Prove the classical set properties associativity and distributivity . 94

Solve 5. Consider, X = {a, b, c, d, e, f, g, h}. and the set A is defined as {a, d, f}. So for this classical set prove the identity property. 95

Solution 96

Solve 97

Solve 98