Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
19 views

AI-Unit 1_Notes

Uploaded by

munmunyadav9981
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views

AI-Unit 1_Notes

Uploaded by

munmunyadav9981
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 38

Introduction to AI & Search

Techniques
UNIT-1
Syllabus:
Unit I:
Meaning and definition of artificial intelligence, Production systems, Characteristics of
production systems, Study and comparison of breadth first search and depth first search
techniques, other Search Techniques like hill Climbing, Best first Search. A* algorithm,
AO* algorithms etc, and various types of control strategies.
Unit II:
Knowledge Representation, Problems in representing knowledge, knowledge representation
using propositional and predicate logic, comparison of propositional and predicate logic,
Resolution, refutation, deduction, theorem proving, inferencing, monotonic and non-
monotonic reasoning.
Unit III:
Probabilistic reasoning, Baye's theorem, semantic networks, scripts, schemas, frames,
conceptual dependency, fuzzy logic, forward and backward reasoning.
Unit IV:
Game playing techniques like minimax procedure, alpha-beta cut-offs etc, planning, Study
of the block world problem in robotics, Introduction to understanding, natural language
processing.
Unit V:
Introduction to learning, Various techniques used in learning, Introduction to neural
networks, applications of neural networks, common sense, reasoning, some example of
expert systems.
Course Objectives:

• To present an overview of artificial intelligence (AI)


principles and approaches.
• Develop a basic understanding of the building blocks
of AI.
Introduction

Artificial Intelligence (AI) is a branch of computer science that focuses on


creating systems capable of performing tasks that typically require human
intelligence.
These tasks include learning from data, reasoning, problem-solving,
understanding natural language, and recognizing patterns.
AI is transforming the world around us, driving innovations in technology,
healthcare, finance, entertainment etc.
Artificial Intelligence:

Artificial intelligence (AI) is the theory and development of computer systems


capable of performing tasks that historically required human intelligence, such as
recognizing speech, making decisions, and identifying patterns.

AI is an umbrella term that encompasses a wide variety of technologies, including


machine learning, deep learning, and natural language processing (NLP).

when most people use the term AI today, they’re referring to a suite of machine
learning-powered technologies, such as Chat GPT or computer vision, that
enable machines to perform tasks that previously only humans can do like
generating written content, steering a car, or analyzing data.
Key Concepts are being used in AI:
1.Machine Learning: A subset of AI where systems learn from data to
improve their performance over time without being explicitly programmed.
Key techniques include supervised learning, unsupervised learning, and
reinforcement learning.
2.Neural Networks: Inspired by the human brain, neural networks are
algorithms designed to recognize patterns and make decisions. Deep
learning, a specialized area of machine learning, involves using large neural
networks with many layers to tackle complex tasks.
3.Natural Language Processing (NLP): This field focuses on enabling
computers to understand, interpret, and generate human language.
Applications include language translation, sentiment analysis & chatbots.
4.Computer Vision: AI systems that can interpret and make decisions
based on visual information from the world. Examples include facial
recognition, object detection, and image classification.
5.Robotics: The integration of AI into robots allows them to perform tasks
autonomously or semi-autonomously.
Examples of AI :
•ChatGPT: Uses large language models (LLMs) to generate text in
response to questions or comments posed to it.

•Google Translate: Uses deep learning algorithms to translate text from


one language to another.

•Netflix: Uses machine learning algorithms to create personalized


recommendation engines for users based on their previous viewing
history.

digital assistants include:


Siri (Apple) Alexa
(Amazon)
Cortana (Microsoft) Google Assistant
(Google) Bixby

•Tesla: Uses computer vision to power self-driving features on their cars.


AI in transportation and navigation include:
•Traffic management systems take in real-time data about the
road, weather, and traffic conditions to predict heavier traffic
flows and congestion.
•Direction apps such as Google Maps, Apple Maps, and Waze all
use location data collected from users to determine traffic, ETAs,
and more.

