Skip to main content

CHAPTER 6: ARTIFICIAL INTELLIGENCE

6.1 INTRODUCTION TO AI

6.1.1 Definition

Artificial Intelligence: The ability of computers to perform tasks that usually only humans would be able to do (decision-making, speech recognition, etc.).

Machine Learning (ML): A subfield of AI where computers learn to perform tasks without being explicitly programmed. Uses historical training data to produce a model for predictions.

Deep Learning (DL): A subset of ML where computers learn using neural networks similar to human brain function.

6.1.2 Types of Machine Learning

Supervised Learning:

  • Trained on labelled data
  • Known inputs and outputs
  • Model learns from examples
  • Used for classification and regression

Unsupervised Learning:

  • Trained on unlabelled data
  • Finds hidden patterns
  • Groups similar data
  • Used for clustering

Reinforcement Learning:

  • Reward-based system
  • Agent learns from actions
  • Not given specific instructions
  • Learns from trial and error

6.1.3 Classification, Regression, and Clustering

Classification:

  • Split data into predefined groups
  • Example: Spam/not spam email

Regression:

  • Predict value based on explanatory variable
  • Used for forecasting
  • Examples: Weather, sales, prices

Clustering:

  • Split data into groups based on features
  • Groups not predefined
  • Used for pattern discovery

6.2 ARTIFICIAL NEURAL NETWORKS

6.2.1 Structure

Layers:

  1. Input Layer: Accepts inputs in various formats
  2. Hidden Layers: Perform calculations, find patterns
  3. Output Layer: Provides results

Nodes:

  • Connected to nodes in adjacent layers
  • Each connection has weight
  • Data passes through network

6.2.2 Back Propagation

Definition: "Backward propagation of errors" - standard method for training neural networks.

Process:

  1. Input data fed to network
  2. Network generates output
  3. Output compared to expected result
  4. Error calculated
  5. Error propagated backwards through network
  6. Weights adjusted
  7. Process repeated until acceptable error

6.2.3 Graph Theory in AI

Graph Components:

  • Nodes: Fundamental units (represent objects)
  • Edges: Lines connecting nodes (represent relationships)

Real-World Uses:

  • Social media (users as nodes, friendships as edges)
  • Google Maps (locations as nodes, roads as edges)

In AI:

  • Represent ANN structure
  • Find paths in problem solving
  • Algorithms examine graphs

6.3 GRAPH SEARCH ALGORITHMS

6.3.1 Dijkstra's Algorithm

Purpose: Find shortest path between nodes in weighted graph.

How It Works:

  1. Start at initial node
  2. Calculate distances to all connected nodes
  3. Select node with smallest distance
  4. Update distances through that node
  5. Repeat until destination reached

Limitations:

  • No heuristics (searches all directions)
  • Inefficient on large networks
  • Cannot handle negative weights

6.3.2 A* Algorithm

Purpose: Informed search algorithm using heuristics to find shortest path efficiently.

Formula:

<TEXT>

F = G + H
  • G: Movement cost from start
  • H: Heuristic (estimated cost to goal)
  • F: Total estimated cost

Advantages over Dijkstra:

  • Uses heuristics to guide search
  • More efficient
  • Finds goal faster