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:
- Input Layer: Accepts inputs in various formats
- Hidden Layers: Perform calculations, find patterns
- 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:
- Input data fed to network
- Network generates output
- Output compared to expected result
- Error calculated
- Error propagated backwards through network
- Weights adjusted
- 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:
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:
- Start at initial node
- Calculate distances to all connected nodes
- Select node with smallest distance
- Update distances through that node
- 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:
- 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