0% found this document useful (0 votes)
3 views18 pages

AI Notes Sem7

The document outlines various types of AI agents, including simple reflex, model-based, utility-based, and learning agents, detailing their definitions, capabilities, memory usage, adaptability, complexity, examples, advantages, and limitations. It also discusses search strategies in AI, such as BFS, DFS, UCS, and IDDFS, highlighting their features, advantages, limitations, and applications. Additionally, it covers constraint satisfaction problems (CSP) and machine learning, explaining key components, techniques, and the process of data collection, preprocessing, model selection, training, evaluation, and fine-tuning.

Uploaded by

mahak162003
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views18 pages

AI Notes Sem7

The document outlines various types of AI agents, including simple reflex, model-based, utility-based, and learning agents, detailing their definitions, capabilities, memory usage, adaptability, complexity, examples, advantages, and limitations. It also discusses search strategies in AI, such as BFS, DFS, UCS, and IDDFS, highlighting their features, advantages, limitations, and applications. Additionally, it covers constraint satisfaction problems (CSP) and machine learning, explaining key components, techniques, and the process of data collection, preprocessing, model selection, training, evaluation, and fine-tuning.

Uploaded by

mahak162003
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 18

AI Notes Sem-7

Unit 1
Agents(Types of Agents)

Simple Reflex Model-Based Utility-Based


Feature Goal-Based Agents Learning Agents
Agents Reflex Agents Agents

Use an internal Choose actions


Respond directly Take actions to Improve performance
model of the based on utility
to percepts using achieve specific goals by learning from
Definition world to handle (desirability) to
condition-action by considering future interactions with the
partial achieve the best
rules. states. environment.
observability. outcome.

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.

Uses memory to Tracks and Requires memory to


Memory Uses memory for
None track goals and evaluates utility of learn patterns and
Usage internal models.
plans. states or actions. adapt.

Adaptability No Limited Moderate High Very high

Complexity Low Moderate Higher High Very high

Thermostats, Basic self-driving GPS navigation Personal assistants Recommendation


Examples
automatic doors. cars. systems, gaming AI. (e.g., Siri, Alexa). systems, AlphaGo.

- 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)

Complete No (unless graph is


Yes finite or depth- Yes Yes
ness limited).
Optima Yes (for uniform-
No Yes Yes
lity cost graphs).

- 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),

- Retains BFS's completeness and optimality while using less memory.


- Avoids BFS's high space complexity.
- Suitable for large search spaces.
- Repeated exploration of nodes at each depth limit.
Key Limitations
- Computationally expensive in practice due to repeated DFS calls.
- Solving problems in very large state spaces (e.g., puzzles, games).
Applications - Situations requiring memory efficiency alongside completeness and
optimality.

Informed search strategies


Informed search strategies also called heuristic search because they have
information about the goal state and use domain-specific knowledge (heuristics)
to guide the search toward the goal, improving efficiency.
Greedy Best-First Hill-Climbing Beam
Feature A* Search
Search Search Search
Combines actual
cost from the start
Examines only a
(g(n)g(n)g(n)) and Tries to move
Selects the node that fixed number
estimated cost to towards the goal
appears to be closest (kkk) of the
the goal by selecting the
Definition to the goal based on a most promising
(h(n)h(n)h(n)) to next state with
heuristic function nodes at each
minimize total cost the best heuristic
(h(n)h(n)h(n)). level based on
(f(n)=g(n)+h(n)f(n) value.
the heuristic.
= g(n) +
h(n)f(n)=g(n)+h(n)).
Yes (used along
Heuristic Yes (used for Yes (used to rank
Yes (used to estimate with g(n)g(n)g(n)
Function deciding the next and select the k-
the cost to the goal). for total cost
(h(n)h(n)h(n)) move). best nodes).
estimation).
Yes (if
No (can get stuck in No (depends on
h(n)h(n)h(n) is No (can get stuck
Completeness local minima or the fixed beam
admissible and in local minima).
loops). width k).
consistent).
Yes (if h(n)h(n)h(n)
Optimality No No No
is admissible).

- Guarantees - Efficient for large