AI in healthcare:
Early diagnosis: AI can analyze patient and disease data to predict
the likelihood of a patient developing a disease and either diagnose
it early or help to prevent it entirely.
Disease tracking: Using predictive analytics, AI can model
how a contagious disease could spread over the course of time
or across a specific area.
Drug discovery: AI models can discover new applications or
potentially harmful interactions between different drugs.
Evolution of AI
1. Early Foundations (Before 1950)
•Philosophical Beginnings: The concept of machines or artificial beings with
intelligence dates back to ancient civilizations. Philosophers like Aristotle
developed syllogistic logic, a form of reasoning that influenced later AI
developments.
•Mechanical Automata: In the 18th and 19th centuries, inventors created
mechanical devices that could perform simple tasks, laying the groundwork for
the idea of machines simulating human activities.
2. Birth of AI (1950s)
•Alan Turing's Influence: The British mathematician and logician Alan Turing
is often considered the father of AI. In 1950, he proposed the "Turing Test" to
determine if a machine could exhibit human-like intelligence.
•The Dartmouth Conference (1956): The official birth of AI as a field is often
traced to this conference, where researchers like John McCarthy, Marvin
Minsky, Nathaniel Rochester, and Claude Shannon gathered to explore the
possibility of creating "thinking machines."
•Early Programs: In the late 1950s, AI pioneers developed early programs like
the Logic Theorist, which could prove mathematical theorems, and the General
Problem Solver (GPS), designed to solve a wide range of problems.
3. The Golden Age (1950s-1970s)
•Symbolic AI: This period saw the rise of symbolic AI, where researchers focused
on developing systems that manipulated symbols to solve problems and reason
about the world. LISP, a programming language developed by John McCarthy,
became the primary language for AI research.
•Expert Systems: In the 1970s, expert systems like DENDRAL (used for chemical
analysis) and MYCIN (used for medical diagnosis) demonstrated AI's potential in
specialized domains.
•Challenges: Despite early successes, AI faced significant challenges, including
limitations in computational power, the brittleness of systems, and the inability to
handle real-world complexity. This led to the first "AI winter" in the 1970s, where
funding and interest in AI research waned.
4. The Rise of Machine Learning (1980s-1990s)
•Connectionism: The 1980s saw a resurgence in AI through connectionism,
particularly with the development of artificial neural networks. Researchers like
Geoffrey Hinton revived interest in neural networks with the backpropagation
algorithm, allowing for more efficient training of multi-layered networks.
•Machine Learning: AI shifted focus toward machine learning, where systems could
learn from data rather than rely solely on predefined rules. This approach proved
more scalable and effective in many real-world applications.
•AI in Industry: During this period, AI began to be adopted in various
industries, from finance (for credit scoring) to manufacturing (for automation).
5. Modern AI and the Deep Learning Revolution (2000s-Present)
•Big Data and Increased Computing Power: The explosion of data and
advancements in computing power, particularly with the advent of GPUs, enabled
the training of deep neural networks on a scale previously unimaginable.
•Deep Learning: Deep learning, a subset of machine learning, revolutionized AI
by allowing machines to achieve state-of-the-art performance in tasks such as
image recognition, natural language processing, and game playing. Notable
breakthroughs include Google's AlphaGo defeating a world champion Go
player in 2016.
•AI in Everyday Life: Today, AI is embedded in countless applications, from
voice assistants like Siri and Alexa to recommendation systems on platforms like
Netflix and YouTube. It’s also making strides in areas like autonomous driving,
healthcare diagnostics, and more.
•Ethical and Societal Considerations: As AI becomes more pervasive, concerns
around ethics, privacy, bias, and the impact on jobs have grown, prompting
discussions about the responsible development and deployment of AI
technologies.
6. The Future of AI
•Integration with Other Technologies: AI is increasingly being integrated with
other emerging technologies such as the Internet of Things (IoT), blockchain,
and quantum computing, potentially unlocking new capabilities and applications
Production System in AI
In artificial intelligence (AI), a production system refers to a type of rule-based
system that is designed to provide a structured approach to problem solving
and decision-making.

This framework is particularly influential in the realm of expert systems,


where it simulates human decision-making processes using a set of
predefined rules and facts.

Let’s consider an example of Expert System for Medical Diagnosis.

Scenario: A patient comes to a healthcare facility with the following


symptoms: fever, severe headache, sensitivity to light, and stiff neck.

Mediacal diagnosis operates in the following manner:

