CMP346 Artificial Intelligence

Artificial IntelligenceUnit 106 min read

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

Unit 10 of Artificial Intelligence explores expert systems—how rule-based reasoning mimics human expertise in domains like medicine or finance—and their real-world applications in Nepal (e.g., Ncell’s fraud detection) and globally (e.g., IBM Watson). Covers forward/backward chaining, blackboard architecture, and AI’s s

What is an Expert System?

An expert system is an AI program that encodes human expertise in a specific domain (e.g., diagnosing diseases, configuring hardware) to solve complex problems. It consists of:

  • Knowledge Base (KB): Facts and rules (e.g., "If fever > 38°C and cough, then likely flu").
  • Inference Engine: Applies rules to derive conclusions (forward or backward chaining).
  • User Interface: Lets users input data and receive explanations.

How It Works: Forward vs. Backward Chaining

flowchart LR
    A["User Input: Symptoms = {fever, cough}"] --> B["Forward Chaining"]
    B --> C["Apply all rules matching symptoms"]
    C --> D["Conclude: Likely flu"]
    E["User Input: Goal = Diagnose flu"] --> F["Backward Chaining"]
    F --> G["Check if flu rules are satisfied"]
    G --> H["Request missing data: fever temp?"]
    H --> I["Conclude: flu"]

Key Difference:

  • Forward Chaining: Starts with data, fires rules to reach conclusions (data-driven).
  • Backward Chaining: Starts with a goal, works backward to find supporting data (goal-driven).

Knowledge Representation in Expert Systems

1. Production Rules (If-Then)

Rules are written as: IF <conditions> THEN <action/conclusion> [CONFIDENCE: x%] Example (Medical Diagnosis):

IF (temperature > 38 AND cough) THEN (diagnosis = flu) [CONFIDENCE: 85%]
IF (temperature > 38 AND rash) THEN (diagnosis = measles) [CONFIDENCE: 90%]

Worked Example: Loan Approval (Nepal’s Nabil Bank) Assume rules:

  1. IF (income ≥ 50,000 AND credit_score ≥ 700) THEN (approve_loan = YES)
  2. IF (income < 50,000 AND savings ≥ 200,000) THEN (approve_loan = YES)
  3. ELSE (approve_loan = NO)

Input: Income = 45,000, credit_score = 720, savings = 250,000. Trace:

  • Rule 1 fails (income < 50,000).
  • Rule 2 fires (savings ≥ 200,000) → Output: approve_loan = YES.

2. Frames and Objects

Frames group related data (e.g., a Patient frame):

Patient = {
    "name": "Ramesh",
    "symptoms": ["fever", "headache"],
    "tests": {"blood_pressure": 120/80}
}

Advantage: Organizes complex data hierarchically (e.g., Patient → symptoms → fever).


Blackboard Architecture

For problems requiring multiple experts (e.g., medical diagnosis), the blackboard model uses:

  • Blackboard: Shared memory where partial solutions are posted.
  • Knowledge Sources (KS): Independent experts (e.g., "Cardiology KS," "Radiology KS").
  • Control Module: Decides which KS to activate next.
graph TD
    A["Blackboard"] -->|"Posts"| B["Hypothesis: Pneumonia"]
    C["Cardiology KS"] -->|"Reads"| A
    D["Radiology KS"] -->|"Reads"| A
    E["Control Module"] -->|"Triggers"| C & D

Real-World Use: Ncell’s fraud detection system uses a blackboard to combine signals from call logs, transaction history, and device fingerprints.


Applications of Expert Systems

1. Nepal-Specific Examples

Application Expert System Role Company/Institution
Loan approval Rules for credit scoring, fraud detection Nabil Bank, Global IME Bank
Traffic signal control Optimizes signal timing to reduce congestion Kathmandu Metropolitan City
Agricultural advice Diagnoses crop diseases from farmer reports Agriculture Development Bank
Stock trading Predicts NEPSE trends using historical data Merostock, NMB Capital

2. Global Examples

Application Expert System How It Works
Medical diagnosis IBM Watson for Oncology Analyzes patient data + medical literature
Customer support Bank of America’s ERIKA Handles 2M+ customer queries/year
Manufacturing Siemens’ COMOS Configures plant layouts automatically

In the Real World

  1. eSewa’s Fraud Detection

    • Idea Used: Rule-based expert system with backward chaining.
    • How: If a transaction flagged as "unusual" (e.g., sudden large payment), the system checks rules like:
      • IF (amount > 50,000 AND location ≠ user’s usual) THEN request OTP.
    • Impact: Blocks 90% of fraudulent transactions without human review.
  2. Pathao’s Driver Routing

    • Idea Used: Constraint satisfaction (a type of expert system).
    • How: Rules like:
      • IF (driver_location = A AND destination = B AND traffic_alert = HIGH) THEN reroute via C.
    • Impact: Reduces delivery time by 20% during peak hours.
  3. NTC’s Network Fault Diagnosis

    • Idea Used: Blackboard model.
    • How: Multiple "experts" (e.g., "Cable KS," "Hardware KS") post hypotheses (e.g., "Fault in tower X") on a shared blackboard until the root cause is identified.
    • Impact: Cuts repair time from hours to minutes.

Exam Tip

  1. Define Clearly: Start answers with:
    • "An expert system is a rule-based AI program that..."
    • "Forward chaining vs. backward chaining differ in..."
  2. Draw Diagrams: For blackboard architecture or rule-firing traces, sketch:
    • A blackboard with arrows from KSs.
    • A rule-chaining flowchart (like the loan example above).
  3. Compare Tables: Memorize the Nepal vs. Global application table for short-answer questions.
  4. Worked Examples: Always show step-by-step traces (like the loan approval) for numerical problems.
  5. Real-World Links: Examiners love connections to eSewa, Ncell, or NTC. Mention these in explanations.

Limitations and Challenges

Challenge Cause Solution
Brittleness Rules fail on unseen data Hybrid systems (e.g., rules + ML)
Knowledge Acquisition Experts are expensive/time-consuming Use semi-automated tools (e.g., Inductive Logic Programming)
Scalability Rule sets grow unmanageably large Modularize into micro-expert systems
Lack of Common Sense Cannot infer implicit knowledge Integrate with NLP (e.g., chatbots)

IMAGE: "expert system blackboard architecture diagram" | Blackboard model showing Knowledge Sources (KS) posting to shared memory

IMAGE: "ibm watson interface screenshot" | IBM Watson’s medical diagnosis dashboard

IMAGE: "ncell fraud detection alert" | SMS alert from Ncell showing a blocked fraudulent transaction

IMAGE: "pathao driver app route optimization" | Pathao’s app screen showing rerouted path due to traffic

Based on the PU BE Computer (PU) syllabus for Artificial Intelligence (CMP346), unit 10.

Discussion

Loading…