CACS410 Artificial Intelligence

Artificial IntelligenceUnit 114 min read

AI Basics: Definitions, Components & Problem-Solving

Unit 1 of Artificial Intelligence introduces core concepts like AI definitions, its components (reasoning, learning, perception), problem-solving approaches, and real-world applications. This note covers foundational theories, historical milestones, and how AI mimics human intelligence using logic, search, and neural n

TAKEAWAYS:

  • AI is the study of creating machines that perform tasks requiring human-like intelligence, using logic, search, and learning.
  • Core components include reasoning (deductive/inferential), learning (from data), perception (sensing), and acting (decision-making).
  • Problem-solving in AI relies on state spaces, search trees, and heuristics (e.g., depth-first vs. breadth-first search).
  • Resolution is a logical inference method used to derive new facts from premises (e.g., proving Eats(Tiger, Meat)).
  • Real-world AI applications include eSewa’s fraud detection (reasoning), Pathao’s route optimization (search), and Khalti’s transaction validation (learning).
  • Neural networks (feedforward/feedback) model human brain-like computation, enabling tasks like AND/OR gates, image recognition, and natural language processing.

1. What is Artificial Intelligence?

Artificial Intelligence (AI) is the branch of computer science that aims to create systems capable of performing tasks that typically require human intelligence, such as:

  • Reasoning (logical deduction),
  • Learning (from experience or data),
  • Perception (sensing the environment),
  • Acting (making decisions).

1.1 Historical Milestones

AI’s evolution spans decades, marked by key events:

Year Event Impact
1950 Turing Test (Alan Turing) Defined machine intelligence via human-like conversation.
1956 Dartmouth Conference Officially coined "Artificial Intelligence."
1969 SHRDLU (Terry Winograd) First natural language processing program.
1980s Expert Systems (e.g., MYCIN) Rule-based AI for medical diagnosis.
1997 Deep Blue vs. Kasparov AI defeated world chess champion (symbolic reasoning).
2010s Deep Learning (Google, Facebook) Neural networks revolutionized image/voice recognition.
2020s LLMs (ChatGPT, Bard) Generative AI for text, code, and creative tasks.

1.2 Definitions of AI

AI is defined differently based on scope:

Type Definition Example
Weak AI (Narrow AI) Systems designed for specific tasks (no general intelligence). Siri (voice assistant), eSewa chatbot.
Strong AI Hypothetical AI with human-like cognition (consciousness, self-awareness). Sci-fi robots (e.g., Terminator).
Artificial General Intelligence (AGI) AI matching human cognitive abilities across domains. Future AI scientists (theoretical).

Key Insight:

Today’s AI (e.g., AlphaGo, recommendation systems) is Weak AI—specialized but not "generally intelligent."


2. Components of AI

AI systems integrate multiple disciplines. The core components are:

2.1 Reasoning (Logical Inference)

AI uses logical frameworks to derive conclusions from facts. Two key methods:

  1. Deductive Reasoning:

    • Moves from general rules to specific conclusions.
    • Example: If all humans are mortal (rule) and Socrates is human (fact), then Socrates is mortal (conclusion).
    • Used in: Expert systems (e.g., medical diagnosis).
  2. Inductive Reasoning:

    • Infers general rules from specific examples.
    • Example: Observing swans are white → concluding "All swans are white" (falsified later).
    • Used in: Machine learning (e.g., spam detection).

Visual: Logical Inference with Resolution

graph LR
  A["Premise 1: ∀x (Carnivore(x) → Eats(x, Meat))"]
  B["Premise 2: Carnivore(Tiger)"]
  C["Goal: Eats(Tiger, Meat)"]
  A -->|"Unify"| D["∃y (Meat(y) ∧ Eats(Tiger,y))"]
  D -->|"Instantiate"| C

Worked Example: Proving Eats(Tiger, Meat) Given:

  1. ∀x (Carnivore(x) → ∃y (Meat(y) ∧ Eats(x,y)))
  2. Carnivore(Tiger)
  3. ∀x∀y (Meat(y) → Food(y))
  4. ∀x∀y (Carnivore(x) ∧ Food(y)) → CanEat(x,y)