1.Input: A healthcare professional inputs the symptoms into MediDiagnose.


2.Processing:
2. MediDiagnose reviews its knowledge base for rules that match the
given symptoms.
3. It identifies several potential conditions but recognizes a strong
match for meningitis based on the combination of symptoms.
3.Output:
3. The system suggests that meningitis could be a possible
diagnosis and recommends further tests to confirm, such as a
lumbar puncture.
4. It also provides a list of other less likely conditions based on the
symptoms for comprehensive differential diagnosis.

MediDiagnose uses its rule-based system to quickly filter through vast


amounts of medical data to provide preliminary diagnoses.

This assists doctors in focusing their investigative efforts more


efficiently and potentially speeds up the process of reaching an
accurate diagnosis.
Key Components of a Production System in AI

1. Knowledge Base: This is the core repository where all the rules and facts are stored. In AI, the
knowledge base is critical as it contains the domain-specific information and the if-then rules
that dictate how decisions are made or actions are taken.

2. Inference Engine: The inference engine is the mechanism that applies the rules to the known
facts to derive new facts or to make decisions. It scans the rules and decides which ones are
applicable based on the current facts in the working memory. It can operate in two modes:

2. Forward Chaining (Data-driven): This method starts with the available data and
uses the inference rules to extract more data until a goal is reached.
3. Backward Chaining (Goal-driven): This approach starts with a list of goals and
works backwards to determine what data is required to achieve those goals.

3. Working Memory: Sometimes referred to as the fact list, working memory holds the dynamic
information that changes as the system operates. It represents the current state of knowledge,
including facts that are initially known and those that are deduced throughout the operation of
the system.
4. Control Mechanism: This governs the order in which rules are applied by the inference
engine and manages the flow of the process. It ensures that the system responds appropriately
to changes in the working memory and applies rules effectively to reach conclusions or
solutions.
Breadth-First Search (BFS):

BFS, Breadth-First Search, is a vertex-based technique for finding the shortest path in
the graph. It uses a Queue data structure that follows first in first out. In BFS, one vertex
is selected at a time when it is visited and marked then its adjacent are visited and stored
in the queue. It is slower than DFS.

Depth First Search (DFS):

DFS, Depth First Search, is an edge-based technique. It uses the Stack data
structure and performs two stages, first visited vertices are pushed into the stack, and
second if there are no vertices then visited vertices are popped.
Comparison of BFS and DFS
Parameters BFS DFS

Stands for BFS stands for Breadth First Search. DFS stands for Depth First Search.

Data BFS(Breadth First Search) uses Queue data structure for


DFS(Depth First Search) uses Stack data structure.
Structure finding the shortest path.

DFS is also a traversal approach in which the traverse


BFS is a traversal approach in which we first walk through
begins at the root node and proceeds through the
Definition all nodes on the same level before moving on to the next
nodes as far as possible until we reach the node with
level.
no unvisited nearby nodes.

Conceptual
BFS builds the tree level by level. DFS builds the tree sub-tree by sub-tree.
Difference

Approach
It works on the concept of FIFO (First In First Out). It works on the concept of LIFO (Last In First Out).
used

BFS is more suitable for searching vertices closer to the DFS is more suitable when there are solutions away
Suitable for given source. from source.

DFS is used in various applications such as acyclic


BFS is used in various applications such as bipartite graphs,
Applications shortest paths, etc.
graphs and finding strongly connected components
etc.
Hill Climbing Algorithm

• Hill climbing algorithm is a local search algorithm which continuously


moves in the direction of increasing elevation/value to find the peak of the
mountain or best solution to the problem. It terminates when it reaches a
peak value where no neighbor has a higher value.
• Hill climbing algorithm is a technique which is used for optimizing the
mathematical problems. One of the widely discussed examples of Hill
climbing algorithm is Traveling-salesman Problem in which we need to
minimize the distance traveled by the salesman.
• It is also called greedy local search as it only looks to its good immediate
neighbor state and not beyond that.
• A node of hill climbing algorithm has two components which are state and
value.
• Hill Climbing is mostly used when a good heuristic is available.
• In this algorithm, we don't need to maintain and handle the search tree or
graph as it only keeps a single current state.
Features of Hill Climbing:

