17
Fuzzy Sets and Fuzzy Logic Chapter 12 M. Tim Jones See also http ://en.wikipedia.org/wiki/Fuzzy_logic

Fuzzy Sets and Fuzzy Logic Chapter 12 M. Tim Jones See also //en.wikipedia.org/wiki/Fuzzy_logic

Embed Size (px)

Citation preview

Page 1: Fuzzy Sets and Fuzzy Logic Chapter 12 M. Tim Jones See also //en.wikipedia.org/wiki/Fuzzy_logic

Fuzzy Sets and Fuzzy LogicFuzzy Sets and Fuzzy Logic

Chapter 12M. Tim Jones

See also http://en.wikipedia.org/wiki/Fuzzy_logic

Page 2: Fuzzy Sets and Fuzzy Logic Chapter 12 M. Tim Jones See also //en.wikipedia.org/wiki/Fuzzy_logic

Fuzzy Sets

• Rules of thumb frequently stated in “fuzzy” linguistic terms.John is tall.If someone is tall and well-built

then his basketball skill is good.Fuzzy Sets0 S(x) 1: S(x) (or (S, x)) is the degree of membership of x in set

SS(x) = 0 : x is not at all in SS(x) = 1 : x is fully in S.If S(x) = 0 or 1, then the set S is crisp.

Page 3: Fuzzy Sets and Fuzzy Logic Chapter 12 M. Tim Jones See also //en.wikipedia.org/wiki/Fuzzy_logic

Example: Short, Medium height and Tall

1.0

7’6’ 6’6”5’6”5’

Medium

Short Tall

Note: Short(x) + Medium(x) + Tall(x) 1.

Page 4: Fuzzy Sets and Fuzzy Logic Chapter 12 M. Tim Jones See also //en.wikipedia.org/wiki/Fuzzy_logic

Example: Light, Medium weight and Heavy

1.0

10080 907060

Medium

Light Heavy

Weight (Kg)

Someone who is 6’1” is simultaneously short, of medium height and tall in various degrees which don’t add to 1.

Fuzzy subsets: S T if S(x) T(x) for all x.

Page 5: Fuzzy Sets and Fuzzy Logic Chapter 12 M. Tim Jones See also //en.wikipedia.org/wiki/Fuzzy_logic

Membership Implementation#define downslope(x, left, right) ((right-x) / (right-left))#define upslope(x, left, right) ((x-left) / (right-left))

float m_t_cold( float x ) { float left = 45.0; float right = 75.0; if (x <= left) return 1.0; else if (x >= right) return 0.0; else return downslope(x, left, right);}

float m_t_hot( float x ) { float left = 45.0; float right = 75.0; if (x <= left) return 0.0; else if (x >= right) return 1.0; else return upslope(x, left, right);}

Page 6: Fuzzy Sets and Fuzzy Logic Chapter 12 M. Tim Jones See also //en.wikipedia.org/wiki/Fuzzy_logic

Fuzzy Facts• Each fuzzy fact is a declaration of the degree of membership in a

fuzzy set.

John is tall ( degree 0.2).John is of medium height (degree 0.6).John is short (degree 0.3)John is well-built (degree 0.7).John is weak (degree 0.40).

Generally, fuzzy membership functions are defined in terms of numerical values of an underlying crisp attribute.For example: Short, Medium and Tall in terms of height.Weak and Well-built in terms of muscle mass.

Page 7: Fuzzy Sets and Fuzzy Logic Chapter 12 M. Tim Jones See also //en.wikipedia.org/wiki/Fuzzy_logic

Logical Connectives in Fuzzy Logic

Negation: (S)(x) = 1 - S(x).The set S is the complement of the set S.

1.0

7’6’ 6’6”5’6”5’

TallNot Tall

Page 8: Fuzzy Sets and Fuzzy Logic Chapter 12 M. Tim Jones See also //en.wikipedia.org/wiki/Fuzzy_logic

Note: No one is a full member of this set.

Logical Connectives in Fuzzy Logic

• Conjunction: (S T)(x) = min ( S(x), T(x))

• Example: Medium and Tall

1.0

