CACS410 Artificial Intelligence

Artificial IntelligenceUnit 89 min read

Reasoning & Uncertainty: Probability, Bayes, Dempster-Shafer, Fuzzy Logic

Unit 8 of Artificial Intelligence explores how AI handles uncertainty using probabilistic reasoning, Bayesian networks, Dempster-Shafer theory, and fuzzy logic—essential for real-world decision-making in medical diagnosis, fraud detection, and autonomous systems.

TAKEAWAYS:

  • Probabilistic reasoning replaces deterministic logic when data is uncertain (e.g., "Is this email spam?").
  • Bayesian networks model dependencies between events (e.g., "Does rain cause traffic jams?").
  • Dempster-Shafer theory handles incomplete evidence better than probability (e.g., "Is this patient’s symptom A or B?").
  • Fuzzy logic deals with vague categories (e.g., "Is this traffic speed ‘slow’ or ‘fast’?").
  • Expected utility balances risk vs. reward (e.g., "Should a bank approve this loan?").
  • Real-world AI (e.g., eSewa fraud detection, Ncell network routing) uses these to make decisions under uncertainty.

1. Why Uncertainty Matters in AI

AI systems rarely face 100% certainty. Real-world data is noisy, incomplete, or ambiguous. For example:

  • eSewa must decide if a transaction is fraudulent (probability: 95% vs. 5%).
  • Pathao estimates delivery times despite traffic unpredictability (fuzzy logic: "slow," "medium," "fast").
  • Ncell’s 5G network routes calls probabilistically to avoid congestion.

Key Idea:

  • Inference = deriving conclusions from known facts (e.g., "If it rains, roads are slippery").
  • Reasoning = handling uncertainty (e.g., "There’s a 70% chance it will rain; should we cancel the trip?").

Visual: Inference vs. Reasoning

0.10.20.30.40.50.60.70.80.910.70.750.80.850.90.951yInference (Deterministic)Reasoning (Probabilistic)
Comparison: Deterministic inference (100% certainty) vs. probabilistic reasoning (70% chance of rain → 60% chance of slippery roads).

2. Probabilistic Reasoning

2.1 Basics: Probability Theory

Probability quantifies uncertainty using:

  • Joint probability: = chance of both A and B happening.
  • Conditional probability: = chance of A given B (e.g., "Probability of disease given symptoms").
  • Bayes’ Theorem:
    • : Probability of hypothesis given evidence .
    • Used in spam filters, medical diagnosis, and fraud detection.
01P(A) = 60%P(B) = 40%
Probability Space: P(A) + P(B) = 100% (complementary events).

Worked Example: eSewa Fraud Detection

  • Hypothesis (H): "This transaction is fraudulent."
  • Evidence (E): "User logged in from a new country."
  • Given:
    • (1% of transactions are fraudulent).
    • (90% of frauds come from new countries).
    • (5% of all transactions come from new countries).
  • Calculate : P(H|E) = \frac{0.9 \times 0.01}{0.05} = 0.18 \quad \text{(18% chance of fraud)} Decision: Flag for review (threshold: >15%).

2.2 Bayesian Networks

A Bayesian network is a directed acyclic graph (DAG) where:

  • Nodes = random variables (e.g., "Rain," "Traffic Jam").
  • Edges = conditional dependencies.
  • Each node has a Conditional Probability Table (CPT).

Example: Traffic Prediction for Kathmandu

[object Object][object Object][object Object][object Object]RainTraffic JamRoad WetDelay
Bayesian Network for Kathmandu Traffic Prediction: Nodes = variables; edges = conditional dependencies with CPTs.
  • CPT for "Traffic Jam":
    Rain Traffic Jam Probability
    No 0.1
    Yes 0.8

Worked Example: NTC Network Routing

  • Variables:
    • : "Server Overloaded" ().
    • : "User Requests High" (, ).
    • : "Route 1 Selected" (, ).
  • Question: What’s ?
    • Use law of total probability:
      • .
      • .
      • (57.3% chance Route 1 is selected).

3. Handling Incomplete Evidence: Dempster-Shafer Theory

