Artificial IntelligenceUnit 107 min read

Expert Systems & AI Applications: Rules, Inference, and Real-World Impact

Unit 10 of Artificial Intelligence explores expert systems—how rule-based reasoning mimics human expertise, their architecture (knowledge base, inference engine, user interface), and real-world applications in medicine, finance, and more. Covers forward/backward chaining, certainty factors, and AI’s societal impact, wi

What is an Expert System?

An expert system is an AI program that uses knowledge and inference rules to solve problems in a specific domain, mimicking a human expert’s decision-making. It consists of three core components:

classDiagram
    class KnowledgeBase {
        +Facts (declarative knowledge)
        +Rules (if-then statements)
    }
    class InferenceEngine {
        +Forward Chaining (data-driven)
        +Backward Chaining (goal-driven)
        +Certainty Factors (uncertainty handling)
    }
    class UserInterface {
        +Explanation Facility
        +Query Handling
    }
    KnowledgeBase --> InferenceEngine : "Uses"
    InferenceEngine --> UserInterface : "Drives"

Key Definitions

  • Knowledge Base (KB): Stores domain-specific facts and rules (e.g., "If fever > 38°C and cough then possible flu").
  • Inference Engine: Applies logical rules to derive conclusions (forward/backward chaining).
  • Explanation Facility: Justifies decisions to users (critical for trust).

How Expert Systems Work: Forward vs. Backward Chaining

1. Forward Chaining (Data-Driven)

Starts with known facts and applies rules to reach conclusions. Used when the goal is unknown but data is abundant. Example: Medical diagnosis system.

graph TD
    A["Facts: Fever=38.5°C, Cough=Yes"] --> B["Rule 1: If Fever>38°C then PossibleInfection=True"]
    B --> C["Rule 2: If PossibleInfection=True and Cough=Yes then PossibleFlu=True"]
    C --> D["Conclusion: PossibleFlu=True"]

Worked Example: Facts:

  • Patient temperature = 39°C
  • Patient has headache
  • Patient has fatigue

Rules:

  1. If temperature > 38°C then possible_infection = True
  2. If possible_infection = True and headache = True then possible_flu = True
  3. If possible_flu = True and fatigue = True then diagnose = "Flu"

Trace:

  1. Rule 1 fires → possible_infection = True
  2. Rule 2 fires → possible_flu = True
  3. Rule 3 fires → diagnose = "Flu"

2. Backward Chaining (Goal-Driven)

Starts with a hypothesis and works backward to verify it. Used when the goal is known but data is incomplete. Example: Loan approval system.

graph TD
    A["Goal: ApproveLoan?"] --> B["Rule: If CreditScore>700 and Income>50000 then ApproveLoan=True"]
    B --> C["Check CreditScore"]
    B --> D["Check Income"]
    C --> E["CreditScore=750"]
    D --> F["Income=60000"]
    E & F --> G["ApproveLoan=True"]

Worked Example: Goal: Can the customer get a loan? Rules:

  1. If credit_score > 700 and income > 50,000 then approve_loan = True
  2. If income < 30,000 then reject_loan = True

Trace:

  1. Start with goal: approve_loan?
  2. Check Rule 1: Need credit_score and income.
    • Query credit_score → returns 750 (satisfies >700).
    • Query income → returns 60,000 (satisfies >50,000).
  3. Conclusion: approve_loan = True.

Handling Uncertainty: Certainty Factors

Real-world data is often uncertain. Certainty Factors (CF) assign confidence levels (0–1) to rules and conclusions. Formula: Where:

  • = weight of rule (e.g., 0.8 for "If cough then flu").
  • = certainty of premise (e.g., 0.7 for "Patient has cough").

Worked Example: Facts:

  • Cough (CF = 0.7)
  • Fever (CF = 0.6)

Rules:

  1. If cough then flu (CF = 0.8)
  2. If fever then flu (CF = 0.7)

Calculation:

  1. For Rule 1:
  2. For Rule 2:
  3. Combine using OR (max):

Conclusion: Flu diagnosis with 94% confidence.


Applications of Expert Systems

In Nepal:

  1. eSewa (Nepal Government):

    • Use: Automated tax filing and business registration.
    • AI Idea: Rule-based validation of documents (e.g., "If PAN card expired then reject application").
    • Impact: Reduces human error in 10,000+ daily submissions.
  2. Ncell Customer Support Chatbot:

    • Use: Troubleshooting network issues.
    • AI Idea: Decision tree for diagnostics (e.g., "If signal weak and area rural then suggest tower upgrade").
    • Impact: Handles 30% of tier-1 queries without human agents.
  3. Nepal Rastra Bank (NRB) Loan Approval:

    • Use: Credit scoring for SMEs.
    • AI Idea: Backward chaining to verify loan eligibility (e.g., "If turnover > 5M and repayment history good then approve").

Globally:

  1. IBM Watson (Healthcare):

    • Use: Oncology treatment recommendations.
    • AI Idea: Forward chaining over medical literature to suggest therapies.
  2. SAP’s AI for Supply Chain (Daraz, Amazon):

    • Use: Predictive inventory management.
    • AI Idea: Certainty factors for demand forecasting (e.g., "If monsoon delay then rice demand CF=0.9").
  3. WhatsApp Business API (Pathao, Food Delivery):

    • Use: Automated order routing.
    • AI Idea: Rule-based dispatch (e.g., "If rider distance < 5km and order urgent then prioritize").

Advantages and Limitations

Advantages Limitations
Captures expertise for reuse Knowledge acquisition is time-consuming
Consistent decisions (no bias) Struggles with ambiguous/unstructured data
Explains reasoning (transparency) Poor adaptability to new data
Low operational cost after deployment High initial development cost

Real-World Example: Kathmandu Traffic Management

Problem: Congestion on Ring Road during peak hours (7–9 AM). Expert System Solution:

  1. Knowledge Base:
    • Rule 1: If traffic density > 80 vehicles/km then activate signal priority.
    • Rule 2: If accident reported and ambulance en route then clear lane 3.
  2. Inference Engine: Forward chaining to trigger actions in real-time.
  3. Impact: Reduced delays by 25% in pilot tests (used by NTC’s smart traffic project).

Exam Tip

  1. Diagrams are mandatory: Always draw the 3-component architecture (KB, inference engine, UI) and chaining traces (forward/backward).
  2. Certainty factors: Memorize the formula and practice combining rules (e.g., "If A or B then C").
  3. Case studies: Link to eSewa, Ncell, or NRB for application questions. Example:

    "How would you design an expert system for Daraz’s order fulfillment?" Answer: Use backward chaining to verify stock → shipping rules → delivery constraints.

  4. Weaknesses: Expect questions on why expert systems fail for unstructured data (e.g., social media sentiment).
  5. Maths: Show step-by-step CF calculations for uncertainty questions.

Based on the TU BIM syllabus for Artificial Intelligence (IT228), unit 10.

Discussion

Loading…