- Memory-
- Fast and simple. optimality. search spaces.
Key efficient.
- Works well with - Balances - Reduces memory
Advantages - Simple to
accurate heuristics. exploration and usage by limiting
implement.
exploitation. nodes explored.
- High memory - Non-optimal.
- Non-optimal. - Non-optimal.
Key usage. - May ignore the
- Can get stuck in local - Easily stuck in
Limitations - Slower than optimal path if kkk
minima or loops. local minima.
greedy search. is too small.
Navigation systems, Optimization Natural language
Route planning,
AI games, problems, local processing (e.g.,
Applications puzzle-solving (e.g.,
pathfinding in search in games parsing), machine
8-puzzle, Sudoku).
robotics. and AI. learning.
A* Algorithm
Link of youtube channel (A*)
A search algorithm that finds the shortest path to the goal by combining the actual cost to a
node (g(n)g(n)g(n)) and the estimated cost to the goal (h(n)h(n)h(n)). It uses the formula
f(n)=g(n)+h(n)f(n) = g(n) + h(n)f(n)=g(n)+h(n).
The heuristic estimates the cost from the current node to the goal. It must be admissible
(never overestimates the cost to reach the goal) and consistent (satisfies the triangle
inequality) for optimality.
The cost to reach the current node from the start node, calculated as the sum of edge
weights along the path.
f(n)=g(n)+h(n)f(n) = g(n) + h(n)f(n)=g(n)+h(n), where g(n)g(n)g(n) is the actual cost, and
h(n)h(n)h(n) is the heuristic cost. Nodes are expanded based on their f(n)f(n)f(n) value.
Yes, if the search space is finite, and there is a solution.
Op Yes, if the heuristic h(n)h(n)h(n) is admissible and consistent.
Time O(bd)O(b^d)O(bd), where bbb is the branching factor and ddd is the depth of
Complexity the optimal solution. Performance depends heavily on the heuristic.
Space O(bd)O(b^d)O(bd), as it stores all generated nodes in memory (can be
Complexity memory-intensive).
- Guarantees optimality with a good heuristic.
Key Advantages - Efficient for many search problems.
- Balances exploration and exploitation.
- High memory usage.
Key - Slower than greedy search due to consideration of both g(n)g(n)g(n) and
Limitations h(n)h(n)h(n).
- Performance depends heavily on the quality of the heuristic.
- Pathfinding in maps (e.g., Google Maps).
- Puzzle-solving (e.g., 8-puzzle, Sudoku).
Applications
- Robotics navigation.
- Network routing protocols.
Iterative
Deepening
Depth-First
Search
(IDDFS)
A search strategy that combines the memory efficiency of Depth-First Search
Definition (DFS) with the completeness and optimality of Breadth-First Search (BFS). It
repeatedly runs DFS with increasing depth limits.
Performs Depth-Limited Search (DLS) starting with depth = 0 and
Technique
incrementally increases the depth limit until the goal is found.
Yes, for finite graphs, because it systematically explores all nodes within each
Completeness
depth.
Yes, for unweighted graphs, as it finds the shortest path by exploring all paths
Optimality
of increasing depth.
Time O(bd)O(b^d)O(bd), where bbb is the branching factor, and ddd is the depth of
Complexity the shallowest goal node.
Space O(bd)O(bd)O(bd), where ddd is the depth limit, as it uses only a single DFS
Complexity stack.
Key - Combines low memory usage of DFS and completeness of BFS.
Advantages - Suitable for large search spaces where the depth is unknown.
Key - Re-explores nodes at each depth limit, making it computationally expensive.
Limitations - Inefficient for problems with high branching factors.
- Solving puzzles like the 8-puzzle and 15-puzzle.
Applications - Large search problems where the solution depth is unknown (e.g.,
pathfinding, games).

Constraint Satisfaction Problem (CSP)