1.Generate and Test variant: Hill Climbing is the variant of Generate and Test
method. The Generate and Test method produce feedback which helps to decide
which direction to move in the search space.
2.Greedy approach: Hill-climbing algorithm search moves in the direction which
optimizes the cost.
3.No backtracking: It does not backtrack the search space, as it does not remember
the previous states.
4.Deterministic Nature:
Hill Climbing is a deterministic optimization algorithm, which means that given the
same initial conditions and the same problem, it will always produce the same
result. There is no randomness or uncertainty in its operation.
5.Local Neighborhood:
Hill Climbing is a technique that operates within a small area around the current
solution. It explores solutions that are closely related to the current state by making
small, gradual changes. This approach allows it to find a solution that is better than
the current one although it may not be the global optimum.
Advantages of Hill climb algorithm:

The merits of Hill Climbing algorithm are given below.

1. The first part of the paper is based on Hill's diagrams that can easily put things together,
ideal for complex optimization problem. A hill climbing algorithm is first invention of hill
climbers.

2. It uses much less RAM for the current problem state and the solutions located around it
than comparing the algorithm to a tree search method which will require inspecting the
entire tree. Consequently, reducing the total memory resources to be used. Space is what
matters solutions should occupy a convenient area to consume as little of memory as
possible.

3. When it comes to the acceleration of the hill up, most of the time it brings a closure in the
local maximum straight away. This is the route if having quickly getting a solution,
outshining acquiring a global maximum, is an incentive.
Different regions in the state space
landscape:

Local Maximum: Local maximum is a state


which is better than its neighbor states, but
there is also another state which is higher than
it.

Global Maximum: Global maximum is the


best possible state of state space landscape. It
has the highest value of objective function.

Current state: It is a state in a landscape


diagram where an agent is currently present.

Flat local maximum: It is a flat space in the


landscape where all the neighbor states of
current states have the same value.

Shoulder: It is a plateau region which has an


uphill edge.
Problems in Hill Climbing Algorithm:

1. Local Maximum: A local maximum is a peak state in the landscape which is better than
each of its neighboring states, but there is another state also present which is higher
than the local maximum.

Solution: Backtracking technique can be a solution of the local maximum in state space
landscape. Create a list of the promising path so that the algorithm can backtrack the search
space and explore other paths as well.
2. Plateau: A plateau is the flat area of the search space in which all the neighbor states of
the current state contains the same value, because of this algorithm does not find any best
direction to move. A hill-climbing search might be lost in the plateau area.

Solution: The solution for the plateau is to take big steps or very little steps while
searching, to solve the problem. Randomly select a state which is far away from the current
state so it is possible that the algorithm could find non-plateau region.
3. Ridges: A ridge is a special form of the local maximum. It has an area which is higher
than its surrounding areas, but itself has a slope, and cannot be reached in a single move.

Solution: With the use of bidirectional search, or by moving in different directions,


we can improve this problem.
Difference between the A* Algorithm and AO* algorithm

•A* algorithm and AO* algorithm both works on the best first search.

•They are both informed search and works on given heuristics values.

•A* always gives the optimal solution but AO* doesn’t guarantee to give the
optimal solution.

•Once AO* got a solution doesn’t explore all possible paths but A* explores
all paths.

•When compared to the A* algorithm, the AO* algorithm uses less memory.

•opposite to the A* algorithm, the AO* algorithm cannot go into an


endless loop.
Advanced Search Algorithms
AO* Algorithm:

Best-first search is what the AO* algorithm does.


• The AO* method divides any given difficult problem into a
smaller group of problems that are then resolved using the
AND-OR graph concept.
• AND OR graphs are specialized graphs that are used in
problems that can be divided into smaller problems.
• The AND side of the graph represents a set of tasks that
must be completed to achieve the main goal, while the OR
side of the graph represents different methods for
accomplishing the same main goal.
Working of AO* algorithm:
The evaluation function in AO* looks like this:
f(n) = g(n) + h(n)
f(n) = Actual cost + Estimated cost
here,
f(n) = The actual cost of traversal.
g(n) = the cost from the initial node to the current node.
h(n) = estimated cost from the current node to the goal state.
Start from node A,
f(A⇢B) = g(B) + h(B) = 1 + 5 ……here g(n)=1 is taken by default for path cost = 6