Probability assumes all possibilities are known. Dempster-Shafer (DS) theory handles unknown or conflicting evidence by assigning:

  • Belief (Bel): Minimum probability.
  • Plausibility (Pl): Maximum probability.
  • Uncertainty (U): .

Example: Medical Diagnosis (Is the patient’s symptom A or B?)

  • Evidence 1: "Doctor sees rash" → Believes 60% it’s A, 30% it’s B, 10% unknown.
  • Evidence 2: "Patient reports fever" → Believes 50% it’s A, 40% it’s B, 10% unknown.
  • Combined belief:
    • .
    • .
    • Decision: More likely A (75% > 54%).

Visual: Belief vs. Probability

Belief (A) (54%)Belief (B) (39%)Unknown (7%)
Dempster-Shafer Belief Assignment: A (75%) > B (54%) due to combined evidence (vs. Probability: A=60%, B=40%).

4. Fuzzy Logic: Dealing with Vague Data

Fuzzy logic handles gradual transitions (e.g., "temperature is hot" vs. binary "hot/cold").

  • Membership functions assign degrees of truth (0 to 1).
  • Example: Traffic speed classification.

Worked Example: Pathao Delivery Speed

  • Input: Speed = 30 km/h.
  • Membership functions:
    • Slow: .
    • Medium: .
    • Fast: .
  • Calculations:
    • .
    • .
    • .
  • Output: "Speed is 50% slow, 75% medium" → Decision: "Medium speed; adjust ETA."

Visual: Fuzzy Membership Functions

51015202530354045500.10.20.30.40.50.60.70.8xyμₘ(30) = 0.75μ_f(30) = 0
Fuzzy Membership Functions for Speed: μₘ(30) = 0.75 (75% medium), μ_f(30) = 0 (0% fast).

5. Expected Utility Theory

AI agents should maximize expected utility, not just probability.

  • Utility: Value of an outcome (e.g., profit, safety).
  • Formula: where = possible outcomes.
0.10.20.30.40.50.60.70.80.9110203040506070xyExpected Utility (EU) for high-risk actionExpected Utility (EU) for low-risk action
Expected Utility Comparison: High-risk (70% chance of 100) vs. low-risk (90% chance of 50).

Worked Example: Bank Loan Approval (Nepal Bank)

  • Scenario: Approve or reject a loan.
  • Outcomes:
    • Approve:
      • Repayment: , (profit).
      • Default: , (loss).
    • Reject: .
  • Expected Utility:
    • Approve: .
    • Reject: .
  • Decision: Approve (higher EU).

6. Real-World Applications

In the Real World

Company/App AI Technique How It’s Used
eSewa Bayesian Networks Detects fraud by analyzing transaction patterns (e.g., "Unusual login location").
Pathao Fuzzy Logic Adjusts delivery ETAs based on vague traffic conditions ("slow," "medium," "fast").
Ncell Probabilistic Routing Chooses network paths with highest success probability to avoid drops.
Nepal Rastra Bank Expected Utility Approves loans balancing risk vs. profit.
Google Maps Dempster-Shafer Theory Handles incomplete traffic data (e.g., "Possible jam here, but not confirmed").

IMAGE: Real Outputs


7. Exam Tip

  1. Differentiate clearly:
    • Probability = known outcomes; Dempster-Shafer = unknown outcomes.
    • Fuzzy logic = gradual truth; binary logic = 0/1.
  2. Bayes’ Theorem is key:
    • Always show the formula and label , , .
  3. Real-world mapping:
    • Link eSewa fraud to Bayesian networks.
    • Link Pathao speeds to fuzzy logic.
  4. Expected Utility:
    • Compare of two options (e.g., "Approve vs. reject loan").
  5. Common Pitfalls:
    • Don’t confuse with .
    • In DS theory, belief ≠ probability.

Final Note: Uncertainty is everywhere in AI. Master these tools to build systems that make decisions despite imperfect data—just like eSewa, Pathao, and banks do every day.

Based on the TU BCA syllabus for Artificial Intelligence (CACS410), unit 8.

Discussion

Loading…