Learning Outcomes
SLO | After this lecture you will be able to... | CLO | Bloom |
|---|---|---|---|
SLO 22.1 | Differentiate crisp and fuzzy sets, and fuzziness from probability, using linguistic variables | CLO3 | C2 Understand |
SLO 22.2 | Apply triangular, trapezoidal, Gaussian and sigmoid membership functions and find support, core and crossover points | CLO3 | C3 Apply |
SLO 22.3 | Apply fuzzy union, intersection, complement and hedges, and explain why the excluded-middle law fails | CLO3 | C3 Apply |
1. Fuzzy Sets
§1.1 Crisp vs fuzzy sets
Slide L22-S06
A crisp set has a sharp boundary: membership is 0 or 1. A fuzzy set (Zadeh, 1965) gives each element a degree of membership between 0 and 1, so vague words like 'tall' or 'hot' change smoothly.
height crisp tall fuzzy tall 165 cm 0 0.00 175 cm 0 0.33 180 cm 0 0.67 182 cm 0 0.80 183 cm 1 0.87 190 cm 1 1.00 |
§1.2 Definitions
Slide L22-S07
Idea | Meaning | Example |
|---|---|---|
Universe of discourse X | All values we talk about | Temperature 0-50 °C |
Membership function μA(x) | Degree of x in A (0 to 1) | μhot(36) = 0.8 |
Discrete fuzzy set | {degree/value} pairs; '/' is not division | {0.0/25, 0.2/30, 0.7/35, 1.0/40} |
Linguistic variable | Variable whose values are words | Temperature: cold, comfortable, hot |
Term | One fuzzy set of a linguistic variable | hot = trapmf [28, 38, 50, 50] |
§1.3 Fuzziness is not probability
Slide L22-S08
Probability | Fuzziness | |
|---|---|---|
Measures | Chance of an event | How well a word fits |
After the event | Resolved (happened or not) | Unchanged |
Sum over outcomes | Must be 1 | Need not be 1 |
Example | 70% chance of rain | Today is fairly hot |
Bottle example: a bottle with membership 0.91 in 'drinkable' is a bit muddy but safe; a bottle with probability 0.91 of being drinkable has a 9% chance of being poison.
2. Membership Functions
§2.1 Four common shapes
Slide L22-S10
shape mu(26 C) triangle trimf [15, 24, 33] 0.78 trapezoid trapmf [15, 20, 28, 33] 1.00 Gaussian gaussmf mean 24, sigma 4 0.88 sigmoid 'hot' sigmf centre 33, slope 0.6 0.01 |
Shape | scikit-fuzzy | Formula idea | Use |
|---|---|---|---|
Triangle | trimf [a, b, c] | Rises a to b, falls b to c | One typical value |
Trapezoid | trapmf [a, b, c, d] | Flat top from b to c | A range of typical values |
Gaussian | gaussmf(mean, sigma) | e^(-(x - mean)² / (2 sigma²)) | Smooth; learning |
Sigmoid | sigmf(centre, slope) | 1 / (1 + e^(-slope (x - centre))) | Open-ended words |
§2.2 Features of a fuzzy set
Slide L22-S11
comfortable trimf [15, 24, 33] support 15 < x < 33 C (degree > 0) core 24.0 to 24.0 C (degree = 1) crossover 19.5, 28.5 C (degree = 0.5) height 1.0 -> normal set hot trapmf [28, 38, 50, 50] support 28 < x <= 50 C (degree > 0) core 38.0 to 50.0 C (degree = 1) crossover 33.0 C (degree = 0.5) height 1.0 -> normal set |
Support: degree > 0. Core: degree = 1. Crossover: degree = 0.5. Height: largest degree (1 = normal set). Alpha-cut: degree >= alpha. For trimf [a, b, c] the crossovers are (a + b)/2 and (b + c)/2.
3. Fuzzy Logic
§3.1 Operations
Slide L22-S13
warm = {1.00/25, 0.60/30, 0.30/35, 0.00/40} hot = {0.00/25, 0.20/30, 0.70/35, 1.00/40} warm OR hot = {1.00/25, 0.60/30, 0.70/35, 1.00/40} warm AND hot = {0.00/25, 0.20/30, 0.30/35, 0.00/40} NOT hot = {1.00/25, 0.80/30, 0.30/35, 0.00/40} very hot = {0.00/25, 0.04/30, 0.49/35, 1.00/40} somewhat hot = {0.00/25, 0.45/30, 0.84/35, 1.00/40} hot OR NOT hot = {1.00/25, 0.80/30, 0.70/35, 1.00/40} (not all 1) hot AND NOT hot = {0.00/25, 0.20/30, 0.30/35, 0.00/40} (not all 0) |
Operation | Formula |
|---|---|
Union (OR) | max(μA, μB) |
Intersection (AND) | min(μA, μB) |
Complement (NOT) | 1 - μA |
very A | μA² |
somewhat A | √μA |
§3.2 The excluded middle fails
Slide L22-S14
In ordinary logic A OR NOT A = 1 and A AND NOT A = 0. In fuzzy logic at 30 °C, hot OR NOT hot = 0.8 and hot AND NOT hot = 0.2; at the crossover (33 °C) both are 0.5. Vague words really are partly true and partly false.
§3.3 Fuzzy rules and applications
Slide L22-S15
Rules use words: IF temperature is hot AND humidity is NOT dry THEN fan speed is fast (P08). Lecture 23 explains Mamdani and Sugeno inference (P09). Uses: Sendai subway (1987), washing machines, rice cookers, camera autofocus, air conditioners, irrigation controllers.
4. Common Mistakes
Wrong idea | Correct idea |
|---|---|
A degree is a probability. | Degree = fit of a word; probability = chance. |
Degrees in all terms add to 1. | Not required. |
'0.7/35' is a division. | It pairs a degree with a value. |
Fuzzy AND is multiplication. | Standard AND is min. |
very hot = 2 x hot. | very = μ². |
Word Bank
Word | Simple meaning | Example |
|---|---|---|
Fuzzy set | Set with degrees of membership | tall |
Crisp set | In or out only | height >= 183 cm |
Membership function | Gives each value its degree | trimf [15, 24, 33] |
Linguistic variable | Variable with word values | Temperature |
Support / core | Degree > 0 / degree = 1 | 15-33 / 24 |
Crossover | Degree 0.5 | 19.5 and 28.5 |
Hedge | Word that changes a term | very, somewhat |
Self-Check Questions
- Degree of 175 cm in 'tall'? Crisp answer? (see §1.1)
- What is a linguistic variable? Give its terms. (see §1.2)
- Explain the bottle example. (see §1.3)
- Degree of 26 °C in trimf [15, 24, 33]? (see §2.1)
- Support, core, crossover of trapmf [28, 38, 50, 50]? (see §2.2)
- Compute warm OR hot and NOT hot at 30 °C. (see §3.1)
Reading: Fuzzy Logic Toolbox User's Guide Ch 1 (fuzzy sets, membership functions, logical operations); scikit-fuzzy documentation.