f(A⇢C+D) = g(c) + h(c) + g(d) + h(d) = 1 + 2 + 1 + 4 ……here we have added C & D


because they are in AND = 8

So, by calculation A⇢B path is chosen which is the minimum path, i.e f(A⇢B)
According to the answer of step 1,

explore node B Here the value of E & F are


calculated as follows,

f(B⇢E) = g(e) + h(e) f(B⇢E) = 1 + 7 = 8 f(B⇢f) = g(f)


+ h(f) f(B⇢f) = 1 + 9 = 10

So, by above calculation B⇢E path is chosen which


is minimum path,

i.e f(B⇢E) because B's heuristic value is different


from its actual value The heuristic is updated and
the minimum cost path is selected.

The minimum value in our situation is 8.


Therefore, the heuristic for A must be updated
due to the change in B's heuristic. So we need to
calculate it again. f(A⇢B) = g(B) + updated h(B) = 1
+ 8 = 9 We have Updated all values in the above
tree.
By comparing f(A⇢B) & f(A⇢C+D) f(A⇢C+D) is shown to be
smaller. i.e 8 < 9 Now explore f(A⇢C+D)
So, the current node is C

f(C⇢G) = g(g) + h(g)


f(C⇢G) = 1 + 3 = 4

f(C⇢H+I) = g(h) + h(h) + g(i) + h(i)

f(C⇢H+I) = 1 + 0 + 1 + 0 ……here we have added H & I


because they are in AND = 2

f(C⇢H+I) is selected as the path with the lowest cost and


the heuristic is also left unchanged

because it matches the actual cost. Paths H & I are solved


because the heuristic for those paths is 0,

but Path A⇢D needs to be calculated because it has an


AND.
f(D⇢J) = g(j) + h(j)
f(D⇢J) = 1 + 0 = 1

the heuristic of node D needs to be updated to 1.

f(A⇢C+D) = g(c) + h(c) + g(d) + h(d) = 1 + 2 + 1 + 1 = 5

as we can see that path f(A⇢C+D) is get solved and this tree has become a
solved tree now.

In simple words, the main flow of this algorithm is that we have to find

firstly level 1st heuristic value and then level 2nd and after that update the
values with going upward means towards the root node.

In the above tree diagram, we have updated all the values.


Real-Life Applications of AO* algorithm:

Vehicle Routing Problem:


The vehicle routing problem is determining the shortest routes for a fleet of vehicles
to visit a set of customers and return to the depot, while minimizing the total distance
travelled and the total time taken.

The AO* algorithm can be used to find the optimal routes that satisfy both objectives.

Portfolio Optimization:
Portfolio optimization is choosing a set of investments that maximize returns while
minimizing risks.

The AO* algorithm can be used to find the optimal portfolio that satisfies both
objectives, such as maximizing the expected return and minimizing the standard
deviation.
An Introduction to A* Search Algorithm in AI
A* (pronounced "A-star") is a powerful graph traversal and pathfinding
algorithm widely used in artificial intelligence and computer science. It is
mainly used to find the shortest path between two nodes in a graph, given the
estimated cost of getting from the current node to the destination node. The
main advantage of the algorithm is its ability to provide an optimal path by
exploring the graph in a more informed way compared to traditional search
algorithms such as Dijkstra's algorithm.

Algorithm A* combines the advantages of two other search algorithms:


