Mamdani Fuzzy Inference System
Interactive demonstration of the Mamdani fuzzy inference system for determining clothing size based on height. This system demonstrates the four key steps of fuzzy logic: fuzzification, rule evaluation, aggregation, and defuzzification.
Input: Person's Height
Adjust the slider to change the input height value and observe how it affects the fuzzy inference process.
Step 1: Fuzzification (Input Membership Functions)
Convert the crisp input (height) into fuzzy values using membership functions. Each height value belongs to multiple fuzzy sets (Short, Average, Tall) with different degrees of membership.
Membership Values at 172cm:
μshort(172) = 0.00
μaverage(172) = 0.80
μtall(172) = 0.20
Step 2: Rule Evaluation
Evaluate fuzzy rules to determine the firing strength of each rule. The firing strength equals the membership value of the input in the rule's antecedent.
Rule 1: IF height is Short THEN size is S
Firing Strength = 0.00
Rule 2: IF height is Average THEN size is M
Firing Strength = 0.80
Rule 3: IF height is Tall THEN size is L
Firing Strength = 0.20
Step 3: Aggregation (Clipped and Scaled Output Sets)
Two methods are used to modify output membership functions: Clipping (Mamdani) cuts each function at the height of its rule's firing strength, while Scaling (Larsen) multiplies each function by its firing strength. Both methods then combine the modified sets using the MAX operation.
Clipping Method (Mamdani)
Each output set is "clipped" at the height of its rule's firing strength. The dashed lines show original membership functions, filled areas show clipped versions.
Scaling Method (Larsen)
Each output set is "scaled" by multiplying with its rule's firing strength. The dashed lines show original membership functions, filled areas show scaled versions.
Why Scaling is Preferred in Expert Systems: The scaling method preserves the original fuzzy set shape by proportionally reducing the membership values, rather than cutting them off. This means the relative distribution and shape of the membership function is maintained, which helps preserve more information about the uncertainty in the system. This makes scaling particularly useful in expert systems where maintaining the full context of the fuzzy information is important for decision-making.
Step 4: Defuzzification (Combined Output)
Convert the aggregated fuzzy output back into a crisp value using the centroid method. The centroid (center of gravity) of the aggregated output gives us the final recommended clothing size. Both clipping and scaling methods are shown.
Clipped Method (Mamdani) Result
Scaled Method (Larsen) Result
Final Crisp Output (Centroid Method):
Clipped Method (Mamdani):
Recommended Size = 41.1
Scaled Method (Larsen):
Recommended Size = 40.8
Calculation Method: Centroid (Center of Gravity)
Formula: Centroid = Σ(size × μ(size)) / Σ(μ(size))
Clipped Method (Mamdani) Calculation:
Calculation Breakdown:
Numerator = Σ(size × μ(size)) = 213.60
Denominator = Σ(μ(size)) = 5.20
Centroid = 213.60 / 5.20 = 41.08
Complete Calculation (14 contributing points):
Scaled Method (Larsen) Calculation:
Calculation Breakdown:
Numerator = Σ(size × μ(size)) = 163.20
Denominator = Σ(μ(size)) = 4.00
Centroid = 163.20 / 4.00 = 40.80
Complete Calculation (14 contributing points):
The centroid method calculates the weighted average of all size values, where each size is weighted by its aggregated membership value. This gives us the "center of gravity" of the fuzzy output set, which represents the most representative crisp value.
Summary
- Fuzzification: Height 172cm → μ values for Short, Average, Tall
- Rule Evaluation: Each rule fires with strength equal to its input membership
- Aggregation: Output sets are modified using clipping (Mamdani) or scaling (Larsen) methods, then combined using MAX
- Defuzzification: Centroid of combined output → Size 41.1 (Clipped) / 40.8 (Scaled)