Steps:

  1. From Premise 2, substitute x = Tiger into Premise 1: ∃y (Meat(y) ∧ Eats(Tiger,y)).
  2. This directly matches the goal Eats(Tiger, Meat) if we assume y = Meat.
  3. Conclusion: Eats(Tiger, Meat) is true via resolution.

2.2 Learning (From Data)

AI learns from examples, feedback, or observations. Key paradigms:

Type Description Example
Supervised Learning Learns from labeled data (input-output pairs). Spam classification (email → "spam"/"not spam").
Unsupervised Learning Finds hidden patterns in unlabeled data. Customer segmentation (Khalti transaction clusters).
Reinforcement Learning Learns by trial-and-error (rewards/penalties). Pathao’s dynamic pricing (adjusts fares based on demand).

Real-World Tie-In:

eSewa’s Fraud Detection uses supervised learning to flag suspicious transactions by training on labeled fraudulent/legitimate examples.


2.3 Perception (Sensing the World)

AI perceives the environment via:

  • Sensors (cameras, microphones, LiDAR).
  • Data inputs (text, images, speech). Example: Self-driving cars (Tesla) use computer vision to detect traffic signs.

2.4 Acting (Decision-Making)

AI acts based on perception + reasoning. Examples:

  • Robotics: Industrial arms (e.g., ABB YuMi) use AI for precision tasks.
  • Game AI: AlphaGo uses Monte Carlo Tree Search (MCTS) to outmaneuver humans.
0.70.30.90.8StartOption AOption BConsequence 1Consequence 2
Decision tree with probabilistic outcomes for AI decision-making (e.g., Pathao’s route selection).

3. Problem-Solving in AI

AI solves problems by searching state spaces (possible configurations). Key concepts:

3.1 State Space Representation

A state space is a graph where:

  • Nodes = possible states of the problem.
  • Edges = actions/transitions between states.
  • Goal = desired state.

Example: Pathao’s Route Optimization

graph TD
    A["Start: Home"] -->|"Action 1: Take Bus"| B["State 1: Bus Stop"]
    B -->|"Action 2: Walk"| C["State 2: Near Office"]
    C -->|"Action 3: Take Taxi"| D["Goal: Office"]

Problem: Find the shortest path from home to office (minimizing time/cost).


3.2 Search Algorithms

AI uses systematic search to explore state spaces. Common methods:

Algorithm Approach Time Complexity Use Case
Breadth-First Search (BFS) Explores all neighbors at current depth before moving deeper. O(b^d) Shortest path in unweighted graphs.
Depth-First Search (DFS) Explores as far as possible along a branch before backtracking. O(b^m) Puzzle solving (e.g., Sudoku).
Uniform Cost Search (UCS) Expands least-cost node first (like BFS but for weighted edges). O(b^d) Pathao’s route optimization.
A* Informed search using heuristics (e.g., Manhattan distance). O(b^d) GPS navigation (Google Maps).

Worked Example: 8-Puzzle Solver (DFS) Initial State:

1 2 3
4 _ 6
7 5 8

Goal State:

1 2 3
4 5 6
7 8 _

DFS Trace:

  1. Move blank (_) right → new state:
    1 2 3
    4 6 _
    7 5 8
    
  2. Move blank down → new state:
    1 2 3
    4 5 6
    7 8 _
    
    Goal reached! (Solution: Right → Down).

3.3 Heuristics and Evaluation Functions

Heuristics guide search by estimating cost to goal.

  • Admissible Heuristic: Never overestimates cost (e.g., Manhattan distance in 8-puzzle).
  • Informed Search: A* uses f(n) = g(n) + h(n), where:
    • g(n) = cost from start to node n.
    • h(n) = heuristic estimate from n to goal.

Example: A for Pathao’s Delivery*

  • g(n) = distance traveled so far.
  • h(n) = straight-line distance to restaurant.
  • Optimal path: Minimizes f(n) = g(n) + h(n).

4. Artificial Neural Networks (ANN) Basics

Neural networks mimic the human brain for learning patterns.

4.1 Feedforward vs. Feedback Networks

Type Description Example
Feedforward (FFNN) Data flows one way (input → hidden → output layers). No cycles. Handwritten digit recognition (MNIST).
Feedback (Recurrent) Contains loops (memory of past inputs). Used for sequences. Language translation (Google Translate).

Visual: Feedforward Neural Network