Dijkstra's algorithm and Greedy Best-First Search. Like Dijkstra's algorithm, A*
ensures that the path found is as short as possible but does so more efficiently by
directing its search through a heuristic similar to Greedy Best-First Search. A
heuristic function, denoted h(n), estimates the cost of getting from any given
node n to the destination node.
The main idea of A* is to evaluate each node based on two
parameters:
g(n): the actual cost to get from the initial node to node n. It represents the
sum of the costs of node n outgoing edges.
h(n): Heuristic cost (also known as "estimation cost") from node n to
destination node n. This problem-specific heuristic function must be
acceptable, meaning it never overestimates the actual cost of achieving the
goal. The evaluation function of node n is defined as f(n) = g(n) +h(n).
Algorithm A* selects the nodes to be explored based on the lowest value of
f(n), preferring the nodes with the lowest estimated total cost to reach the
goal. The A* algorithm works:
Advantages of A* Search Algorithm in Artificial Intelligence
1.Optimal solution: A* ensures finding the optimal (shortest) path from the start node
to the destination node in the weighted graph given an acceptable heuristic function.
This optimality is a decisive advantage in many applications where finding the
shortest path is essential.
2.Completeness: If a solution exists, A* will find it, provided the graph does not have
an infinite cost This completeness property ensures that A* can take advantage of a
solution if it exists.
3.Efficiency: A* is efficient ifan efficient and acceptable heuristic function is used.
Heuristics guide the search to a goal by focusing on promising paths and avoiding
unnecessary exploration, making A* more efficient than non-aware search algorithms
such as breadth-first search or depth-first search.
4.Versatility: A* is widely applicable to variousproblem areas, including wayfinding,
route planning, robotics, game development, and more. A* can be used to find optimal
solutions efficiently as long as a meaningful heuristic can be defined.
5.Optimized search: A* maintains a priority order to select the nodes with the minor
f(n) value (g(n) and h(n)) for expansion. This allows it to explore promising paths
first, which reduces the search space and leads to faster convergence.
6.Memory efficiency: Unlike some other search algorithms, such as breadth-first
search, A* stores only a limited number of nodes in the priority queue, which makes it
memory efficient, especially for large graphs.
Disadvantages of A* Search Algorithm in Artificial Intelligence
1.Heuristic accuracy: The performance of the A* algorithm depends heavily on the
accuracy of the heuristic function used to estimate the cost from the current node to
the If the heuristic is unacceptable (never overestimates the actual cost) or
inconsistent (satisfies the triangle inequality), A* may not find an optimal path or
may explore more nodes than necessary, affecting its efficiency and accuracy.
2.Memory usage: A* requires that all visited nodes be kept in memory to keep track
of explored paths. Memory usage can sometimes become a significant issue,
especially when dealing with an ample search space or limited memory resources.
3.Time complexity: AlthoughA* is generally efficient, its time complexity can be a
concern for vast search spaces or graphs. In the worst case, A* can take exponentially
longer to find the optimal path if the heuristic is inappropriate for the problem.
4.Bottleneck at the destination: In specific scenarios, the A* algorithm needs to
explore nodes far from the destination before finally reaching the destination region.
This the problem occurs when the heuristic needs to direct the search to the goal early
effectively.
5.Cost Binding: A* faces difficulties when multiple nodes have the same f-value (the
sum of the actual cost and the heuristic cost). The strategy used can affect the
optimality and efficiency of the discovered path. If not handled correctly, it can lead
to unnecessary nodes being explored and slow down the algorithm.
Applications of the A* Search Algorithm in Artificial Intelligence
The search algorithm A* (letter A) is a widely used and robust pathfinding algorithm
in artificial intelligence and computer science. Its efficiency and optimality make it
suitable for various applications.
1.Pathfinding in Games: A* is oftenused in video games for character movement,
enemy AI navigation, and finding the shortest path from one location to another on
the game map. Its ability to find the optimal path based on cost and heuristics makes
it ideal for real-time applications such as games.
2.Robotics and Autonomous Vehicles: A* is used in robotics and autonomous
vehicle navigation to plan anoptimal route for robots to reach a destination, avoiding
obstacles and considering terrain costs. This is crucial for efficient and safe
movement in natural environment.
3.Puzzle-solving: A* can solve various diagram puzzles, such as sliding puzzles,
Sudoku, and the 8-puzzle problem. Resource Allocation: In scenarios where
resources must be optimally allocated, A* can help find the most efficient allocation
path, minimizing cost and maximizing efficiency.
4.Network Routing: A* can be usedin computer networks to find the most efficient
route for data packets from a source to a destination node.
5.Natural Language Processing (NLP): In some NLP tasks, A* can generate
coherent and contextualresponses by searching for possible word sequences based on
their likelihood and relevance.
Thank You.

You might also like