7’6’ 6’6”5’6”5’

Medium

Short Tall

Medium and Tall

Page 9: Fuzzy Sets and Fuzzy Logic Chapter 12 M. Tim Jones See also //en.wikipedia.org/wiki/Fuzzy_logic

Remark: Unlike probabilities, fuzzy membership function for negation, conjunction and disjunction are easily calculated.

Logical Connectives in Fuzzy Logic

• A fuzzy set is normalised when it is possible for someone to be a full member of the set ( = 1).Union: (S T)(x) = max (S(x), T(x)).

1.0

7’6’ 6’6”5’6”5’

Medium

Short Medium or Tall

Tall

Page 10: Fuzzy Sets and Fuzzy Logic Chapter 12 M. Tim Jones See also //en.wikipedia.org/wiki/Fuzzy_logic

Fuzzy RulesRule 1: If height is short then weight is light.Rule 2: If height is medium then weight is medium.Rule 3: If height is tall then weight is heavy.

Problem: Given (a) membership functions for short, medium-height,

tall, light, medium-weight and heavy;(b) the above three fuzzy rules,(c) the fact that John’s height is 6’1”, Estimate John’s weight.

Page 11: Fuzzy Sets and Fuzzy Logic Chapter 12 M. Tim Jones See also //en.wikipedia.org/wiki/Fuzzy_logic

Fuzzy Rules

Problem: Given (a) membership functions for short, medium-height, tall,

light, medium-weight and heavy;(b) the above three fuzzy rules,(c) the fact that John’s height is 6’1”, Estimate John’s weight.

Solution(1) From John’s height we know that

John is short (degree 0.3)John is of medium height (degree 0.6).John is tall ( degree 0.2).

(2) (a) Each rule produces a fuzzy set as output by truncating the consequent membership function at the value of the antecedent membership.

Page 12: Fuzzy Sets and Fuzzy Logic Chapter 12 M. Tim Jones See also //en.wikipedia.org/wiki/Fuzzy_logic

Fuzzy Rules• Rule 1: : If height is short then

weight is light.• John is short (degree 0.3)

1.0

10080 907060

Medium

Light Heavy

Weight (Kg)

Page 13: Fuzzy Sets and Fuzzy Logic Chapter 12 M. Tim Jones See also //en.wikipedia.org/wiki/Fuzzy_logic

Fuzzy Rules

• Rule 2: If height is medium then weight is medium.

• John is of medium height (degree 0.6).

1.0

10080 907060

Medium

Light Heavy

Weight (Kg)

Page 14: Fuzzy Sets and Fuzzy Logic Chapter 12 M. Tim Jones See also //en.wikipedia.org/wiki/Fuzzy_logic

Fuzzy Rules

• Rule 3: If height is tall then weight is heavy.

• John is tall ( degree 0.2).

1.0

10080 907060

Medium

Light Heavy

Weight (Kg)

Page 15: Fuzzy Sets and Fuzzy Logic Chapter 12 M. Tim Jones See also //en.wikipedia.org/wiki/Fuzzy_logic

Fuzzy Rules

(b) The cumulative fuzzy output is obtained by ORing the output from each rule.

Cumulative fuzzy output ( Weight at 6’1”)

1.0

10080 907060

Medium

Light Heavy

Weight (Kg)

Page 16: Fuzzy Sets and Fuzzy Logic Chapter 12 M. Tim Jones See also //en.wikipedia.org/wiki/Fuzzy_logic

Fuzzy Rules(c) De-fuzzification To obtain a numerical

estimate, we need to de-fuzzify the output. Choose the middle of the range where the truth

value is maximum. (This is one possibility.) John’s Weight = 80 Kgs.

Page 17: Fuzzy Sets and Fuzzy Logic Chapter 12 M. Tim Jones See also //en.wikipedia.org/wiki/Fuzzy_logic

Summary• Advantages of fuzzy logic– Allows the use of vague linguistic terms in the rules.

• Disadvantages of fuzzy logic– Difficult to estimate membership function– There are many ways of interpreting fuzzy rules,

combining the outputs of several fuzzy rules and de-fuzzifying the output.