Artificial Intelligence Notes
Artificial Intelligence Notes
This section covers the fundamental concepts of Artificial Intelligence, its relationship with related
fields like Machine Learning and Deep Learning, various techniques, and its applications.
1.1 Introduction to AI
Concept
Artificial Intelligence (AI) is a broad field of computer science concerned with building machines
capable of performing tasks that typically require human intelligence.
The key focus is on creating systems that can reason, learn, perceive, problem-solve, and make
decisions under varying circumstances.
Focus
Approach Description
Area
Systems that act like Aims to build systems that can pass the Turing Test—a test of a
Acting humans (Turing Test machine's ability to exhibit intelligent behavior equivalent to, or
Approach) indistinguishable from, that of a human.
Systems that act Aims to build a rational agent—one that acts so as to achieve the
rationally (Rational best outcome or, when there is uncertainty, the best expected
Agent Approach) outcome. (This is the most widely accepted view in modern AI).
Export to Sheets
AI (Artificial Intelligence): The broadest concept. The goal of building intelligent machines.
Any technique that enables computers to mimic human intelligence.
Machine Learning (ML): A subset of AI. It involves the use of statistical methods to enable
machines to improve at a task with data, without being explicitly programmed. ML
algorithms learn patterns from data and make predictions or decisions based on those
patterns.
Deep Learning (DL): A subset of ML. It is based on Artificial Neural Networks (ANNs) with
multiple hidden layers (hence, "deep"). DL excels at processing complex, unstructured data
like images, sound, and text, and is responsible for many recent breakthroughs in AI.
Feature AI Machine Learning (ML) Deep Learning (DL)
Export to Sheets
1.3 Applications of AI
1. Natural Language Processing (NLP): Understanding and generating human language. (e.g.,
Siri, Google Translate, sentiment analysis).
2. Computer Vision: Enabling machines to "see" and interpret visual information. (e.g., facial
recognition, object detection in self-driving cars, medical image analysis).
3. Robotics: Creating machines that can perform physical tasks. (e.g., industrial robots,
autonomous drones).
5. Game Playing: AI systems that can play complex games at a superhuman level. (e.g.,
DeepMind's AlphaGo).
6. Autonomous Vehicles: Self-driving cars and aircraft that navigate without human input.
1.4 AI Techniques
AI techniques are the methods and approaches used to solve problems in the field. They generally
fall into two categories:
Search Algorithms: Used to find a solution path from a starting state to a goal state.
(Detailed in your next section: Uninformed/Informed Search).
Logic: Using formal systems (like Propositional Logic and Predicate Logic) to represent
knowledge and deduce new facts.
Rule-Based Systems (Expert Systems): Using IF-THEN rules to store and process knowledge.
2. Machine Learning
Statistical Models: Algorithms that learn relationships and patterns from data.
Neural Networks: Computational models inspired by the human brain, used for complex
pattern recognition.
Evolutionary Computation: Algorithms (like Genetic Algorithms) that use concepts inspired
by biological evolution (mutation, selection, crossover) to find solutions.
Agent Concept
An Agent is anything that can be viewed as perceiving its environment through sensors and acting
upon that environment through actuators.
Sensors: Devices that gather information about the environment (e.g., cameras,
microphones, keyboard inputs).
Actuators: Devices that effect changes in the environment (e.g., motors, display screens,
speakers).
Rational Agent
A Rational Agent is one that acts correctly—it performs actions that cause it to achieve the best
outcome or, when there is uncertainty, the best expected outcome.
Export to Sheets
Structure of Agents
The Agent Program (the function that implements the agent's behavior) is executed on the Agent
Architecture (the computing device with sensors and actuators).
o Limitation: Operates without knowledge of the past; only works if the environment
is fully observable.
o Structure: Requires information about "how the world evolves" (transition model)
and "what my actions do" (effect model) to update the state.
3. Goal-Based Agents:
o Action: Use the goal information along with the current state to choose the action
that will lead to the goal.
o Structure: Requires search and planning to find action sequences that achieve the
goal.
4. Utility-Based Agents:
o Action: Chooses the action that maximizes the agent's utility (a measure of its
performance/preference). Used when multiple goals are possible or there's a trade-
off.
o Structure: A utility function maps a state (or sequence of states) onto a real number,
providing a measure of "goodness."
This section establishes the framework for how AI systems (specifically Goal-Based Agents) formalize
real-world challenges and use search algorithms to find solutions.
The most common way for an AI system to solve a problem is by representing it as a search through a
State Space.
Key Concepts
3. Goal State(s): The state(s) that the agent wants to reach, defined by a Goal Test.
4. Actions / Operators: Legal moves or operations that an agent can perform to transition from
one state to another.
o Example (8-Puzzle): Moving the blank tile up, down, left, or right.
5. State Space: The set of all possible states reachable from the initial state by any sequence of
actions. The search problem is to find a path through this space.
7. Path Cost: A function that assigns a numerical cost to a path. The goal is often to find the
path with the minimum cost.
ACTIONS: A function that returns the set of legal actions for any given state.
TRANSITION MODEL: A function that describes the result of performing a given action in a
given state (i.e., the next state).
GOAL TEST: A function that checks whether a given state is a goal state.
The solution to a search problem is an optimal sequence of actions (a path) that leads from the
initial state to a goal state.
A Production System is a foundational model for implementing rule-based AI systems, often used to
define the action and transition models of a state space.
1. A Set of Rules (Production Rules): These are the IF-THEN rules that define the available
actions.
2. A Working Memory (Global Database): Contains the current state description. The rules
operate on this memory.
3. A Control Strategy: Specifies the procedure for choosing which rule to apply next. This
dictates the order of operation and prevents loops.
Working Cycle
2. Conflict Resolution: If multiple rules match (i.e., their conditions are satisfied), select one
rule to execute (based on criteria like specificity, priority, or time of insertion).
3. Execute (Act): Apply the action of the chosen rule, which modifies the working memory
(updates the state).
Understanding the nature of the problem is crucial for choosing the right search technique.
Can action be Is it possible to backtrack and If NO (e.g., Chess), then path cost and
undone? reverse a bad move? pruning become crucial.
Export to Sheets
Control Strategy is the core of the search process. It determines the order in which states are
examined (expanded) in the search space.
In a large state space, it's impossible to check every state. The control strategy efficiently manages
the search process by:
1. Guiding the search: Deciding which path to explore next.
2. Preventing redundant work: Avoiding searching the same state multiple times.
3. Ensuring termination: Guaranteeing the algorithm stops, either with a solution or after
exhausting possibilities.
1. Uninformed (Blind) Search: The strategy has no information about the distance or cost to
the goal—it only distinguishes between goal and non-goal states. (Detailed in Section 3.1)
2.5 Problems - Water Jug problem, Missionary Cannibal Problem, Block Worlds
These are classic benchmark problems used to illustrate and test search algorithms.
Problem: Given a 4-gallon jug and a 3-gallon jug, with no measuring marks, and a pump for
unlimited water, how do you get exactly 2 gallons of water in the 4-gallon jug?
State Representation: (x,y), where x is the amount of water in the 4-gallon jug and y is the
amount in the 3-gallon jug.
Operators (Actions): Fill jug 4, Fill jug 3, Empty jug 4, Empty jug 3, Pour water from 4 to 3,
Pour water from 3 to 4.
Problem: Three missionaries and three cannibals are on one side of a river. They have one
boat that can hold at most two people. If the cannibals ever outnumber the missionaries on
either bank, the missionaries will be eaten. How can they all safely cross the river?
Constraint: The number of missionaries must not be less than the number of cannibals on
either bank (unless the number of missionaries is zero).
Operators (Actions): Move 1 missionary, Move 1 cannibal, Move 2 missionaries, Move 2
cannibals, Move 1 missionary and 1 cannibal (boat capacity ≤2).
3. Block Worlds
Problem: A set of blocks resting on a table or each other needs to be rearranged from an
initial configuration to a desired goal configuration.
State Representation: Usually a list or symbolic description of which block is on top of which
block, and which blocks are on the table.
Operators (Actions):
o Move(A, B): Pick up block A and place it on block B (A must be clear, B must be
clear).
o Move(A, Table): Pick up block A and place it on the table (A must be clear).
Problem: A monkey is in a room. A bunch of bananas is hanging out of reach from the
ceiling. A box is in the room. The monkey's goal is to get the bananas.
Key Challenge: This is a classic example of a Strips-like planning problem, where the
sequence of actions is critical and involves multiple preconditions and post-conditions.
State Representation: A tuple of propositions describing the world: (Monkey location, Box
location, Bananas location, Monkey is/is not on box, Bananas are/are not grasped).
Operators (Actions):
3. Searching Algorithms
Search algorithms are the engines of AI problem-solving. They are methods used to find a solution
path from an initial state to a goal state within the defined state space. They are categorized based
on whether they use problem-specific knowledge (heuristics) or not.
Export to Sheets
Concept: Explores one branch of the tree as deeply Completeness: No, it can get stuck in an
as possible before backtracking. It uses a LIFO (Last- infinite loop or an infinitely deep path if a
In, First-Out) Stack for storing nodes. solution isn't found along that path.
Use Case: When the search space is very wide but Time Complexity: O(bm), where m is the
the solution is known to be deep, or when memory maximum depth of the state space (can be
is limited. infinite).
Export to Sheets
Limitation: If the shallowest solution is deeper than L, the algorithm is incomplete (it won't
find the solution).
4. Iterative Deepening Depth-First Search (IDDFS)
IDDFS combines the benefits of DFS (low memory usage) and BFS (completeness and optimality).
Strategy: It performs DLS iteratively, increasing the depth limit L by 1 in each iteration
(L=0,1,2,3,…).
Informed Search algorithms use a heuristic function, h(n), which estimates the cost of the cheapest
path from node n to the goal. This information guides the search, making it much faster than blind
search.
Concept Limitation
Strategy: Expands the node that appears closest to the Suboptimal: It prioritizes local improvement
goal, according to the heuristic function h(n). It always and may find a solution quickly but one that
picks the node with the lowest h(n) value. is very expensive globally.
Export to Sheets
Strategy: This is the simplest local search technique. It is like an agent trying to climb a hill.
From the current state, it moves to the best neighbor state (the one that moves closer to the
goal, i.e., has a lower cost h(n)).
Key Feature: It does not backtrack or maintain a search tree. It only keeps track of the
current state and its neighbors.
Limitation: Highly prone to getting stuck in local optima (a "hill" that isn't the highest point
in the entire landscape) or plateaus (flat areas where h(n) doesn't change).
This is a general term encompassing both Greedy Best-First Search and A* Search. It describes any
search where the node to expand is chosen based on an evaluation function f(n).
Process:
1. Determine the difference between the current state and the goal state.
3. If the operator cannot be applied (its preconditions are not met), set the
preconditions as a new sub-goal.
Example: Goal: Cook dinner. Difference: No ingredients. Relevant Operator: Buy groceries.
Sub-goal: Get to the store.
These are two of the most powerful and common informed search algorithms.
A* Search
A* (pronounced "A-star") is the most widely used optimal graph search algorithm.
Key Property (Admissibility): A* is optimally complete (guaranteed to find the optimal path)
if the heuristic h(n) is admissible (never overestimates the true cost to the goal, i.e.,
h(n)≤h∗(n)).
AO* Search
AO* is an algorithm designed for searching AND/OR graphs, which are used when a problem can be
decomposed into subproblems (AND nodes) that must all be solved.
Concept: Used primarily for problems that are decomposable (like the Tower of Hanoi or
logic proofs).
Strategy: It intelligently searches the graph by focusing only on the most promising part of
the graph (the current best path/solution structure).
Find an optimal path to the goal Find an optimal solution graph (a set of
Goal
state. steps).
Export to Sheets
4. Knowledge Representation
Knowledge Representation (KR) is the area of AI concerned with how to represent knowledge in a
symbolic form so that a computer system can reason about the world and use that knowledge to
solve complex tasks.
Knowledge in an AI context is a collection of facts, beliefs, rules, and procedures that an intelligent
agent uses to understand and act in its environment.
Inferential: It allows the derivation of new, implicit facts from existing, explicit facts.
Type of
Description Representation Focus Example
Knowledge
Declarative Facts about objects, events, Statements/Propositions (e.g., "The sun is yellow."
Knowledge and their relationships. It Logical sentences, semantic "A car has four
(What) describes what is true in the networks). wheels."
Type of
Description Representation Focus Example
Knowledge
Export to Sheets
1. Logical Representation: Uses formal logic (like Propositional and Predicate Logic) to express
knowledge in precise, unambiguous terms. Reasoning is done via formal inference rules (e.g.,
Modus Ponens).
Formal logic provides a precise, mathematical way to represent and reason with knowledge.
Concept: The simplest form of logic. It deals with declarative sentences (propositions) that
are either True (T) or False (F).
Syntax:
Limitation: PL cannot easily represent generalized statements about objects. For example,
"All men are mortal" requires a separate proposition for every man, which is impractical.
o Quantifiers:
Advantage: FOL is expressive enough to represent almost all general knowledge concisely.
For automated reasoning, especially in resolution systems, knowledge bases (KBs) written in FOL are
often converted into a standardized form called Clausal Form or Conjunctive Normal Form (CNF).
Clausal Form: A conjunction (AND) of clauses, where each clause is a disjunction (OR) of literals.
Clause=L1∨L2∨…∨Lk
1. Eliminate ⇔ and ⇒: Replace A⇔B with (A⇒B)∧(B⇒A); replace A⇒B with ¬A∨B.
4. Eliminate Existential Quantifiers (∃): This is done using Skolemization, replacing the
existentially quantified variable with a Skolem constant or a Skolem function.
5. Drop Universal Quantifiers (∀): They are implicitly assumed in the clausal form.
Resolution is a single, powerful inference rule used for automated theorem proving in AI. It is
especially used to prove that a conclusion logically follows from a set of axioms.
resolventl1∨…∨lk,m1∨…∨mn
If two clauses C1 and C2 contain a complementary literal (e.g., P in C1 and ¬P in C2), the resolvent is
the disjunction of all the literals in C1 and C2, excluding the complementary pair.
A∨BA∨P,¬P∨B
2. Negate the conclusion α (i.e., add ¬α) and convert it to clausal form.
4. If the resolution process derives the empty clause (□ or NIL), it means a contradiction was
found. Since the original premises were assumed true, the only false statement must be ¬α.
Therefore, α is proven true.
The resolution rule is also applied in FOL, but it requires an extra step: Unification.
Unification: The process of finding substitutions for variables in predicate literals so that the literals
become identical (match exactly).
1. Convert all premises and the negated conclusion to Clausal Form (CNF), including
Skolemization.
3. Unify a pair of complementary literals (e.g., dog(x) and ¬dog(Fido)) by finding the Most
General Unifier (MGU), which is the simplest substitution.
4. Apply the resolution rule using the MGU, producing a new clause (the resolvent).
Slot and Filler Structures are popular non-logical knowledge representation techniques that organize
knowledge into highly structured, descriptive units. They represent concepts, objects, or events using
a collection of attributes (slots) and their corresponding values (fillers).
These are considered "weak" because they lack the formal semantics and inference guarantees of
logic, but they are highly intuitive and easy to implement.
1. Semantic Networks
Structure:
o Example: If Dog has the property can_Breathe, then Fido (an instance of Dog) also
has can_Breathe.
Limitation (Weak Semantics): It can be difficult to precisely define the meaning of all link
types, leading to ambiguity in reasoning.
2. Frames
Frame Name:CAR
⎩ ⎨ ⎧Slothas_WheelsColorManufacturerTypeEngine_Type
:Filler:4:Red, Blue, or Green:Default: Toyota:is_a: Vehicle Frame:gas, electric
o Fillers: The values of the attributes (e.g., Red). Fillers can be specific values, another
frame, or a procedure.
Facets: Slots can have attached procedures (called facets) for more complex behavior:
o If-Needed: A procedure run to compute the filler if the slot is accessed and currently
empty (lazy evaluation).
o If-Added: A procedure run when a value is inserted into the slot (e.g., to check
constraints).
Benefit: Excellent for modeling complex objects and situations, leveraging defaults and
inheritance for efficiency.
These are "stronger" structures because they are specifically designed to represent knowledge about
actions, events, and cause-and-effect sequences, often in natural language understanding.
Concept: A theory developed by Roger Schank for representing the meaning of sentences in
a way that is independent of the language used. It aims to reduce all actions to a small set of
primitive actions and actors.
Goal: To enable inference and common sense reasoning from natural language text.
Primitive Actions: Schank proposed a set of 11 primitive actions that are sufficient to
represent all human and natural actions. Examples include:
Benefit: Enables powerful inference. For example, regardless of whether a sentence is "John
gave Mary a book" or "Mary got a book from John," the CD representation is identical (an
ATRANS from John to Mary with the object book).
2. Scripts
Goal: To help an AI system understand and predict events in structured situations. They allow
the system to fill in missing details from a narrative.
o Entry Conditions: Must be true before the script can run (e.g., Customer is hungry,
Customer has money).
o Results: Conditions true after the script runs (e.g., Customer is full,
Customer has less money).
o Scenes: The actual sequence of events (e.g., Entering, Ordering, Eating, Paying,
Exiting).
Benefit: Provides robust understanding for predictable, routine situations, making language
processing much more efficient.
This section covers the shift towards data-driven AI, the three main learning paradigms, and specific,
high-impact applications.
Goal: To learn a function f that maps inputs X to outputs Y, often written as Y=f(X).
Key Concept: Generalization. The algorithm must perform well not just on the training data,
but on new, unseen data.
The three primary categories define how the algorithm interacts with the data and the environment.
1. Supervised Learning
Concept: The algorithm learns from a set of labeled examples—data where the desired
output (the "supervision") is already known.
Tasks:
2. Unsupervised Learning
Concept: The algorithm learns from unlabeled data, aiming to find hidden patterns,
structure, or relationships within the data on its own. There is no predefined output.
Tasks:
Mechanism: The agent performs an action in a state, and the environment returns a reward
(positive or negative) and the next state.
Key Components:
Applications: Game playing (AlphaGo, chess), robotics, autonomous driving control systems.
Predictive Analytics is the use of statistical algorithms and ML techniques to analyze current and
historical data and make predictions about future or unknown events.
Core Process: Involves collecting data, training an ML model (often time-series models or
deep learning models like LSTMs), and applying the model to new data to forecast
outcomes.
1. Correct Biases: Learn and correct systematic errors in traditional physics models.
4. Climate Modeling: Analyze large climate datasets to predict long-term trends and
impacts.
Benefit: AI significantly speeds up the analysis of vast observational data, enabling faster,
more localized, and potentially more accurate predictions.
1. Natural Language Understanding (NLU): The ability to process human language input,
identify the user's intent (e.g., "Check balance," "Pay bill"), and extract relevant entities (e.g.,
"Card number," "Due amount").
2. Dialogue Management: Maintaining the context and history of the conversation, deciding
the next system action.
ILA (Interactive Learning Assistant) is an AI chatbot used by SBI Card to handle customer
service inquiries.
Tasks it handles: Checking credit card statements, finding card benefits, tracking application
status, answering FAQs, and assisting with card usage.
Benefit: Provides 24/7 support, reduces call center load, and offers instant resolutions,
thereby improving customer experience and operational efficiency.
--------------------------------------------------------------------------------------------------------------------------------------