Group B — Medium / Descriptive Questions (5 Marks Each)
Understanding the PEAS Model
The PEAS (Performance, Environment, Actuators, Sensors) model is a formal specification used to design and define an intelligent agent's task environment before constructing the agent itself. A clearly defined task environment ensures that the agent can make rational decisions to maximize its performance measure.
- Performance Measure (P): The objective criterion used to evaluate the agent's success or behavior.
- Environment (E): The external conditions and entities the agent interacts with and operates within.
- Actuators (A): The mechanisms or effectors the agent uses to perform actions and alter the environment.
- Sensors (S): The devices or inputs through which the agent perceives the state of the environment.
MEASURE (P)"] -.->|"evaluates"| E E["ENVIRONMENT (E)"] -->|"Percepts"| S subgraph AGENT["Intelligent Agent"] S["SENSORS (S)"] --> F["Agent
Program"] F --> A["ACTUATORS (A)"] end A -->|"Actions"| E style AGENT fill:#ffffff,stroke:#94a3b8,stroke-dasharray: 5 5
Examples of PEAS Specifications
| Agent Type | Performance Measure (P) | Environment (E) | Actuators (A) | Sensors (S) |
|---|---|---|---|---|
| Automated Taxi Driver | Safety, destination reach, time, comfort, traffic violations, profit. | Roads, traffic lights, pedestrians, other vehicles, weather conditions. | Steering wheel, accelerator, brake, signal indicators, horn, display. | Cameras, LiDAR, radar, GPS, speedometer, accelerometer, engine sensors. |
| Medical Diagnosis System | Accurate disease classification, minimized cost, patient survival rate. | Patient symptoms, medical history, hospital staff, laboratory results. | Screen display (questions, tests, diagnoses), printer for prescriptions. | Keyboard input of symptoms, direct medical scanners, database feeds. |
Classification of Agent Task Environments
An intelligent agent's design is heavily influenced by the properties of the environment it operates in. These properties dictate the complexity of the algorithms required for perception, reasoning, and action.
- Fully Observable vs. Partially Observable:
• Fully Observable: The agent's sensors give it access to the complete state of the environment at each point in time (e.g., Chess, Checkers). The agent doesn't need internal state to keep track of the world.
• Partially Observable: The agent cannot sense the complete state of the environment due to noisy/inaccurate sensors or parts of the state being hidden (e.g., Poker, Automated Taxi). - Deterministic vs. Stochastic:
• Deterministic: The next state of the environment is completely determined by the current state and the exact action executed by the agent (e.g., Sudoku, Chess).
• Stochastic: The next state involves randomness or uncertainty, meaning an action doesn't guarantee a single specific outcome (e.g., Ludo (due to dice), Automated Taxi (due to unpredictable traffic)). - Static vs. Dynamic:
• Static: The environment does not change while the agent is deliberating or computing its next action (e.g., Crossword puzzle, Medical Diagnosis).
• Dynamic: The environment changes continuously even while the agent is thinking. The agent must make decisions in real-time (e.g., Automated Taxi, Multiplayer Action Games).
• Semi-Dynamic: The environment itself doesn't change, but the agent's performance score decreases over time (e.g., Timed Chess).
Uninformed Search Algorithms
Uninformed Search (Blind Search) algorithms have no domain-specific knowledge about how far a state is from the goal. They solely use the problem definition (initial state, actions, transition model, and goal test) to systematically explore the state space.
- Breadth-First Search (BFS):
• Mechanism: Expands the shallowest unexpanded node first. Implemented using a FIFO queue.
• Properties: Complete (always finds a solution if one exists) and Optimal (finds the shallowest goal if step costs are uniform).
• Complexity: Time \(O(b^d)\), Space \(O(b^d)\) — where \(b\) is branching factor, \(d\) is depth. Huge memory requirement is its main drawback. - Depth-First Search (DFS):
• Mechanism: Expands the deepest unexpanded node first along the current path. Implemented using a LIFO stack (or recursion).
• Properties: Not complete (can get stuck in infinite loops) and Not optimal (might find a deeper solution first).
• Complexity: Time \(O(b^m)\), Space \(O(bm)\) — where \(m\) is max depth. Very memory efficient compared to BFS. - Depth-Limited Search (DLS):
• Mechanism: A variant of DFS where a predetermined depth limit \(l\) is imposed to prevent the algorithm from traversing infinite paths.
• Properties: Complete only if the goal depth \(d \le l\). Not optimal. - Iterative Deepening DFS (IDDFS):
• Mechanism: Repeatedly applies Depth-Limited Search, incrementing the depth limit \(l\) (\(l = 0, 1, 2, \dots\)) until a goal is found.
• Properties: Combines the benefits of BFS and DFS. It is Complete and Optimal (like BFS) but has the low memory footprint of DFS (\(O(bd)\)).
A* Search Algorithm
A* Search is the most widely known form of Best-First Search. It is an informed (heuristic) search algorithm that efficiently finds the optimal path from the start node to a goal node by combining the actual cost reached so far with the estimated cost to the goal.
The core of A* is its Evaluation Function \(f(n)\):
\[ f(n) = g(n) + h(n) \]- \(g(n)\): The exact path cost from the start node to the current node \(n\).
- \(h(n)\): The heuristic function; the estimated cheapest cost from node \(n\) to the goal.
- \(f(n)\): The estimated total cost of the cheapest solution path that passes through node \(n\).
Mechanism & Optimality: A* maintains an Open List (priority queue sorted by \(f(n)\)) and a Closed List. It always expands the node with the lowest \(f(n)\) value. A* is guaranteed to be Complete (will find a goal if one exists) and Optimal (will find the shortest/cheapest path) provided that the heuristic function \(h(n)\) is admissible (never overestimates the cost) and consistent.
Heuristic Conditions: Admissibility and Consistency
For heuristic search algorithms like A* to guarantee finding the optimal (cheapest) path, the heuristic function \(h(n)\) must satisfy specific mathematical properties.
1. Admissibility
A heuristic \(h(n)\) is admissible if it never overestimates the actual minimal cost to reach the goal state from node \(n\). Formally, if \(h^*(n)\) is the true optimal cost from \(n\) to the goal, then:
\[ 0 \le h(n) \le h^*(n) \quad \text{for all nodes } n \]Admissible heuristics are inherently optimistic because they assume the cost of solving the problem is less than or equal to the actual cost. If \(h(n)\) is admissible, A* search is optimal for tree search.
2. Consistency (Monotonicity)
A heuristic \(h(n)\) is consistent (or monotonic) if, for every node \(n\) and every successor \(n'\) generated by an action \(a\), the estimated cost of reaching the goal from \(n\) is no greater than the step cost of getting to \(n'\) plus the estimated cost from \(n'\) to the goal. Formally, obeying the triangle inequality:
\[ h(n) \le c(n, a, n') + h(n') \]Where \(c(n, a, n')\) is the actual cost of the action. Furthermore, the heuristic value of the goal node must be zero (\(h(Goal) = 0\)).
Relationship: Every consistent heuristic is strictly also admissible. If a heuristic is consistent, the \(f(n)\) values along any path are non-decreasing, making A* optimal even when using graph search (with a closed list) without needing to reopen closed nodes.
Hill Climbing Search and Its Pitfalls
Hill Climbing is a local, informed search algorithm that continuously moves in the direction of increasing value (or decreasing cost). It is a greedy approach that only looks at the immediate neighbors of the current state and selects the one that improves the objective function the most. It does not maintain a search tree, making it highly memory efficient, but it can easily get stuck.
Because it only makes local improvements, Hill Climbing frequently fails to find the global optimum due to the following landscape topologies (pitfalls):
- Local Maxima (or Minima): A state that is better than all of its immediate neighbors, but is strictly worse than the global maximum. The algorithm gets stuck here because every valid move leads to a worse state.
- Plateau (Flat Local Maximum): A flat area of the state-space landscape where a set of neighboring states have exactly the same objective value. The algorithm loses its gradient and performs a random walk, often failing to make progress.
- Ridge: A sequence of local maxima that are connected, forming a sharp elevation. Single-axis moves (typical in hill climbing) cause the algorithm to zig-zag inefficiently back and forth across the ridge without moving along its crest.
Solutions: Random-restart hill climbing, Stochastic hill climbing, or Simulated Annealing can help escape these pitfalls.
Simulated Annealing Search
Simulated Annealing is a probabilistic local search algorithm used to find the global optimum in a large search space while avoiding getting trapped in local maxima. It draws an analogy from metallurgy, where a material is heated to a high temperature and slowly cooled to minimize its thermodynamic free energy (creating a strong crystalline structure).
Unlike standard hill climbing which strictly only accepts moves that improve the state, Simulated Annealing sometimes accepts worse moves to escape local maxima. The probability of accepting a bad move depends on two factors:
- The magnitude of the bad move (\(\Delta E\)): How much worse the new state is compared to the current state.
- The current Temperature (\(T\)): A control parameter that decreases over time.
If the new state improves the objective (\(\Delta E > 0\)), it is always accepted. If it is worse (\(\Delta E < 0\)), it is accepted with a probability defined by the Boltzmann distribution:
\[ P(\text{accept}) = e^{\frac{\Delta E}{T}} \]The Temperature Schedule
The cooling schedule dictates how the temperature \(T\) decreases over time. Initially, \(T\) is high, meaning \(P(\text{accept})\) is close to 1, allowing the algorithm to freely explore the state space (like a random walk) and jump out of local maxima. As time progresses, \(T\) drops towards zero. When \(T\) is very low, the algorithm behaves exactly like strict hill climbing, converging onto the nearest peak.
Constraint Satisfaction Problems (CSP)
A Constraint Satisfaction Problem (CSP) is a mathematical problem defined by a set of variables whose states must satisfy a number of constraints or rules. A CSP is formally defined by three components: \((X, D, C)\).
- \(X\): A set of variables \(\{X_1, X_2, \dots, X_n\}\).
- \(D\): A set of domains \(\{D_1, D_2, \dots, D_n\}\), where \(D_i\) contains the permissible values for variable \(X_i\).
- \(C\): A set of constraints that specify allowable combinations of values for subsets of variables.
A solution to a CSP is a complete, consistent assignment of values to all variables such that no constraint is violated.
N-Queens Problem as a CSP
The objective of the N-Queens problem is to place \(N\) queens on an \(N \times N\) chessboard such that no two queens attack each other (horizontally, vertically, or diagonally).
- Variables (\(X\)): Let \(Q_1, Q_2, \dots, Q_N\) represent the \(N\) queens, where \(Q_i\) is the queen in the \(i\)-th column.
- Domain (\(D\)): The row index where the queen can be placed. \(D_i = \{1, 2, \dots, N\}\).
- Constraints (\(C\)): For any two queens \(Q_i\) and \(Q_j\) (where \(i \neq j\)):
1. \(Q_i \neq Q_j\) (No two queens in the same row).
2. \(|Q_i - Q_j| \neq |i - j|\) (No two queens on the same diagonal).
CSP Backtracking Search and Arc Consistency (AC-3)
1. Backtracking Search
Backtracking Search is a specialized Depth-First Search (DFS) algorithm used for solving CSPs. Instead of generating complete states, it assigns values to variables one at a time. After assigning a value to variable \(X_i\), it checks the constraints. If the assignment violates any constraint with previously assigned variables, it abandons the path (backtracks) and tries the next value in \(X_i\)'s domain. This early pruning significantly reduces the search space compared to brute-force generate-and-test methods.
2. Arc Consistency (AC-3 Algorithm)
Constraint propagation techniques are used to reduce the domain of variables before or during search. The most common form is Arc Consistency.
A variable \(X_i\) is arc-consistent with respect to variable \(X_j\) if, for every value \(x\) in the domain of \(X_i\), there exists at least one value \(y\) in the domain of \(X_j\) that satisfies the binary constraint between \(X_i\) and \(X_j\).
The AC-3 Algorithm enforces arc consistency across the entire CSP network:
- Initialize a queue with all directed arcs \((X_i, X_j)\) in the CSP graph.
- Pop an arc \((X_i, X_j)\) from the queue and make \(X_i\) arc-consistent with \(X_j\) by removing unsupported values from the domain of \(X_i\).
- If the domain of \(X_i\) is modified, add all arcs \((X_k, X_i)\) (where \(X_k\) is a neighbor of \(X_i\)) back into the queue because the reduced domain of \(X_i\) might now invalidate previous consistencies.
- Repeat until the queue is empty. If any domain becomes empty, the CSP has no solution.
Game Playing and the Minimax Algorithm
In AI, game playing is typically modeled as a deterministic, fully observable, zero-sum environment where two agents compete (adversarial search). Examples include Chess, Tic-Tac-Toe, and Checkers. The two players are traditionally called MAX and MIN. MAX attempts to maximize the game score, while MIN attempts to minimize it.
The Minimax Algorithm
The Minimax Algorithm computes the optimal move for MAX by exploring the entire game tree down to the leaf/terminal nodes, assuming MIN plays optimally to oppose MAX.
Steps of Minimax:
- Generate Tree: Expand the game tree from the current state down to the terminal states (or a depth limit).
- Evaluate Leaves: Apply a utility function (or heuristic evaluation function) to the terminal nodes to get their scores.
- Back-propagate Values:
• If the parent node is a MIN node, it selects the minimum utility value of its children.
• If the parent node is a MAX node, it selects the maximum utility value of its children. - Decision: The root node (MAX's current turn) makes the move associated with the maximum backed-up value.
While Minimax is optimal, its time complexity is \(O(b^m)\), which is impractical for complex games without depth limiting and Alpha-Beta pruning.
Alpha-Beta Pruning in Game Trees
Alpha-Beta Pruning is an optimization for the Minimax algorithm. It dramatically reduces the number of nodes evaluated in the search tree, allowing search to go much deeper within the same time limit.
The Pruning Rules
- Alpha (\(\alpha\)): The best (highest-value) choice found so far at any choice point along the path for MAX. Initialized to \(-\infty\).
- Beta (\(\beta\)): The best (lowest-value) choice found so far at any choice point along the path for MIN. Initialized to \(+\infty\).
- Pruning Condition: Search is pruned (stopped) at a MIN node if its value \(\le \alpha\). Search is pruned at a MAX node if its value \(\ge \beta\). Simply put, prune when \(\alpha \ge \beta\).
Propositional Logic
Propositional Logic (Boolean Logic) is the simplest logic system. It deals with propositions—declarative sentences that are either true (T) or false (F).
Syntax and Logical Connectives
Sentences are built using atomic propositions (e.g., \(P\), \(Q\)) and logical connectives:
- Negation (\(\neg P\)): "Not P". True if \(P\) is false.
- Conjunction (\(P \land Q\)): "P and Q". True only if both \(P\) and \(Q\) are true.
- Disjunction (\(P \lor Q\)): "P or Q". True if at least one of \(P\) or \(Q\) is true.
- Implication (\(P \implies Q\)): "If P then Q". False only when \(P\) is true and \(Q\) is false.
- Biconditional (\(P \iff Q\)): "P if and only if Q". True if \(P\) and \(Q\) have the same truth value.
Truth Table Example
| P | Q | \(\neg P\) | \(P \land Q\) | \(P \lor Q\) | \(P \implies Q\) | \(P \iff Q\) |
|---|---|---|---|---|---|---|
| T | T | F | T | T | T | T |
| T | F | F | F | T | F | F |
| F | T | T | F | T | T | F |
| F | F | T | F | F | T | T |
First-Order Logic (FOL)
Unlike Propositional Logic which only sees facts as whole truths, First-Order Logic (FOL) breaks facts down into objects and their relations, making it far more expressive.
Syntax Components
- Constants: Specific objects (e.g., John, Apple).
- Variables: Placeholders for objects (e.g., \(x\), \(y\)).
- Predicates: Relations or properties returning true/false (e.g., \(\text{Loves}(John, Mary)\), \(\text{IsRed}(Apple)\)).
- Functions: Returns an object rather than a truth value (e.g., \(\text{FatherOf}(John)\)).
Quantifiers
FOL introduces two quantifiers to express properties over collections of objects:
- Universal Quantifier (\(\forall\)): "For all". Used to state that a property holds for every object in the universe.
Example: "All humans are mortal" \(\implies \forall x (\text{Human}(x) \implies \text{Mortal}(x))\). - Existential Quantifier (\(\exists\)): "There exists". Used to state that a property holds for at least one object.
Example: "Someone loves Mary" \(\implies \exists x (\text{Loves}(x, Mary))\).
Conversion to Conjunctive Normal Form (CNF)
To use automated inference rules like Resolution, FOL sentences must be standardized into Conjunctive Normal Form (CNF), where a sentence is an AND of ORs (a conjunction of clauses).
9-Step Conversion Process
- Eliminate Implications: Replace \(A \implies B\) with \(\neg A \lor B\).
- Move Negations Inwards: Apply De Morgan's laws so negations only apply to atomic predicates (e.g., \(\neg \forall x P(x) \rightarrow \exists x \neg P(x)\)).
- Standardize Variables: Rename variables so each quantifier uses a unique variable name.
- Skolemization: Eliminate existential quantifiers (\(\exists\)). Replace the existential variable with a Skolem constant or a Skolem function (if it depends on a universal quantifier).
- Drop Universal Quantifiers (\(\forall\)): Since all remaining variables are universally quantified, simply drop the \(\forall\) symbols.
- Distribute \(\lor\) over \(\land\): Convert into a conjunction of disjunctions.
- Flatten Nested Connectives: \((A \land B) \land C \rightarrow A \land B \land C\).
- Separate Clauses: Break the conjunctions into separate independent clauses.
- Standardize Variables in Clauses: Rename variables in different clauses to ensure they do not share variables.
Unification in First-Order Logic
Unification is a core algorithmic process in FOL used to find a substitution that makes two different logical expressions structurally identical. It is essential for applying inference rules like Resolution.
A substitution \(\theta\) is called a unifier if \(Expression1\theta = Expression2\theta\). We always seek the Most General Unifier (MGU), which imposes the fewest possible restrictions (substitutions) on the variables.
Examples of Unification
- Example 1 (Constants and Variables):
Unify \(\text{Knows}(John, x)\) and \(\text{Knows}(y, Mary)\).
Substitution \(\theta = \{x / Mary, y / John\}\). Result: \(\text{Knows}(John, Mary)\). - Example 2 (Functions):
Unify \(\text{Loves}(x, \text{FatherOf}(x))\) and \(\text{Loves}(John, y)\).
Substitution \(\theta = \{x / John, y / \text{FatherOf}(John)\}\). Result: \(\text{Loves}(John, \text{FatherOf}(John))\). - Example 3 (Failure):
Unify \(\text{Knows}(John, x)\) and \(\text{Knows}(x, Mary)\).
Fails because \(x\) cannot simultaneously be \(John\) and \(Mary\).
Resolution Refutation Principle
Resolution is a sound and complete inference rule used in automated theorem proving. The Resolution Refutation principle proves a theorem by contradiction.
The Refutation Workflow
- Formulate Knowledge Base (KB): Convert all given facts and axioms into Conjunctive Normal Form (CNF) clauses.
- Negate the Goal: Take the theorem/goal you want to prove, negate it (\(\neg Goal\)), and convert it to CNF.
- Add to KB: Add the negated goal to the set of clauses.
- Resolve: Repeatedly apply the Resolution Rule: if two clauses contain complementary literals (e.g., \(P\) in one and \(\neg P\) in another), resolve them to create a new resolvent clause (combining the rest of the literals).
- Contradiction (Empty Clause): If the resolution process eventually derives the empty clause (\(\emptyset\) or NIL), it means a contradiction has been found. Therefore, the negated goal is false, proving that the original goal must be True.
Forward vs Backward Chaining
Inference engines in Knowledge-Based (KB) Expert Systems primarily use two reasoning strategies to deduce conclusions from rules (IF-THEN clauses):
| Feature | Forward Chaining | Backward Chaining |
|---|---|---|
| Direction | Data-driven (Bottom-up). | Goal-driven (Top-down). |
| Mechanism | Starts from known facts, triggers rules where the IF condition is met, and adds new facts (THEN) until the goal is reached. | Starts with the goal/hypothesis, looks for rules whose THEN part matches the goal, and makes the IF part sub-goals to prove. |
| Use Case | Used when new data arrives and we want to see what conclusions can be drawn (e.g., Monitoring systems, Event-driven systems). | Used when trying to prove a specific hypothesis or diagnose a specific issue (e.g., Medical diagnosis, MYCIN). |
| Efficiency | Can generate many irrelevant facts before hitting the goal. | More efficient for targeted queries; only explores relevant paths. |
Semantic Networks
A Semantic Network is a graphical knowledge representation technique where knowledge is represented as a directed graph.
- Nodes: Represent concepts, objects, or classes (e.g., "Bird", "Penguin", "Wings").
- Edges (Arcs): Represent the semantic relationships between the nodes.
Key Relationships
- IS-A (Inheritance): Represents class hierarchies. E.g., Penguin \(\xrightarrow{\text{IS-A}}\) Bird.
- HAS-A (Possession): E.g., Bird \(\xrightarrow{\text{HAS-A}}\) Wings.
- Action/Property: E.g., Bird \(\xrightarrow{\text{CAN}}\) Fly.
Semantic networks are highly intuitive for humans but lack formal logical semantics, making automated reasoning tricky without strict rules.
Frames and Inheritance
A Frame is a highly structured, object-oriented approach to knowledge representation introduced by Marvin Minsky. A frame represents a stereotyped concept, object, or situation (similar to a 'class' in OOP).
Structure of a Frame
A frame consists of a collection of attributes called Slots. Each slot can have:
- Values: Data assigned to the slot (e.g.,
Color: Red). - Facets: Metadata about the slot, such as constraints, default values, or attached procedures (e.g., if-needed, if-added demons).
Inheritance in Frames
Frames are organized into hierarchical taxonomies. A sub-frame inherits slots and default values from its parent frame. For example, a Mammal frame might have a slot Legs: 4. A child frame Dog inherits this slot automatically. However, inheritance can be overridden if a specific child violates the default (e.g., overriding a default inherited property).
Conceptual Dependency (CD) Theory
Conceptual Dependency (CD), developed by Roger Schank, is a theory of Natural Language Processing that represents the underlying semantic meaning of sentences independently of the specific words or syntax used. Two sentences with the same meaning map to the exact same CD structure.
Primitive Actions (ACTs)
CD breaks down all human actions into a small set of foundational primitive actions. Some key ACTs include:
- ATRANS: Transfer of abstract relationship (e.g., give, buy, take).
- PTRANS: Transfer of physical location of an object (e.g., go, fly).
- PROPEL: Application of physical force to an object (e.g., push, pull).
- MTRANS: Transfer of mental information (e.g., tell, hear, read).
- MBUILD: Construction of new information from old (e.g., decide, conclude).
- INGEST / EXPEL: Organism taking in or expelling something (e.g., eat / sweat).
- GRASP: Grasping an object physically.
By mapping sentences to these primitives, the system can draw deep inferences (e.g., if John ATRANS a book to Mary, Mary now possesses the book).
Handling Uncertainty using Bayes' Theorem
In real-world AI, agents rarely have complete and certain knowledge. To handle uncertainty systematically, AI employs probability theory, with Bayes' Theorem at its core. It provides a mathematical framework for updating our belief in a hypothesis given new evidence.
The Mathematical Formula
\[ P(H | E) = \frac{P(E | H) \cdot P(H)}{P(E)} \]- \(P(H)\): Prior Probability. The initial degree of belief in hypothesis \(H\) before observing any evidence.
- \(P(E | H)\): Likelihood. The probability of observing evidence \(E\) assuming the hypothesis \(H\) is true.
- \(P(E)\): Marginal Probability. The total probability of observing the evidence under all possible hypotheses. Often calculated using the Law of Total Probability: \(P(E) = P(E | H)P(H) + P(E | \neg H)P(\neg H)\).
- \(P(H | E)\): Posterior Probability. The updated probability of the hypothesis \(H\) after the evidence \(E\) has been observed.
Example: In medical diagnosis, \(H\) is a disease (e.g., Cancer) and \(E\) is a test result. Bayes' theorem allows us to calculate the probability a patient actually has cancer given a positive test result, considering the baseline cancer rate and the test's false-positive rate.
Bayesian Belief Networks (BBN)
A Bayesian Belief Network (or Bayesian Network) is a probabilistic graphical model that represents a set of variables and their conditional dependencies via a Directed Acyclic Graph (DAG).
- Nodes: Represent random variables (discrete or continuous).
- Directed Edges: Represent direct causal influence from parent to child node (e.g., \(A \rightarrow B\) means A directly affects B).
Conditional Probability Tables (CPTs)
Every node in a BBN has an associated Conditional Probability Table (CPT). The CPT quantifies the effect of the parents on that node.
- If a node has no parents (a root node), its CPT simply lists its prior probabilities (e.g., \(P(\text{Burglary})\)).
- If a node has parents, its CPT lists the probability of the node taking on each possible value given every possible combination of values of its parent nodes (e.g., \(P(\text{Alarm} | \text{Burglary}, \text{Earthquake})\)).
Joint Probability: BBNs simplify complex probability distributions. The full joint probability of the network is just the product of the individual CPT entries:
\[ P(X_1, X_2, \dots, X_n) = \prod_{i=1}^n P(X_i | \text{Parents}(X_i)) \]Dempster-Shafer Theory of Evidence
The Dempster-Shafer (D-S) Theory is a mathematical theory of evidence that provides an alternative to traditional probability for handling uncertainty, ignorance, and the fusion of evidence from multiple sources.
Core Concepts
- Frame of Discernment (\(\Theta\)): The set of all possible mutually exclusive hypotheses. E.g., \(\Theta = \{A, B, C\}\).
- Basic Probability Assignment (\(m\)): A mass function that assigns a probability mass to every subset of \(\Theta\). Unlike standard probability, we can assign mass to combinations of hypotheses (e.g., \(m(\{A, B\}) = 0.4\)), representing ignorance between A and B.
Belief and Plausibility
D-S theory bounds the true probability of a hypothesis \(H\) within an interval \([\text{Bel}(H), \text{Pl}(H)]\).
- Belief (Bel): The lower bound. The sum of the masses of all subsets that are strictly entirely contained within \(H\). It represents the minimum guaranteed support for \(H\).
- Plausibility (Pl): The upper bound. The sum of the masses of all subsets that intersect with \(H\). It represents the maximum possible support for \(H\).
Example: If \([\text{Bel}(H), \text{Pl}(H)] = [0.2, 0.8]\), it means there is 20% direct evidence for \(H\), but up to 80% could be true if the unknown evidence aligns with \(H\).
Fuzzy Sets vs Crisp Sets
Standard set theory and logic operate on strict binary boundaries. Fuzzy logic introduces degrees of truth.
- Crisp Sets (Classical Logic): An element either entirely belongs to a set or it does not. The membership function \(\mu(x)\) is strictly 0 or 1. (e.g., "Tall" means \(\ge 6\) ft. 5.99 ft is completely NOT tall).
- Fuzzy Sets: An element can partially belong to a set. The membership function \(\mu(x)\) returns a continuous value between 0.0 and 1.0. (e.g., 5.9 ft might have a "Tall" membership degree of 0.8).
Fuzzy Membership Functions
A Membership Function mathematically defines how input values are mapped to a degree of membership between 0 and 1. Common shapes include:
- Triangular: Peaks at 1.0 and linearly slopes down to 0 on both sides.
- Trapezoidal: Has a flat top where membership is 1.0, then slopes down to 0.
- Gaussian (Bell Curve): A smooth curve used for continuous, smooth transitions without sharp edges.
Fuzzy Inference Systems (Mamdani Model)
A Fuzzy Inference System (FIS) maps crisp inputs to crisp outputs using fuzzy logic. The most widely used architecture is the Mamdani Model, which follows a four-step pipeline:
- Fuzzification: Crisp input values (e.g., Temperature = 32°C) are mapped to degrees of membership in fuzzy sets (e.g., "Hot" = 0.7, "Warm" = 0.2) using membership functions.
- Rule Evaluation (Inference): Fuzzy IF-THEN rules are evaluated. Fuzzy AND/OR operators are applied (usually MIN for AND, MAX for OR) to calculate the firing strength of the rule. The THEN part is truncated (clipped) by this firing strength.
- Aggregation: The truncated output fuzzy sets from all triggered rules are combined (usually via a MAX operation) into a single, unified output fuzzy set.
- Defuzzification: The aggregated output fuzzy set is converted back into a single crisp, numerical value. The most common method is the Centroid (Center of Gravity) method.
Inductive Learning and ID3 Decision Trees
Inductive Learning
Inductive Learning is a supervised machine learning paradigm where an algorithm observes a set of training examples (input-output pairs) and induces a generalized hypothesis or rule that can accurately predict the output for unseen inputs.
Decision Trees & ID3
A Decision Tree is a tree-based classification model where internal nodes represent tests on attributes, branches represent the outcomes of tests, and leaf nodes represent final class labels.
The Iterative Dichotomiser 3 (ID3) algorithm builds decision trees top-down using a greedy approach. It selects the "best" attribute at each node to split the dataset. The best attribute is the one that best separates the data into distinct classes, measured using a metric called Information Gain. ID3 stops splitting when all instances in a branch belong to the same class or there are no more attributes to split on.
Entropy and Information Gain
In decision trees (like ID3), Entropy and Information Gain are mathematical metrics used to decide which feature should be the root or internal node.
1. Entropy \(H(S)\)
Entropy measures the degree of impurity, disorder, or uncertainty in a dataset \(S\). If a dataset is 50/50 split between two classes, entropy is at its maximum (1.0 bits). If all samples belong to one class, entropy is 0.0.
\[ H(S) = - \sum_{i=1}^{c} p_i \log_2(p_i) \]Where \(p_i\) is the proportion (probability) of samples belonging to class \(i\).
2. Information Gain \(IG(S, A)\)
Information Gain measures the expected reduction in entropy (uncertainty) caused by partitioning the dataset \(S\) based on a specific attribute \(A\). We select the attribute that yields the highest Information Gain to split the tree.
\[ IG(S, A) = H(S) - \sum_{v \in Values(A)} \frac{|S_v|}{|S|} H(S_v) \]Where \(S_v\) is the subset of \(S\) for which attribute \(A\) has value \(v\). It essentially calculates: Original Entropy - Weighted Average Entropy of subsets after splitting.
5 Phases of Natural Language Processing (NLP)
The processing of natural language by AI systems is typically broken down into a pipeline of five distinct phases, moving from raw characters to deep meaning.
- Lexical / Morphological Analysis: Breaks raw text into smaller tokens (words, paragraphs). It involves stemming and identifying prefixes/suffixes to determine the base word structure.
- Syntactic Analysis (Parsing): Analyzes the sequence of words to ensure it obeys the grammatical rules of the language. It generates a hierarchical Parse Tree showing relationships between words (e.g., Subject-Verb-Object).
- Semantic Analysis: Determines the exact dictionary meaning of the sentence. It checks for meaningfulness (e.g., rejecting grammatically correct but nonsensical sentences like "The green idea sleeps furiously") and handles word sense disambiguation.
- Discourse Integration: Analyzes the meaning of a sentence in the context of the preceding sentences. It resolves anaphoric references (e.g., determining what the pronoun "He" refers to based on the previous sentence).
- Pragmatic Analysis: Extracts the intended, real-world meaning or intent behind the text, going beyond literal meaning to capture sarcasm, idioms, or contextual implications.
Syntactic Analysis (Parsing) in NLP
Syntactic Analysis, also known as parsing, is the second phase of NLP. It focuses on analyzing the grammatical structure of a sentence to establish the relationships between constituent words.
The parser uses a set of formal grammar rules (usually a Context-Free Grammar (CFG)) to verify if the sentence is grammatically valid. If valid, the output is a hierarchical Parse Tree.
Parsing Approaches
- Top-Down Parsing: Starts at the root symbol (S for Sentence) and expands downward, applying grammar rules to derive the specific words of the input sentence. (Can struggle with left-recursion).
- Bottom-Up Parsing: Starts with the actual input words at the leaves and tries to build the tree upwards by grouping words into phrases (like Noun Phrases and Verb Phrases) until it reaches the root symbol (S).
Parsing is crucial because determining the grammatical subject and verb is a prerequisite for extracting semantic meaning.
Expert System Architecture
An Expert System is an AI application designed to emulate the decision-making ability of a human expert in a specific, narrow domain (e.g., MYCIN for medicine). It structurally separates domain knowledge from the reasoning logic.
Core Components
- Knowledge Base (KB): The heart of the system. It contains the high-quality, domain-specific facts and heuristic rules (often encoded as IF-THEN rules) extracted from human experts.
- Inference Engine: The software "brain" that processes the Knowledge Base. It applies reasoning strategies (like Forward Chaining or Backward Chaining) to deduce new information, solve problems, or provide diagnoses.
- User Interface (UI): The mechanism through which the end-user queries the system, answers questions, and receives the final expert advice.
- Knowledge Acquisition Facility: Tools used by Knowledge Engineers to extract and encode rules from human experts into the KB.
Expert System Shells
An Expert System Shell is a software development environment that contains all the core components of an expert system (inference engine, user interface, explanation facility) except the domain-specific Knowledge Base (KB). It provides a ready-made framework, allowing developers to create an expert system simply by plugging in rules and facts.
Primary Benefits
- Rapid Prototyping and Development: Developers save thousands of hours because they do not have to program the complex inference algorithms (like Rete algorithm) from scratch.
- Domain Focus: Allows Knowledge Engineers to focus entirely on extracting and formatting rules from human experts, rather than debugging software infrastructure.
- Built-in Tools: Shells often come with debugging tools, knowledge acquisition facilities, and conflict-resolution strategies built-in.
- Cost-Effective: Significantly lowers the financial barrier to entry for organizations building specialized AI systems. Examples include CLIPS and JESS.
The Perceptron Model
The Perceptron is the simplest mathematical model of a biological neuron, forming the foundation of Artificial Neural Networks. It acts as a linear binary classifier.
Mathematical Model
Given input signals \(x_1, x_2, \dots, x_n\), the perceptron computes a weighted sum and adds a bias \(b\):
\[ z = \sum_{i=1}^n (w_i \cdot x_i) + b \]This sum \(z\) is then passed through an Activation Function \(f(z)\) to determine the final output (whether the neuron "fires" or not).
Activation Functions
Activation functions introduce non-linearity, allowing networks to learn complex patterns.
- Step Function: Outputs 1 if \(z \ge 0\), else 0. Used in classical perceptrons.
- Sigmoid: \(\sigma(z) = \frac{1}{1 + e^{-z}}\). Smoothly maps values to a (0, 1) range.
- ReLU (Rectified Linear Unit): \(f(z) = \max(0, z)\). Extremely fast and solves the vanishing gradient problem in deep networks.
Backpropagation Algorithm
Backpropagation (Backward Propagation of Errors) is the fundamental learning algorithm for training Multi-Layer Perceptrons (MLPs). It is an application of the calculus Chain Rule to compute the gradient of the loss function with respect to every weight in the network.
The Three-Phase Workflow
- Forward Pass: Input data is passed through the network, layer by layer, until an output prediction is generated.
- Error Computation: The prediction is compared against the actual true target label using a Loss Function (e.g., Mean Squared Error). The difference represents the network's error.
- Backward Pass (Weight Update):
• The algorithm calculates the partial derivative (gradient) of the error with respect to the output layer weights.
• Using the Chain Rule, the error is propagated backward to the hidden layers to calculate their respective gradients.
• All weights are updated in the opposite direction of the gradient to minimize the error: \(w_{\text{new}} = w_{\text{old}} - \eta \cdot \frac{\partial E}{\partial w}\) (where \(\eta\) is the learning rate).
Genetic Algorithms (GAs)
Genetic Algorithms are heuristic search algorithms inspired by Charles Darwin's theory of natural evolution. They are used to solve optimization and search problems by evolving a population of candidate solutions (chromosomes) over generations.
Core Evolutionary Operators
- Selection: The process of choosing the fittest individuals (parents) from the current population to breed the next generation. Fitter solutions (determined by a Fitness Function) have a higher probability of being selected (e.g., Roulette Wheel Selection).
- Crossover (Recombination): The genetic material (bits) of two parent chromosomes is combined to create one or more offspring. E.g., in Single-Point Crossover, a random point is chosen, and the tails of the two parents are swapped. This exploits existing good genes.
- Mutation: Randomly flipping one or more bits in a child chromosome's sequence with a very low probability. Mutation is crucial because it maintains genetic diversity and prevents the algorithm from converging prematurely on a local maximum.
Reinforcement Learning: Q-Learning
Reinforcement Learning (RL) is a paradigm where an agent learns to behave in an environment by performing actions and observing the resulting rewards/penalties, aiming to maximize cumulative long-term reward.
Q-Learning is a model-free, value-based RL algorithm. The agent maintains a "Q-Table" that stores the Quality (Q-value) of taking a specific action \(a\) in a specific state \(s\).
The Q-Learning Update Rule (Bellman Equation)
\[ Q(s_t, a_t) \leftarrow Q(s_t, a_t) + \alpha \left[ r_{t+1} + \gamma \max_{a} Q(s_{t+1}, a) - Q(s_t, a_t) \right] \]- \(Q(s_t, a_t)\): Current Q-value.
- \(\alpha\): Learning Rate (how much new information overrides old).
- \(r_{t+1}\): Immediate reward received after taking action \(a_t\).
- \(\gamma\): Discount Factor (how much future rewards are valued vs immediate rewards).
- \(\max_{a} Q(s_{t+1}, a)\): Estimate of optimal future value from the next state.
The agent balances Exploration (trying random actions to discover rewards) and Exploitation (choosing the action with the highest Q-value) using strategies like \(\epsilon\)-greedy.
Wumpus World and KB Reasoning
The Wumpus World is a classic AI grid-based environment used to demonstrate Knowledge-Based (logical) agents. It is a partially observable, deterministic, and static cave represented as a 4x4 grid.
The Environment
- Threats: The Wumpus (a monster that eats the agent) and Bottomless Pits.
- Goal: Find the Gold and climb out of the cave alive.
- Sensors (Percepts):
• Stench: Felt in squares adjacent to the Wumpus.
• Breeze: Felt in squares adjacent to a Pit.
• Glitter: Seen when in the same square as the Gold.
Knowledge Base Reasoning
The agent navigates using Propositional Logic. It maintains a Knowledge Base (KB) of rules (e.g., \(B_{1,1} \iff (P_{1,2} \lor P_{2,1})\)). If the agent moves to (1,1) and perceives NO breeze (\(\neg B_{1,1}\)), the inference engine applies Modus Tollens to definitively deduce that there is NO pit in (1,2) or (2,1) (\(\neg P_{1,2} \land \neg P_{2,1}\)), marking them as safe to explore.
STRIPS Planning Representation
STRIPS (Stanford Research Institute Problem Solver) is a foundational automated planning system format. It models actions as operators that transition the world from one state to another using sets of logical literals.
Operator Components
Each action schema consists of three strict lists:
- Preconditions: What must be strictly true in the current state for the action to be legally executed. (e.g., To pick up block A, it must be CLEAR(A) and the robot arm must be EMPTY).
- Delete List: The facts that become false after the action is executed and must be removed from the state description. (e.g., After picking up A, EMPTY is deleted, and ON(A, Table) is deleted).
- Add List: The new facts that become true and are added to the state. (e.g., HOLDING(A) is added).
The successor state is calculated purely symbolically: \(S_{\text{new}} = (S_{\text{old}} - \text{DeleteList}) \cup \text{AddList}\).
Goal Stack Planning
Goal Stack Planning is an early linear planning algorithm that uses a LIFO stack to manage the achievement of complex, compound goals (like those in the Block World domain).
How it Works
- The original compound goal (e.g., \(\text{ON}(A, B) \land \text{ON}(B, C)\)) is pushed onto the stack.
- The algorithm splits the compound goal into individual sub-goals and pushes them onto the stack individually.
- When the top of the stack is a goal that is not true in the current state, the planner pushes the corresponding STRIPS action (that has an ADD list satisfying the goal) onto the stack.
- It then immediately pushes the Preconditions of that action onto the stack as new sub-goals.
- When an action reaches the top of the stack and its preconditions are met, the action is executed (popped, state updated, added to the final plan).
Limitation (Sussman Anomaly): Because it plans sub-goals linearly and independently, achieving one sub-goal can sometimes undo the progress of a previously achieved sub-goal, leading to suboptimal plans.
The Knowledge Acquisition Bottleneck
The Knowledge Acquisition Bottleneck refers to the most difficult, time-consuming, and expensive phase of building an Expert System: extracting heuristic knowledge from human experts and formalizing it into machine-readable rules.
Why it Occurs
- Tacit Knowledge: Human experts often use intuition or "gut feeling" accumulated over decades. They struggle to articulate these subconscious decisions as explicit IF-THEN rules.
- Vocabulary Gap: Knowledge Engineers (AI developers) and Domain Experts (Doctors, Geologists) speak different technical languages, leading to misinterpretations.
- Time Constraints: Experts are highly paid and busy; their time is expensive.
- Contradictions: Multiple experts might provide conflicting rules for the exact same edge-case scenario.
This bottleneck historically led to the decline of symbolic Expert Systems in favor of modern Machine Learning, which extracts patterns directly from data rather than relying on human interviews.
Classification vs. Regression in Machine Learning
Both Classification and Regression belong to the Supervised Learning paradigm, meaning they learn from historical datasets where the input data is paired with the correct output labels. The fundamental difference lies in the type of output variable they predict.
| Aspect | Classification | Regression |
|---|---|---|
| Output Data Type | Categorical / Discrete. The output is a class label. | Continuous / Numerical. The output is a real number. |
| Objective | To map input data into predefined distinct categories or buckets. | To map input data into a continuous numerical scale (finding a relationship trend). |
| Examples | Spam vs. Not Spam email; Dog vs. Cat image; Tumor Malignant vs. Benign. | Predicting house prices; Forecasting stock market values; Estimating temperature. |
| Common Algorithms | Decision Trees, Support Vector Machines (SVM), Logistic Regression, Naive Bayes. | Linear Regression, Polynomial Regression, Support Vector Regression (SVR). |
Press ← and → to move between groups