Elective DSS and Expert System

DSS and Expert SystemUnit 510 min read

Fuzzy Logic, Fuzzy Sets, Fuzzy Rules, and Applications

Unit 5 of DSS and Expert System explores fuzzy logic principles, fuzzy set theory, fuzzy inference systems, and their applications in decision support and expert systems, contrasting them with crisp logic and traditional expert systems.

TAKEAWAYS:

  • Fuzzy logic extends classical logic by allowing partial truth values (between 0 and 1) to model uncertainty and vagueness in real-world data.
  • Fuzzy sets represent elements with degrees of membership (e.g., "tall" = 0.7) instead of binary membership (0 or 1).
  • Fuzzy inference systems use rules like "IF temperature IS high AND humidity IS low THEN fan_speed IS medium" to make decisions under uncertainty.
  • Defuzzification converts fuzzy outputs into crisp actions (e.g., "turn fan speed to 60%").
  • Applications include air conditioners (adjusting temperature based on fuzzy rules), washing machines (optimizing cycles), and medical diagnosis systems.
  • Advantages over crisp systems: handles imprecise data, mimics human reasoning, and works well with sensor-based real-time decisions.

1. Introduction to Fuzzy Logic and Fuzzy Sets

Classical (crisp) logic uses binary values: true (1) or false (0). However, real-world data is often vague or imprecise. For example:

  • "Is 170 cm tall?" → Crisp logic says no (if the threshold is 180 cm), but intuitively, 170 cm is somewhat tall.
  • Fuzzy logic allows degrees of truth (e.g., 0.6 for "tall").
μ=0.6 (medium)μ=1.0 (present)FeverHeadacheDengue Probability
Fuzzy rule network: IF fever=medium AND headache=present THEN dengue probability=0.7

Fuzzy Sets vs. Crisp Sets

Feature Crisp Set Fuzzy Set
Membership Binary (0 or 1) Continuous (0 to 1)
Example "Temperature > 30°C" "Temperature is hot" (0.8)
Representation Sharp boundaries Gradual transitions
Use Case Exact measurements Human-like reasoning
012345678910Crisp Set (3 ∈ A)Fuzzy Set (μ=0.7)
Crisp vs. Fuzzy membership: 3 is either in A (1) or not (0); 5 has partial membership (0.7)

2. Membership Functions: How Fuzzy Logic Quantifies Vagueness

A membership function (μ) assigns a degree of membership to each input. Common shapes:

  1. Triangular: Simple, defined by three points (e.g., "low," "medium," "high" speed).
  2. Trapezoidal: Flat top for a range of values (e.g., "very hot" from 35°C to 45°C).
  3. Gaussian: Smooth bell curve (e.g., "pressure is normal").

Example: Defining "Speed" for a Car Assume speed ranges from 0 to 120 km/h. Define fuzzy sets:

  • Slow: Triangular (0, 0, 40)
  • Medium: Triangular (30, 60, 90)
  • Fast: Triangular (80, 120, 120)

For speed = 50 km/h:

  • μ(Slow) = 0 (outside range)
  • μ(Medium) = (60 - 50)/(60 - 30) = 0.67
  • μ(Fast) = 0

102030405060708090100-1-0.50.511.522.5xySlow (μ=0)Medium (μ=0.67 at x=60)Fast (μ=0)Slow → MediumMedium → FastSpeed (km/h)
Triangular membership functions for 'Slow', 'Medium', and 'Fast' speeds (μ=0.67 at 60 km/h)

3. Fuzzy Inference System (FIS): Rules and Reasoning

A fuzzy inference system mimics human decision-making using:

  1. Fuzzification: Convert crisp inputs to fuzzy sets.
  2. Rule Evaluation: Apply fuzzy rules (IF-THEN statements).
  3. Aggregation: Combine rule outputs.
  4. Defuzzification: Convert fuzzy output to a crisp action.

Example: Air Conditioner Control

Inputs:

  • Temperature (T) ∈ [20°C, 40°C]
  • Humidity (H) ∈ [30%, 90%]

Fuzzy Sets:

  • T: {Cold, Warm, Hot}
  • H: {Low, Medium, High}

Rules (5 examples):

  1. IF T = Hot AND H = Low THEN Fan = High
  2. IF T = Warm AND H = Medium THEN Fan = Medium
  3. IF T = Cold AND H = High THEN Fan = Low
  4. IF T = Hot AND H = High THEN Fan = Very High
  5. IF T = Warm AND H = Low THEN Fan = Low

Worked Example:

  • Crisp Inputs: T = 32°C, H = 40%
  • Fuzzification:
    • μ(Hot) = 0.8 (from triangular function peaking at 35°C)
    • μ(Low) = 0.6 (from trapezoidal function for humidity ≤ 50%)
  • Rule Firing:
    • Rule 1 fires with strength = min(0.8, 0.6) = 0.6
    • Rule 5 does not fire (H is not Low).
  • Aggregation: Combine outputs (e.g., weighted average).
  • Defuzzification: Centroid method → Fan speed = 75%.

4. Defuzzification Methods

Convert fuzzy outputs to crisp values. Common methods:

  1. Centroid (COG): Calculate the center of gravity of the output.
    • Formula:
  2. Max-Membership: Choose the z with the highest μ(z).
  3. Weighted Average: Use rule strengths as weights.

Example (Centroid Method): Suppose the output fuzzy set for "Fan speed" has:

  • μ(50%) = 0.3
  • μ(75%) = 0.8
  • μ(100%) = 0.1 Then:

5. Fuzzy Expert Systems vs. Traditional Expert Systems

Feature Traditional Expert System Fuzzy Expert System
Logic Type Crisp (binary) Fuzzy (degrees of truth)
Data Handling Exact, symbolic Imprecise, sensor-based
Rule Complexity Simple IF-THEN Handles uncertainty (e.g., "IF T ≈ Hot")
Example Applications Medical diagnosis (symptoms → disease) Air conditioner control, stock trading
Advantage Precise for well-defined problems Robust for noisy/real-world data

6. Applications of Fuzzy Expert Systems

In the Real World

  1. Air Conditioners (e.g., Daikin, LG)

    • Idea Used: Fuzzy logic adjusts temperature and fan speed based on imprecise inputs like "room feels warm" (sensor data + user feedback).
    • How: Rules like "IF temperature > 28°C AND humidity > 60% THEN cooling_power = high."
  2. Washing Machines (e.g., Samsung, LG)

    • Idea Used: Fuzzy control optimizes wash cycles based on dirty level (fuzzy sets: "light," "medium," "heavy") and fabric type.
    • How: "IF dirt = heavy AND fabric = cotton THEN water_level = high AND time = long."
  3. Stock Market Prediction (e.g., Trading Bots)

    • Idea Used: Fuzzy rules analyze vague indicators like "market sentiment is bearish" (combining news, volume, and price trends).
    • How: "IF sentiment = negative AND volume = high THEN sell 30%."
  4. Traffic Light Control (e.g., Smart Cities)

    • Idea Used: Adjusts signal timings based on fuzzy traffic density (e.g., "lane is congested" = μ = 0.7).
    • How: "IF north_south_traffic = high AND east_west_traffic = low THEN green_time = long (north-south)."
  5. Medical Diagnosis (e.g., Fuzzy-Based AI Tools)

    • Idea Used: Handles uncertain symptoms (e.g., "fever is slightly high" = μ = 0.6).
    • How: "IF fever = medium AND headache = present THEN probability(dengue) = 0.7."


7. Designing a Fuzzy Expert System: Step-by-Step

  1. Problem Identification: Define the system goal (e.g., "optimize AC cooling").
  2. Input/Output Variables: List variables (e.g., temperature, humidity, fan speed).
  3. Fuzzification: Define membership functions for each input/output.
  4. Rule Base: Create IF-THEN rules (e.g., 10–20 rules for a simple system).
  5. Inference Engine: Implement rule evaluation (e.g., min/max operators).
  6. Defuzzification: Choose a method (centroid, max-membership).
  7. Testing: Validate with real-world data (e.g., AC in a room).

Worked Example: Simple Loan Approval System Inputs:

  • Credit Score (CS): {Poor, Fair, Good, Excellent}
  • Income (I): {Low, Medium, High}

Output:

  • Loan Amount (LA): {Small, Medium, Large}

Rules:

  1. IF CS = Excellent AND I = High THEN LA = Large
  2. IF CS = Fair AND I = Medium THEN LA = Small
  3. IF CS = Poor THEN LA = Reject

Crisp Inputs: CS = 650 (μ(Fair) = 0.8, μ(Good) = 0.2), I = 50,000 (μ(Medium) = 0.9) Fired Rules:

  • Rule 2: min(0.8, 0.9) = 0.8 → LA = Small (weighted)
  • Rule 3: μ(Poor) = 0 → no firing Defuzzification (Centroid):
  • Suppose Small = 50,000; Medium = 100,000; Large = 200,000.
  • Output = (0.8 × 50,000) / 0.8 = 50,000 (approved loan).

8. Advantages and Limitations

Advantages:

  • Handles uncertainty: Works with imprecise or noisy data.
  • Human-like reasoning: Mimics how humans make decisions (e.g., "kind of hot").
  • Real-time adaptability: Used in control systems (e.g., anti-lock brakes).
  • Reduces complexity: Avoids precise mathematical models.

Limitations:

  • Rule explosion: Too many rules can slow down the system.
  • Tuning difficulty: Membership functions and rules require expert knowledge.
  • Black-box nature: Hard to explain why a decision was made (unlike crisp systems).

Exam Tip

  1. Understand the Core Concepts:

    • Memorize the difference between crisp and fuzzy sets.
    • Know the 4 steps of fuzzy inference (fuzzification, rule evaluation, aggregation, defuzzification).
    • Recall defuzzification methods (centroid, max-membership).
  2. Practical Questions:

    • Expect worked examples (e.g., given temperature/humidity, calculate fan speed).
    • Be ready to draw membership functions (triangular/trapezoidal) and explain rule firing.
    • Compare fuzzy vs. traditional expert systems in a table.
  3. Application-Based Questions:

    • Link fuzzy logic to real-world systems (AC, washing machines, traffic lights).
    • Example question: "A fuzzy expert system is used to control a water heater. The input is water temperature (Cold, Warm, Hot) and the output is heater power (Low, Medium, High). Define 3 fuzzy rules and show how a crisp input of 45°C is processed."
  4. Common Pitfalls:

    • Miscounting rule strengths: Always use min for AND, max for OR.
    • Incorrect defuzzification: Double-check centroid calculations.
    • Overcomplicating rules: Stick to 5–10 rules for exam questions.

Based on the TU BIT syllabus for DSS and Expert System, unit 5.

Discussion

Loading…