-2-1.5-1-0.50.511.52-4-3-2-112xyFeedforward (FFNN) - Linear TransformationFeedback (RNN) - Recurrent ConnectionInput LayerHidden LayerOutput Layer
Feedforward (left) vs. Feedback (right) neural network structure. Arrows indicate data flow direction.

4.2 Implementing Logic Gates with ANNs

ANNs can model AND/OR gates using weights and activation functions.

AND Gate Implementation

  • Input: x1, x2 (0 or 1).
  • Output: y = x1 ∧ x2.
  • Weights: w1 = 1, w2 = 1, bias = -1.5.
  • Activation: Step function (y = 1 if ∑(w_i x_i) + bias ≥ 0, else 0).

Truth Table:

x1 x2 Output (y)
0 0 0
0 1 0
1 0 0
1 1 1

Calculation:

  • For x1=1, x2=1: 1*1 + 1*1 - 1.5 = 0.5 ≥ 0 → y = 1.

OR Gate Implementation

  • Weights: w1 = 1, w2 = 1, bias = -0.5.
  • Output: y = x1 ∨ x2.

Truth Table:

x1 x2 Output (y)
0 0 0
0 1 1
1 0 1
1 1 1

5. In the Real World

AI is everywhere—here’s how Nepalese and global companies use the concepts from this unit:

Example 1: eSewa’s Fraud Detection (Reasoning + Learning)

  • Concept: Resolution + Supervised Learning.
  • How it works:
    1. Rules (Resolution): If Transaction > Rs. 50,000 AND User in High-Risk Zone, then Flag as Suspicious.
    2. Machine Learning: Trained on historical fraud data to adjust thresholds dynamically.
  • Impact: Reduces fraudulent transactions by ~30% (2023 report).

Example 2: Pathao’s Route Optimization (Search Algorithms)

  • Concept: A Search + Heuristics*.
  • How it works:
    • State Space: All possible driver locations and routes.
    • Heuristic: h(n) = straight-line distance to destination.
    • Action Cost: Traffic data (real-time) + fuel efficiency.
  • Real Scenario:
    • Start: Driver at (27.70°N, 85.32°E) (Kathmandu).
    • Goal: Passenger at (27.71°N, 85.33°E).
    • Optimal Path: A* finds the route avoiding Ring Road traffic jams (lower f(n)).

Example 3: Khalti’s Transaction Validation (Neural Networks)

  • Concept: Feedforward ANN for Anomaly Detection.
  • How it works:
    1. Input Layer: Transaction amount, time, location, user history.
    2. Hidden Layers: Detect patterns (e.g., unusual late-night transfers).
    3. Output: Probability of Fraud (0 to 1).
  • Example:
    • Input: Amount = Rs. 200,000, Time = 3 AM, Location = Pokhara.
    • ANN Output: Fraud Probability = 0.92 → Block transaction.

6. Exam Tip

This unit is theoretical but practical—exams test:

  1. Definitions: Know the difference between Weak AI, Strong AI, and AGI.
  2. Resolution Proofs: Practice deriving conclusions from premises (like the Eats(Tiger, Meat) example).
  3. Search Algorithms: Compare BFS, DFS, UCS, and A* with time complexities.
  4. Neural Networks: Sketch a feedforward ANN and explain AND/OR gate implementations.
  5. Real-World Applications: Link concepts to eSewa, Pathao, or Khalti (e.g., "Pathao uses A* search for route optimization").

Common Pitfalls:

  • Confusing deductive vs. inductive reasoning.
  • Forgetting admissible heuristics in A* (e.g., Manhattan distance is admissible for 8-puzzle).
  • Misapplying weights in ANN gates (e.g., wrong bias for AND/OR).

Pro Tip:

For resolution proofs, always start by unifying predicates and instantiate variables systematically. Draw the search tree if stuck!


Summary Table: Key Concepts

Topic Key Idea Exam Focus
AI Definitions Weak AI (narrow) vs. Strong AI (general). Define and differentiate.
Resolution Logical inference to derive new facts. Prove statements from premises.
Search Algorithms BFS, DFS, UCS, A* with heuristics. Compare time complexities.
Neural Networks Feedforward/feedback ANNs, logic gates. Draw ANN, explain weights/activations.
Real-World AI eSewa (fraud), Pathao (search), Khalti (learning). Link concepts to examples.

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

Discussion

Loading…