A problem defined by a set of variables, each with a domain of possible
Definition values, and a set of constraints specifying relationships between these
variables.
- Variables: The entities to assign values (e.g., X1,X2,...XnX_1, X_2, ... X_nX1
,X2,...Xn).
- Domains: Possible values for each variable (e.g., D(Xi)={1,2,3}D(X_i) = \{1,
Components
2, 3\}D(Xi)={1,2,3}).
- Constraints: Rules that restrict the variable assignments (e.g., X1≠X2X_1 \
neq X_2X1=X2).
Objective Assign values to variables such that all constraints are satisfied.
A CSP is complete if it finds a solution or determines that no solution
Completeness
exists.
CSPs can be designed to find optimal solutions when additional criteria
Optimality
(e.g., cost functions) are applied.
- Unary Constraints: Involve a single variable (e.g., X1>2X_1 > 2X1>2).
Types of - Binary Constraints: Involve two variables (e.g., X1≠X2X_1 \neq X_2X1
Constraints =X2).
- Global Constraints: Involve multiple variables (e.g., all-different).
- Finite domain problems.
Key - Clear structure allows efficient algorithms (e.g., backtracking, local
Characteristics search).
- Often involves constraint propagation to reduce the search space.

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-

What is machine learning-


A branch of artificial intelligence (AI) that enables systems to learn and improve
their performance on a task without being explicitly programmed.
To develop models that can generalize from data, make predictions, identify
patterns, and optimize performance over time.
Machines learn from data by identifying patterns and making decisions based on
these patterns.
Key Components - Input Data: Raw information for training.
- Features: Characteristics used to learn.
- Model: Algorithmic representation of learned patterns.
- Feedback: Mechanism to refine predictions.
Key Supervised Learning, Unsupervised Learning, Reinforcement
Techniques Learning, Semi-Supervised Learning, Self-Supervised Learning.
Image recognition, speech processing, recommendation systems,
Applications
fraud detection, and autonomous vehicles.

Machine learning algorithms analyze large amounts of data to identify patterns


and correlations, and then use those insights to make predictions and
decisions. The more data a machine learning system is exposed to, the better it
becomes at its task.
Data Collection:
First, relevant data is collected or curated. This data could include
examples, features, or attributes that are important for the task at
hand, such as images, text, numerical data, etc.
2. Data Preprocessing:
Before feeding the data into the algorithm, it often needs to be
preprocessed. This step may involve cleaning the data (handling
missing values, outliers), transforming the data (normalization, scaling),
and splitting it into training and test sets.
3. Choosing a Model:
Depending on the task (e.g., classification, regression, clustering), a
suitable machine learning model is chosen. Examples include decision
trees, neural networks, support vector machines, and more advanced
models like deep learning architectures.
4. Training the Model:
The selected model is trained using the training data. During training,
the algorithm learns patterns and relationships in the data. This
involves adjusting model parameters iteratively to minimize the
difference between predicted outputs and actual outputs (labels or
targets) in the training data.
5. Evaluating the Model:
Once trained, the model is evaluated using the test data to assess its
performance. Metrics such as accuracy, precision, recall, or mean
squared error are used to evaluate how well the model generalizes to
new, unseen data.
6. Fine-tuning:
Models may be fine-tuned by adjusting hyperparameters (parameters
that are not directly learned during training, like learning rate or
number of hidden layers in a neural network) to improve performance.
7. Prediction or Inference:
Types of machine learning

Supervised Unsupervised Reinforcement Semi-Supervised Self-Supervised


Feature
Learning Learning Learning Learning 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.

High accuracy Utilizes vast


Can process large Reduces dependence
with Learns optimal strategies amounts of
Advantages datasets without on large labeled
sufficient for decision-making. unlabeled data
labels. datasets.
labeled data. efficiently.

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.

Classification, Tasks with limited


Tasks with sequential Pre-training
regression, Pattern detection, labeled data but
Best for decision-making or representations for
structured data exploration. abundant unlabeled
interaction. downstream
prediction tasks. data.
What is Regression?

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.

Here starting new unit

Unit 3

What is Natural Language Processing?


Natural language processing (NLP) is a field of computer science and a subfield of artificial intelligence that aims to
make computers understand human language

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.

 Language Translation Services: For example, Google Translate.

 Text Analytics: Analyzing large amounts of text data for insights, such as customer reviews or social media
posts.

 Speech Recognition Systems: Converting spoken language into written text.

 Sentiment Analysis: Determining the sentiment in social media, reviews, or other textual data.

 Search Engines: Improving search relevance by understanding user queries more effectively.

You might also like