AI Notes Sem7
AI Notes Sem7
Unit 1
Agents(Types of Agents)
Predict future
Use reasoning and Maximize outcomes Adapt and evolve
React only to states using a
Capabilities planning to achieve using a utility based on new
current percepts. model of the
goals. function. experiences.
environment.
- Balances trade-
- Simple and fast. - Handles partial - Optimized for - Learns from
offs.
- Low observability. achieving goals. experience.
Advantages - Efficient in
computational - Considers past - Flexible decision- - Adapts to new
dynamic
cost. states. making. scenarios.
environments.
- Relies on
- No learning. - Computationally - Complex utility
predefined - Data-dependent.
- Can’t handle expensive. design.
Limitations models. - Requires significant
dynamic - Requires defined - High
- Limited computational power.
environments. goals. computational cost.
adaptability.
Search Strategies in AI
BFS DFS
Best for goals closer to the start node. Best for deep goals.
Does not guarantee the shortest
Guarantees shortest path (unweighted).
path.
Lower (stores current branch
Higher (stores more nodes in the queue).
only).
Stack-based,
Queue-based, iterative. iterative or
recursive.
Breadth-First Depth-First Search Uniform-Cost Iterative Deepening
Feature
Search (BFS) (DFS) Search (UCS) Search (IDS)
Explores all nodes at Explores as far as Combines BFS and
Expands the node
the current depth possible along each DFS by exploring
Definition with the least
level before moving branch before nodes at increasing
path cost.
deeper. backtracking. depth limits.
Data Stack (with iterative
Queue Stack (or recursion) Priority queue
Structure depth control)
- Guarantees the
- Memory- - Memory-efficient.
shortest path in - Guarantees optimal
Key efficient. - Retains
unweighted solutions for
Advantages - Suitable for deep completeness and
graphs. weighted graphs.
graphs. optimality.
- Complete.
- High memory
- May get stuck - Requires priority
usage. - Repeats node
Key in infinite queue management.
- Can be slow exploration at every
Limitations loops. - Computationally
for large depth limit.
- Non-optimal. expensive.
graphs.
Problems requiring a
Shortest path in Solving mazes, Shortest path in
balance of memory
unweighted puzzles, and weighted graphs
Applications efficiency and
graphs, peer-to- exploring deep (e.g., Dijkstra's
completeness (e.g., large
peer networks. trees. algorithm).
state spaces).
Iterative Deepening Depth-First Search (IDDFS)
Combines the benefits of BFS and DFS by performing repeated depth-limited DFS with
increasing depth limits until the goal is found.
Stack (used for depth-limited DFS)
Yes, as it will eventually explore all nodes if the search space is finite.
Yes, for unweighted graphs (finds the shortest path to the goal).
O(bd) O(b^d)O(bd),
ex:-
Example of a
CSP: The Map Coloring Problem
Let’s look at a classic example to understand the CSP process: the map coloring problem.
Problem Description:
Given a map with regions (e.g., countries or states) that share borders, the task is to color
each
region such that no two adjacent regions have the same color. The goal is to use the
minimum
number of colors possible to achieve this.
Components of the Problem:
1. Variables:
o The regions on the map are the variables. For example, in a map with five regions {A,
B, C, D, E}, each region is a variable.
2. Domains:
o The domain of each variable is the set of colors that can be assigned to that region.
For instance, the domain might be {Red, Blue, Green}.
3. Constraints:
o The constraints are that adjacent regions cannot have the same color. For example, if
region A shares a border with region B, the constraint is: A≠BA \neq BA =B Similarly,
if region C shares borders with both A and B, the constraints are: A≠C,B≠CA \neq C,
\quad B \neq CA =C,B =C
Unit 2
Learning-
Learns from
labeled data Learns through Combines a small Learns by creating
Identifies hidden
(input-output interaction with an amount of labeled data pseudo-labels or
patterns or
Definition pairs) to environment to with a large amount of using pretext tasks
structure in
predict outputs maximize rewards or unlabeled data to train from unlabeled
unlabeled data.
for unseen minimize penalties. models. data.
inputs.
Labeled data
Interacts with an
with both Unlabeled data with
Input environment and Both labeled and Unlabeled data
inputs and no predefined
Data receives feedback unlabeled data. only.
corresponding outputs.
(rewards or penalties).
outputs.
Output Predicts labels Finds hidden Learns an optimal action Improves accuracy by Learns
for new data patterns, clusters, policy for decision- leveraging both labeled representations or
points. or reduced encodings for
dimensions. making. and unlabeled data. downstream tasks.
Linear
regression,
Clustering (K-
decision
means, DBSCAN), Q-learning, Deep Q- Pseudo-labeling, self- Contrastive
trees, neural
Techniques dimensionality Networks (DQN), policy training, graph-based learning, BERT, GPT,
networks,
reduction (PCA), gradient methods. methods. SimCLR.
support
anomaly detection.
vector
machines.
Minimize
error
Maximize similarity
between Leverage labeled data Predict pseudo-
Training within groups and Maximize cumulative
predicted and to guide learning on labels or solve
Objective separation between rewards over time.
true outputs unlabeled data. pretext tasks.
groups.
(e.g., loss
function).
Email spam
detection, Customer Pre-training large
Game-playing agents, Medical image
image segmentation, topic models for NLP or
Examples robot navigation, self- classification with
recognition, modeling, anomaly vision tasks (e.g.,
driving cars. limited labeled data.
sales detection. GPT, CLIP).
prediction.
Performance Performance is
Requires large Difficult to Trial-and-error
Disadvanta depends on the sensitive to the design
amounts of evaluate without learning can be time-
ges quality of labeled and of pretext tasks and
labeled data. ground truth. consuming or costly.
unlabeled data. pseudo-labels.
Regression is a statistical approach used to analyze the relationship between a dependent variable (target variable)
and one or more independent variables (predictor variables). The objective is to determine the most suitable
function that characterizes the connection between these variables.It is a supervised machine learning technique,
used to predict the value of the dependent variable for new, unseen data. It models the relationship between the
input features and the target variable, allowing for the estimation or prediction of numerical values.
Unit 3
Natural Language Processing (NLP) is a branch of artificial intelligence (AI) that focuses on the interaction between
computers and human (natural) languages. The goal of NLP is to enable machines to understand, interpret, and
generate human language in a way that is both meaningful and useful.
Applications of NLP:
Chatbots and Virtual Assistants: Such as Siri, Alexa, and Google Assistant.
Text Analytics: Analyzing large amounts of text data for insights, such as customer reviews or social media
posts.
Sentiment Analysis: Determining the sentiment in social media, reviews, or other textual data.
Search Engines: Improving search relevance by understanding user queries more effectively.