IAA Mod1@azdocuments - in
IAA Mod1@azdocuments - in
INTRODUCTION TO AI
AND APPLICATIONS
SUBJECT CODE: 1BAIA103/203
MODULE-1
Name:
USN:
College:
AZ Documents
Your Engineering Study Partner
[Link]
IAA MODULE-01 AZ Documents
[Link] Page 1
IAA MODULE-01 AZ Documents
The main focus of this technology is to build machines and algorithms which are capable of
performing computational tasks that would otherwise require human-like brain functions.
While computers execute certain tasks like sorting, computing,memorizing, indexing, finding
patterns, etc. far better than humans, they still cannot beat human skills for identifying
emotions, recognizing faces, communication and conversation. This is where AI will play a
crucial role to enable machines
achieve human capabilities.
[Link] Page 2
IAA MODULE-01 AZ Documents
Advantages
1. Performs well on tasks that uses detailed data.
2. Takes less time to perform tasks that needs to process huge
volumes of data.
3. Generates consistent and accurate results.
4. Can be used 24 X 7.
5. Optimizes tasks by better utilizing resources.
6. Automates complex processes.
7. Minimizes downtime by predicting maintenance needs.
8. Enables companies to produce new products having better
quality and speed.
Disadvantages
1. Involves more cost.
2. Technical expertise required to develop and use AI
applications.
3. Lack of trained professionals.
4. Incomplete or inaccurate data may result in disastrous
Results.
5. Lacks the capability to generalize tasks.
In 2017, Google’s CEO, Sundar Pichai, pronounced that Google
would operate as an ‘AI first’ company.
Conclusion: Today, every big enterprise has used AI to improve
its operations and gain advantage on their competitors.
[Link] Page 3
IAA MODULE-01 AZ Documents
In 1943, Warren McCullough and Walter Pitts wrote a paper that proposed the first
mathematical model for building a neural network.
1950 was a significant year in the field of AI. A series of events took place this year
including the following: Alan Turing demonstrated Turing Test, that could determine whether
a machine is intelligent or not. Harvard undergraduates Marvin Minsky and Dean Edmonds
built the first neural network [Link] Shannon publishes a paper on programming a
computer for playing [Link] Asimov published his work on the ‘Three Laws of
Robotics.’
In 1952, Arthur Samuel developed a self-learning program to
play checkers.
In 1954, the IBM computer could translate 60 carefully selected
Russian sentences into English.
In 1956, John McCarthy coined the term ‘artificial intelligence’.
The scope and goals of AI were discussed in a conference later. It is from this point that we
consider the birth of artificial intelligence as we know it [Link] the same year, Allen Newell
and Herbert Simon demonstrated the first reasoning program.
In 1958, John McCarthy developed the AI programming language, Lisp. He also published a
paper discussing a complete AI system that could learn from experience as effectively as
Humans do.
In 1959, Allen Newell, Herbert Simon and J.C. Shaw developed the General Problem Solver
(GPS), a program designed to imitate human [Link] the same year, Arthur
Samuel coined the term ‘machine learning’.
In 1963, John McCarthy started the AI Lab at [Link] Professor Joseph Weizenbaum
developed ELIZA, an early natural language processing program that laid the foundation for
today’s chatbots.
In 1969, the first successful expert systems to diagnose blood
infections was developed at Stanford.
In 1972, logic programming language PROLOG was created.
[Link] Page 4
IAA MODULE-01 AZ Documents
The 1974–1980 period is known as the ‘First AI Winter,’ because it was during this period
that DARPA cutbacks in academic grants and funding for AI dried up, stalling further
research.
In 1980, DEC developed the first successful commercial expert system, R1.
In 1982 Japan launched the ambitious Fifth Generation Computer Systems (FGCS) project to
develop supercomputers that could support performance and a platform for AI development.
Later, in 1983, even the US government funded research in advanced computing and artificial
intelligence.
1987–1993 marked the ‘Second AI Winter.’ In 1992, Japan terminated the FGCS project
owing to failure in meeting its ambitious goals. The US also ended the project in 1993 after
spending nearly $1 billion as the results were far from what were expected.
In 1997, IBM’s Deep Blue machine could beat world chess
champion, Gary Kasparov.
In 2005, STANLEY, a self-driving car, won the DARPA Grand Challenge. Even the US
military started investing in autonomous robots like Boston Dynamics’ ‘Big Dog’ and
iRobot’s ‘PackBot.’
In 2008, Google did a remarkable work in speech recognition
and introduced the feature in its iPhone app.
In 2011, Apple released Siri, an AI-powered virtual assistant that could be used through its
iOS operating system.
In 2012, Andrew Ng, founder of the Google Brain Deep Learning
project, fed 10 million YouTube videos as a training set to a neural network and used deep
learning algorithms to enable the neural network to recognize a cat without being told what a
cat is.
In 2014, Google makes the first self-driving car that could pass a
state driving test. In the same year, Amazon released Alexa.
In 2015, Baidu’s Minwa supercomputer used a convolutional neural network (special deep
neural network) to identify and categorize images with a higher rate of accuracy than the
average human.
In 2016 Google DeepMind’s AlphaGo defeated world champion
Go player Lee Sedol. Go is an ancient Chinese game and winning
this game was a major breakthrough in the field of AI.
In the same year, the first ‘robot citizen’, a humanoid robot, Sophia was created that could
perform facial recognition, verbal communication and facial expression.
In 2018, Google released NLP engine BERT that reduced barriers
in translation and understanding by machine learning applications. In the same year, Waymo
One service was launched that allowed users to request a pick-up from one of the company’s
self-driving vehicles.
In 2020, Baidu released its LinearFold AI algorithm to develop a vaccine during the early
stages of the SARS-CoV-2 pandemic. The algorithm could predict the RNA sequence of the
virus in just 27 seconds, 120 times faster than other methods.
[Link] Page 5
IAA MODULE-01 AZ Documents
1.3.1 Weak AI
Weak AI, also known as narrow AI,is specifically designed to perform a specific type
of task. For example, Siri and Alexa are weak AI systems. These systems are already trained
with appropriate responses to classify things accordingly. When you instruct Alexa to play a
song, it responds by playing that song. In fact, majority of AI applications that we use today
(predicting weather, stock prices, optimizing business, etc.) come under this category. Weak
AI systems operate within a limited context and are the most successful realization of
artificial intelligence to date. Application of narrow AI has resulted in significant societal
benefits. Google search, Image recognition software, self-driving cars and IBM’s Watson are
some examples of such Systems.
1.3.2 Strong AI
Strong AI, also known as artificial general intelligence or artificial super intelligence
(ASI) or superintelligence, makes full attempt to resemble the human brain. It utilizes
cognitive skills and fuzzy logic to perform tasks for which it had not been trained earlier.
Such a system needs capability for visual perception, speech recognition, decision-making
and translations between [Link] of now, we see general AI only in sci-fi movies,
where machines emulate human intelligence and think strategically to perform complex tasks.
However, it is believed that soon, ASI will surpass the intelligence and ability of the human
brain as demonstrated by HAL, the superhuman, rogue computer assistant in 2001: A Space
Odyssey. Many people fear that intelligent robots would overrun humanity, but experts says
that we need not worry about it as it is not likely to happen in the near future. Moreover,
artificial intelligence systems can also be categorized into four groups based on their
functionality. This categorization can be given as discussed in Table 1.1.
[Link] Page 6
IAA MODULE-01 AZ Documents
[Link] Page 7
IAA MODULE-01 AZ Documents
2. Long Short-term Memory (LSTM): Such models use past data to help predict the next
item in a sequence. More recent information is given a higher priority for prediction than past
data. However, this does not mean that past data is not considered while making predictions.
3. Evolutionary Generative Adversarial Networks (E-GAN):
The ML model evolves over time to explore new ways of utilizing previous experiences to
formulate new decisions. The model is continuously striving to discover a better path. It
makes use of simulations and statistics, to predict outcomes throughout its evolutionary
mutation cycle.
1.3.6 Self-Awareness
Once Theory of Mind is established, then the next step would be incorporating
self-awareness in AI systems. Self-awareness in machines enable them to possess
human-level consciousness, understand the current state its own existence in the world and
use that information to deduce others feelings. Self-AI systems will be able to understand
what others may need. They could interpret user’s feelings by learning not only what they
communicate to them but also how the communicate it. Knowledge imbibed by researchers
and its learning of the conscious context will help them to respond to an event. However,
such systems do not yet exist but may become available in the near future.
[Link] Page 8
IAA MODULE-01 AZ Documents
MACHINE LEARNING
Let us try to understand the term ‘machine learning’ with the help of some real-world
scenarios.
Scenario 1: Imagine that you are given the task of finding the missing number in the
series-10,20,30,40, ? Yes, you are correct. That’s 50. But how did you get the answer?You
quickly did some computations in your mind and observed the pattern in the data values. The
whole idea of machine learning is to imbibe the same thinking process in machines.
Scenario 2: Before going for playing a cricket match, you always use your past experiences
to understand how a batsman/bowler plays. For example, if you know a bowler gives a
straight ball after every 2 left balls and 1 right ball, then you can better use this information to
prepare yourself for the next ball. In machine learning, we make machines also to learn from
past experience/data.
Scenario 3: When you buy a new mobile phone, you can yourself compute the price of that
phone vis-à-vis the configuration and brand. For example, you know a phone with 128 GB
RAM, stereo speakers, iOS 16, hexacore would cost around 80K. So, given the details, we
can predict the price. Similarly, a machine learning program is developed to predict values
based on certain [Link] let us go deeper in this terminology. Machine Learning is
a branch of computer science that analyses data and identifies patterns to teach a machine to
deduce results and make decisions without any human intervention.
[Link] Page 9
IAA MODULE-01 AZ Documents
human time and effort but also makes better [Link], machine learning is an
application of artificial intelligence (refer Fig. 1.4) that enables machines to automatically
learn and improve from experiences without being explicitly [Link] enables
computers (machines) to make data-driven decisions rather than being explicitly programmed
for carrying out a certain task. These algorithms are designed to learn and improve over time
when are exposed to new data. Thus, the process of teaching the machines is a structural
process that can be broken down into three steps (Fig. 1.5).
[Link] Page 10
IAA MODULE-01 AZ Documents
[Link] Page 11
IAA MODULE-01 AZ Documents
For example, if we give customer demographics and transactions as input and use historical
customer churn rates as output, then the algorithm will formulate a program (also known as
predictive model) that can predict if a customer will churn or not.
Case Study: It is not easy to filter Amna’s photos from a set of 100 images using traditional
programming. Even comparing every pixel value may not give accurate results. But the same
task can be easily done with machine learning. We just need to input different photos of
Amna, the machine learning model will learn how she looks like.
[Link] Page 12
IAA MODULE-01 AZ Documents
[Link] Page 13
IAA MODULE-01 AZ Documents
Features of AI
1. Artificial intelligence is autonomous and can make independent decisions without any
human [Link] systems work silently in the background without the user’s
knowledge. The best part of an AI system is that they don’t have to be programmed manually
to respond to every situation. Rather, these systems themselves learn through input data and
past experiences. Baidu, a search engine that works in the Chinese language, has a voice
cloning tool, which can clone human voice with just 3-4 seconds of audio, as opposed to the
previously taken 30 minutes
2. Predict and adapt: AI systems can understand data patterns to make decisions and
predictions.
3. An AI system continuously learns from patterns in data.
4. An AI system is said to be reactive as it perceives a problem and acts on perception.
5. Data driven: In the last several years, the cost of technology has gone down considerably.
With the availability of cheap data storage (hard disk, etc.), fast processors (CPU, GPU
orTPU) and sophisticated deep learning algorithms, huge volumes of data can now be easily
extracted. This has led to the rise of data centric AI systems.
[Link] Page 14
IAA MODULE-01 AZ Documents
6. Data driven AI systems can make accurate predictions based on past experiences that have
outperformed humans. However,success of these systems depends largely on the availability
of correctly labelled large datasets.
7. Finally, an AI system is futuristic since the scope of it being applied in different areas is
continuously expanding.
[Link] Page 15
IAA MODULE-01 AZ Documents
Reasoning
It is the set of processes that is used in making decisions and prediction. There are two
types of reasoning inductive and deductive. The differences between these two techniques is
given in Table 3.1.
Learning
[Link] Page 16
IAA MODULE-01 AZ Documents
6. Relational learning involves learning to differentiate among various stimuli on the basis of
relational properties, rather than absolute properties. For example, if we know that the last
time we cooked a dish, it had excess spices, the next time, we would add spices in lesser
quantity.
7. Spatial learning is done through visual stimuli such as images, colours, maps, etc. For
example, we usually create a roadmap in our minds before actually moving to the road.
8. Stimulus-response learning facilitates subjects to perform a particular behaviour when a
certain stimulus is received. For example, we usually shout when we touch a hot vessel.
Problem Solving
It is the process in which one tries to find the desired solution in the present situation by
following the path which is blocked by known or unknown hurdles. Problem solving uses
decision- making to select the best suitable alternative to reach the desired goal.
Perception
It is the process of acquiring, interpreting, selecting and organizing sensory information.
While humans use sensory organs to perceive their environment, AI systems use data
acquired by the sensors to do the same.
Linguistic Intelligence
It is used in in interpersonal communication and defines one’s ability to use, comprehend,
speak and write the verbal and written language.
[Link] Page 17
IAA MODULE-01 AZ Documents
In an artificially intelligent system, the agents act in their environment which may contain
other agents. This agent (refer Fig. 3.2) can be anything that is capable of perceiving its
environment. For this, it may have sensors. Agents also have effectors that help them to act
upon their environment. The different types of agents in an AI system include the
following:
1. Human agent: A human agent has sensory organs (like eyes, ears, nose, tongue and skin)
that acts as sensors, and other organs such as hands, legs, mouth as effectors for taking
actions.
2. Robotic agent: A robotic agent uses cameras and infrared range finders as sensors, and
various motors and actuators as effectors.
3. Software agent: Such an agent uses bit strings as its programs and actions.
1.9.2 Rationality
Rationality is a feature that inculcates a sense of responsibility,sensibility and
judgment. It empowers the agent to perform expected actions after perceiving. The agent
must perform all the actions to maximize its performance measure with respect to the percept
sequence and the knowledge base that it [Link], we can say that rationality of an agent
depends on
[Link] Page 18
IAA MODULE-01 AZ Documents
the following:
1. Agent’s performance measure that gives the degree of success.
2. Agent’s percept sequence received so far.
3. Agent’s prior knowledge about the environment.
4. Agent’s actions that can be performed.
A rational agent (refer Fig. 3.3) always performs the right action in the given percept
sequence to maximize performance. Thus, a problem solved by an agent is characterized by
performance measure, environment, actuators, and sensors (PEAS).
[Link] Page 19
IAA MODULE-01 AZ Documents
Internal state represents unobserved aspects of the current state depending on percept
[Link] update the state, information is required to understand, How the world evolves and
How the agent’s actions affect the world.
Goal-Based Agents
Goal means a description of desirable situations. Goal-based agents (refer Fig. 3.5)
choose their actions to achieve goals. This provides more flexibility than reflex agent as the
knowledge supporting a decision is explicitly modeled and permits any sort of modifications.
[Link] Page 20
IAA MODULE-01 AZ Documents
Utility-Based Agents
Many a time, goals are either conflicting or are difficult to achieve. In such situations,
utility-based agents (refer Fig. 3.6) can be used to achieve goals that are more important than
others. These agents choose actions based on a preference (utility) for each state.
Learning Agent
A learning agent (refer Fig. 3.7) learns from its past experiences. It is designed to
possess learning capabilities. Initially, it starts working with basic knowledge and then acts
and adapts automatically through learning.
[Link] Page 21
IAA MODULE-01 AZ Documents
Turing Test
Turing test is widely used to determine the success of an intelligent behaviour of a
system. Two persons and a machine or intelligent system or software agent to be evaluated
participate in the test. One of the two persons becomes the
tester. The other person and the software agent are then made to sit in different rooms. The
tester does not know who is the machine and who is a human. He asks them questions by
typing and sending them to both, and receives typed responses.
The aim of this test is to fool the tester. If the tester fails to determine whether the reply is
coming from a machine or a human, then the machine is said to be intelligent.
[Link] Page 22
IAA MODULE-01 AZ Documents
is quite vast, we can identify a small number of dimensions to categorize them as given
below.
Discrete/Continuous
If an environment has a limited number of distinct, clearly defined, states, then it is
said to be discrete. For example, a software agent designed to play chess game works in a
discrete environment as there are limited moves that a player can make.
However, a self-driving car operates in a continuous environment. While a discrete
environment has a finite number of percepts and actions that can be performed within it, a
continuous environment has no such constraints.
Known Vs Unknown
Known and unknown are based on an agent’s state of knowledge to perform an action
and they are not actually a feature of an environment. In a known environment, the agent
knows the results for all actions but in an unknown environment, the agent has to learn how it
should work to perform an action. Usually, a known environment is partially observable and
an unknown environment is fully observable. While known environments are good examples
of exploitation, unknown environments are best for exploration. Reinforcement learning is
extensively applied in an unknown environment.
Observable/Partially Observable
If an agent can determine the complete state of the environment at each time point
from the percepts, then it is said to be observable; otherwise, it is only partially observable.
Correspondingly, in an unobservable environment, the agent has no sensors. In a fully
observable environment, the complete state of the environment relevant to the choice of
action of the agent can be captured using its sensors. While a fully observable environment
(refer Fig. 3.9) does not require to maintain the internal state to keep track history of the
world, a not fully observable environment, on the other hand, must maintain an internal state
to keep track of the world. An environment with sensors can be partially observable because
of noise, inaccuracy of the sensors, due to the framework of the task itself or because parts of
the state are missing from the sensor [Link] example, the classic chess game is fully
observable as one agent can perceive the positions and the moves of the other agent. But in
the Kriegspiel version of chess, the game environment is partially observable as only invalid
moves can be observed.
[Link] Page 23
IAA MODULE-01 AZ Documents
Static/Dynamic
A static environment does not change when an agent is acting, but a dynamic
environment does. Agents in static environments, therefore, do not take into account the state
of the environment during the action and are thus easy to deal with. However, in a dynamic
environment, agents must consider the world while performing each action. For example,
self-driving cars work in a dynamic environment, but games like crossword puzzles and chess
operate in a static one. Between these two extremes, we can also have semi-dynamic
environments which do not change with the passage of time but the agent’s performance
score does.
Accessible/Inaccessible
In an accessible environment, the sensory apparatus of the agent has access to the
complete state of the environment. This means that it can obtain complete and accurate
[Link] Page 24
IAA MODULE-01 AZ Documents
information about the state’s environment, but this is not so in case of an inaccessible
[Link] example, an empty room whose state can be defined by its temperature is an
example of an accessible environment,whereas information about an event on the Earth is an
inaccessible environment.
Deterministic/Non-deterministic
In a deterministic environment (refer Fig. 3.11), the next state of the environment can
be easily determined by the current state as well as the actions of the agent. This is not true
for a non-deterministic environment. A non-deterministic environment description maximizes
an agent’s performance for all possible outcome of its actions. Note that in a deterministic,
fully observable environment, the agent does worry about [Link] a Stochastic
environment, uncertainty about outcomes is quantified in terms of probabilities.
For example, the game of ludo is non-deterministic as the dice will generate a number
randomly, creating uncertainty in the environment. On the contrary, chess can be considered a
deterministic environment to a certain extent as the state of the game can be determined by
estimating the other agent’s moves although there can be uncertainty due to the other agent in
the game. Most real-life situations are so complex that it is not possible to track of all the
unobserved aspects. In such cases, we can consider them as deterministic.
Episodic/Non-episodic
In an episodic environment (refer Fig. 3.12), each episode has an agent perceiving and
then acting. The quality of its action depends just on the episode itself. Subsequent episodes
do not depend on the actions performed in the previous episodes. Episodic environments are,
therefore, simpler as the agent does not need to think ahead. There are however, a series of
one- shot actions, and only the current percept is required for the action. On the other hand, in
a sequential or non-episodic environment, an agent requires memory to store past actions so
that it can determine the next best actions. Therefore, the current decision can affect all future
decisions.
[Link] Page 25
IAA MODULE-01 AZ Documents
1.10 Search
Algorithms
We have read that artificial Intelligence is the study of building rational agents. These
agents make use of some or the other search algorithms in the background to achieve their
tasks. For example, some single-player games like tile games, Sudoku, crossword, etc., use
search algorithms to deduce a particular position in the game.
A search problem consists of the following:
1. State space is the set of all possible states that can be attained by an agent.
2. Start state is the state from where the searching is done.
3. Goal test is a function that checks if the current state is the
goal state or not.
4. Solution to a search problem is a sequence of actions (also known as plan) that transforms
the start state to the goal state. This plan is realized using search algorithms.
[Link] Page 26
IAA MODULE-01 AZ Documents
3. Time and space complexity: Time complexity is the time taken by an algorithm to
complete a given task, and space complexity is the maximum storage space required to
perform the search operation. A good search algorithm takes less time and space to do its
work.
In Fig. 3.14, we can clearly visualize the working of a DFS algorithm. Here, searching starts
from the root node A and then traverses nodes B, D and H. Now, H is the leaf node, so we
retrace the path to reach node B to traverse its unexplored branch. Nodes E and I are thus
traversed. Now, I is the leaf node, so again, the path is retraced to follow the unexplored
branch of node E. As a result, node J is visited and then it is found that all nodes in branches
[Link] Page 27
IAA MODULE-01 AZ Documents
of node B have been traced. So, the algorithm will move further by exploring the other
untraced branch of the root node. Here, node C, followed by nodes F, K and G are explored.
From these observations, we can conclude that DFS algorithm occupies a lot of memory
space, and takes a lot of time to execute when the solution is at the bottom or end of the
[Link] is implemented using LIFO, that is, stack data structure. Time complexity of the
algorithm can be given as, O(b ). It is equivalent to the number of nodes traversed in DFS.
Correspondingly, space complexity is equivalent to how large can the fringe get. It is given as
O(bm), where b is the maximum branching factor in a tree.d defines the depth of the
least-cost solution.m specifies the maximum depth of the state space. It maybe Infinity. Note
that path = the depth of the search tree = the number of
levels of the search tree = number of nodes in level .DFS algorithm explores as far as
possible along each branch before backtracking. Though the DFS algorithm is complete if the
search tree is finite and a solution exists, it is not optimal as the number of steps in reaching
the solution, or the cost spent in reaching it is high.
Advantages
1. It uses less memory as it stores only the nodes on the path
from the root node to the current node.
2. It takes less time to reach the goal node/state as compared to the BFS algorithm.
Disadvantages
1. Sometimes, many states keep recurring. In such a scenario, there is no guarantee of finding
the solution.
2. In certain cases, the algorithm may get stuck in an infinite loop while going deep searching
for nodes in the tree. A possible solution to this problem is to choose an appropriate value of
cut-off depth. If the ideal cut-off is d, and the chosen cut-off is less than d, then algorithm
fails. But, if the chosen cut-off is more than d, the execution time increases.
3. Complexity of the algorithm depends on the number of paths.
4. DFS cannot check duplicate nodes.
Example: Explore the path that will be explored using the DFS algorithm to reach node G
from S.
DFS creates the same set of nodes as breadth-first method, different order.
Solution: To explore the path, a search tree for the graph will be created. Since DFS traverses
the tree using the ‘deepest node first’ technique, it would always pick the deeper branch until
it reaches the solution or until all nodes of the current branch have been traversed. The
traversal is shown in blue arrows.
[Link] Page 28
IAA MODULE-01 AZ Documents
The DFS path can be given as, S -> A -> B -> C -> G
Example: Consider the graph given below and state its DFS traversal.
Solution: We start with node 0. Exploring its branch to node 1, we move to node 2 and node
4. From node 4, we backtrack to node 3. Hence, the DFS path can be given as, 0 -> 1 -> 2 ->
4 -> 3.
[Link] Page 29
IAA MODULE-01 AZ Documents
Advantages
1. It is a memory efficient algorithm as it consumes less space.
2. The algorithm takes less time to execute.
3. It terminates in finite time.
Disadvantages
1. It is an incomplete algorithm as we may not be able to get the solution every time we do
the search (even if the solution exists, due to limit constraint).
2. If multiple solutions of a problem exist, then DLS may not be able to find the optimal
solution. In other words, the algorithm is not optimal even if l>d.
Example: Traverse the given tree to search node H using DLS with predefined limit as 2.
Solution: We start with Node A at level 0. The search process then continues to explore nodes
B, C, D, and E at level 1.
Now, we go to level 2 and explore the child nodes of node B. When H is not found there, a
backtrack is done to level 1. Child nodes of node C are searched to find node H. Finally, node
H is found at level 2 as a child node of C and the algorithm Terminates.
Example: Traverse the given tree to search node H using DLS with predefined limit as 2.
Solution: In the tree, node H is not present till level 2, so the algorithm terminates returning a
cutoff failure. The path traversed for searching is marked with a dashed line.
This image explains the DLS implementation and could be referred to for better
understanding.
[Link] Page 30
IAA MODULE-01 AZ Documents
In Fig. 3.17, BFS algorithm selects a random initial node (also known as source node or root
node) and traverses the graph layer-wise in such a way that all the nodes and their respective
children nodes are visited and explored. Here,Visiting a node means to visit or select a node.
And,Exploring a node means exploring the adjacent nodes (child nodes) of the selected node.
Advantages
1. BFS will find a solution if it exists.
2. If a given problem has multiple solutions, then BFS will give the minimal solution
requiring least number of steps.
3. The architecture of the BFS algorithm is simple and robust.
4. It constructs the shortest path of traversing through the nodes of the graph so that the graph
can be traversed in the smallest number of iterations.
5. The algorithm does not get stuck in an infinite loop.
Disadvantages
1. Since each level of node is saved for creating the next one, it consumes a lot of memory
space. Space requirement to store nodes is exponential.
[Link] Page 31
IAA MODULE-01 AZ Documents
2. It takes less time if the solution is far away from the root Node at the bottom or at the end.
3. Its complexity depends on the number of nodes.
The BFS algorithm is implemented using a FIFO queue. It is a complete algorithm, that is, it
finds a solution if it exits. The algorithm is optimal, if step cost = 1 (that is, if either there is
no cost or if all step costs are same). Moreover, it has both time and space complexity given
by, O(b ). Here, b is the branching factor and d is the depth of the tree.
Note that total number of nodes created in the worst case is b + b + b + ... + b .
While time complexity is equivalent to the number of nodes traversed in BFS space
complexity, on the other hand, it is equivalent to how large can the fringe get. Due to high
precision and robust implementation, BFS is used in multiple real-life
solutions like P2P networks, Web Crawlers and Network Broadcasting.
Solution: The BFS creates a tree and traverses it using the principle ‘shallowest node first’.
So, at note S, node D will be traversed followed by node G. Thus, Path is S -> D -> G
Example: Consider the graph. Using node A as the source node, traverse the graph and trace
the working of the algorithm using a queue.
[Link] Page 32
IAA MODULE-01 AZ Documents
Step 2: Remove node ‘a’ from the queue, print it and insert the child nodes of ‘a’ in the
queue. Thus, nodes ‘b’ and ‘c’ are inserted.
Step 3: The queue is not empty and has node ‘b’ and ‘c’. Since ‘b’ is the first node in the
queue, remove it, print it and insert the child nodes of ‘b’ into the queue. That is, insert node
‘d’ and ‘e’.
Repeat these steps until the queue gets empty. Do not insert those nodes in the queue that are
already visited.
[Link] Page 33
IAA MODULE-01 AZ Documents
According to the pseudocode, s is the root node of the graph, [Link], s is inserted in the
queue. Then, all child nodes of ‘s’ are marked. These child nodes are visited after removing
‘s’ from the queue. At each step of the algorithm, child nodes, w are inserted into the queue
to further visit its child nodes. The process is repeated under the queue is empty.
Broadcasting
In computer networks, data is broken down into small packets before transmission across the
communication media. These packets use an algorithm to compute a path to the destination.
For messages that are broadcasted across all the nodes in a network, BFS is a preferred
choice.
Peer-to-Peer Networking
BFS is used in peer-to-peer network as a traversal method to find all the neighbouring nodes.
For example, BitTorrent uses BFS for peer-to- peer communication.
[Link] Page 34
IAA MODULE-01 AZ Documents
In Fig. 3.18, if S is the start node and G is the goal state, then node A is explored as it has the
lowest cost (the other node G has a higher cost). Now, node A has two child nodes—B and C.
C having the lowest step cost is traversed and from there, node D, followed by G is reached.
Though UFS performs well for this algorithm, it may not work with all cases.
Thus, we see that uniform-cost search (UCS) expands nodes based on their path costs form
the root node. It can be used to traverse any graph/tree where the optimal cost is the traversal
criteria. The uniform-cost search algorithm is implemented by the priority queue, giving
maximum priority to the lowest cumulative cost. If you observe carefully, you will find that
UCS is equivalent to BFS algorithm if the path cost of all edges is the same.
The UCS algorithm is a complete and optimal algorithm with time and space complexity and
space complexity O(b ), where ε is the lowest cost and c is the optimal cost.
Advantages
1. It finds an optimal solution by considering the least cost at every state.
2. UCS is complete only if states are finite and if there is no loop with zero weight.
3. UCS is optimal only if there is no negative cost.
Disadvantages
1. The algorithm may get stuck in an infinite loop as it considers only cost and not the
number of steps taken to reach the goal state.
2. It explores nodes in every ‘direction’.
3. It does not have any information about the location of the goal state.
4. It requires more space for storing information about nodes.
5. The UCS must explore all paths including the long ones.
Example: Consider the tree given below and its UCS traversal to reach node G from S.
[Link] Page 35
IAA MODULE-01 AZ Documents
Example: Find the path and cost to move from node S to node G in the graph given below.
Solution: For a better clarity, we can draw an equivalent search tree for the graph. Using
UCS, the path with the least cumulative cost is chosen.
[Link] Page 36
IAA MODULE-01 AZ Documents
Advantages
1. It combines the benefits of BFS and DFS search algorithms fast search and memory
efficiency
2. The algorithm is complete is if the branching factor is finite.
3. IDDFS is an optimal algorithm if path cost is a non-decreasing function of the depth of the
node.
Disadvantages
1. It repeats all the work of the previous phase.
2. It takes more time (exponential) to reach the goal node.
3. The algorithm fails when the BFS fails.
Example: Traverse the given tree using the iterative deepening depth-first search algorithm.
Solution: In the first iteration, node A at level 0 is explored.
In the second iteration, nodes B and C are traversed at level 1.
In the third iteration, nodes D, E, F and G are traversed.
In the fourth iteration, node H is reached.
The algorithm ends when it finds a solution at depth d. The number of nodes created at depth
d is b and at depth d-1 is b Time complexity of IDDFS algorithm is O(b ) and its space
complexity is O(bd), where b is the branching factor and depth of the tree is d. In IDDFS, we
perform DFS up to a certain ‘limited depth,’ and keep increasing this ‘limited depth’ after
every iteration. Example: Consider the tree given below and demonstrate the application of
IDDFS.
[Link] Page 37
IAA MODULE-01 AZ Documents
Example: Consider the graph given below and apply bidirectional search on it to reach goal
node 14 from source node 0.
Solution: Two searches are executed simultaneously-, one from node 0 and the other from
node 14. Both these searches intersect at node 7. At this point, we have found a path from
node 0 to 7 and from node 14 to 7. The search process terminates successfully, thereby
avoiding unnecessary exploration.
Advantages
1. It is faster than other algorithms
2. It avoids unnecessary exploration of nodes
3. Time and space complexity of searching is O(b +b ), which is far less than O(b ). Here, b is
the branching factor of the tree and d is the distance of goal node from the source node.
4. The algorithm drastically reduces searching time by supporting simultaneous searches.
5. It takes less memory capacity to store all the searches. d/2 d/2
6. Bidirectional search is complete if BFS is used in both searches.
7. The algorithm is optimal if BFS is used for search and paths have uniform cost.
Disadvantages
1. The algorithm can be used only when the goal state is clearly known.
2. It is difficult to implement.
[Link] Page 38
IAA MODULE-01 AZ Documents
3. The algorithm must be robust enough to correctly deduce the intersection point where it
can terminate. Otherwise, the algorithm may get stuck in an infinite loop.
4. It is very difficult to search backwards through all states.
Next explore node 3 while doing a forward search and node 3 while doing a backward search.
Here, we find intersecting node as node 3, so the algorithm terminates and the path is- 2 -> 1
-> 3 -> 7 -> 11.
[Link] Page 39
IAA MODULE-01 AZ Documents
To solve large problems with a large number of possible states, problem-specific knowledge
needs to be added to increase the efficiency of search algorithms. In such a situation, heuristic
search algorithm performs well.
Heuristic search is the simplest form of heuristic search algorithms that expands nodes based
on their heuristic valueh(n). The algorithm maintains two lists OPEN and CLOSED. All
nodes that have already been expanded are placed in the CLOSED list, while others that have
not been expanded are in the OPEN list. On each iteration, nodes with the lowest heuristic
value are expanded. Then, the heuristic function is applied to the child nodes and they are
placed in the open list according to their heuristic value. The shorter paths are saved and the
longer ones are disposed. The process continues unit a goal state is found. In this section, we
will discuss two important informed search algorithms best first search algorithm (greedy
search) and A search algorithm.
Advantages
1. It takes advantage of both BFS and DFS algorithms.
2. Best first search algorithm is more efficient than BFS and DFS algorithms.
Disadvantages
1. In some worst-case scenarios, best first search can behave as an unguided depth-first
search.
2. Like DFS, best first search algorithm can get stuck in a loop.
3. Best first search algorithm is not an optimal algorithm.
[Link] Page 40
IAA MODULE-01 AZ Documents
Example: Consider the tree given below and traverse it using greedy best-first search
algorithm.
Solution: Expand the node S and put it in the CLOSED list. Generate its successors and place
them in the OPEN list.
Open [A, B], Closed [S]
Iteration 1: Since h(n) for node B is less than that of node A, expand B and place it in
CLOSED list. Now only node A is in the OPEN list. Open [A], Closed [S, B]
Iteration 2: Generate successors of node B and place them in the OPEN list. Open [E, F, A],
Closed [S, B]. Since node F has the lowest heuristic value among all nodes in
the OPEN list, we will expand node F. Now, Open [E, A], Closed [S, B, F]
Iteration 3: Generate successors of node F and place them in the OPEN list. So, Open [I, G,
E, A], Closed [S, B, F] Now, generate succors of node F and place them in OPEN list. Since
one of the successors of node F is the goal node, the algorithm returns success and terminates.
The path is given by the nodes present in the CLOSED list. Open [I, E, A], Closed [S, B, F,
G]
Hence, the final solution path will be: S----> B----->F----> G
The worst-case time complexity and space complexity of greedy best first search is O(b )
where, m is the maximum depth of the search space. Although the algorithm is complete, it
can, at times, behave like an incomplete algorithm even if the given state space is finite. This
makes the Greedy best first search algorithm not an optimal one.
Example: Apply greedy best first search algorithm on the graph given below to reach node I
from node S.
[Link] Page 41
IAA MODULE-01 AZ Documents
Solution: Add node S in the CLOSED list and place its successors in the OPEN list. Open [A,
B, C], Closed [S]
Remove A from the OPEN list as it has minimum h(n), place it in CLOSED list and put its
successors in the OPEN list.
Open [B, C, E, D], Closed [S, A]
Remove C from the OPEN list as it has minimum h(n), place it in CLOSED list and put its
successors in the OPEN list.
Open [B, E, D, H], Closed [S, A, C]
Remove B from the OPEN list as it has minimum h(n), place it in CLOSED list and put its
successors in the OPEN list.
Open [E, D, H, F, G], Closed [S, A, C, B]
Remove H from the OPEN list as it has minimum h(n), place it in CLOSED list and put its
successors in the OPEN list. Since I is the successor of node H, the algorithm returns success.
Open [E, D, F, G, I, J], Closed [S, A, C, B, H]
Knowledge Representation
1.13 Introduction
Artificial intelligence as technology has always fascinated human beings. Multiple
science fiction novels and movies have demonstrated the use of AI-powered systems (like
robots) that can think, act, understand complex information and make smart decisions based
on it. Although this all looks like a fantastic development, we agree that it is not easy to make
machines that behave exactly like humans. This is because humans have conscience and this
conscience develops gradually in us with our knowledge, experiences and memories. To build
AI systems that have conscience, we need to inculcate knowledge in them. This chapter is,
therefore, dedicated towards representing knowledge in machines.
[Link] Page 42
IAA MODULE-01 AZ Documents
[Link] Page 43
IAA MODULE-01 AZ Documents
3. Procedural knowledge, also known as imperative knowledge, gives information about how
to achieve or do something. This knowledge includes rules, strategies,
procedures, agendas, etc. that can be directly applied to perform any task.
4. Declarative knowledge is the information that we have about an object. This knowledge
helps us to describe a particular concept, fact, object and its attributes. Declarative knowledge
is simpler than procedural language and is also called descriptive knowledge as it is usually
represented using declarative sentences.
5. Structural knowledge is the basic knowledge to solve complex problems. It describes
relationships between various concepts or objects such as kind of, part of, and grouping of
something.
Syntax
[Link] Page 44
IAA MODULE-01 AZ Documents
Every language has its own syntax to specify the sequence of constructs that makes a
complete sentence in that language. Itis therefore not wrong to say that syntax is the
representation of a language.
Semantics
Semantics is used to check if a syntactically correct sentence is logically correct and
meaningful or not. Therefore, semantics defines the sense of the sentence which relates to the
real world. For example, consider the statement:
Ram is riding a bike.
This sentence is syntactically as well as semantically correct. However, the sentence,
Bike is riding Ram.
is syntactically correct but semantically incorrect.
Logical Inference
Inference means to deduce conclusions in the context of some fact or problem.
Correspondingly, logical inference uses inference algorithms to think all the possible reasons
that can give a proper result.
Perception
The perception component retrieves data from the environment, discovers the
source(s) of noise, checks if the AI was damaged by anything and defines response to be
given when any sense has been detected. Data from the environment is gathered using
[Link] Page 45
IAA MODULE-01 AZ Documents
different types of sensors in the form of video, audio, text, time, temperature or any other
sensor-based input.
Learning
The learning component learns from the data that is captured by the perception
component. The aim here is to develop a system that can be taught instead of being
programmed. With learning, the system focuses on self-improvement through knowledge
acquisition, inference, acquisition of heuristics, faster searches, etc.
[Link] Page 46
IAA MODULE-01 AZ Documents
In AI, the agents that mimic a human being’s knowledge are known as
knowledge-based intelligent agents. Such an agent uses its knowledge and reasoning to act
efficiently by making appropriate decisions. A knowledge-based agent, therefore, does the
following:
1. It maintains an internal state of knowledge to represent states, actions, etc.
2. It deduces reasoning with that knowledge.
3. It updates their knowledge after observations by incorporating new precepts.
4. It takes actions accordingly.
Knowledge-based agents represent knowledge that can be reasoned to act intelligently
according to the requirements. Usually, these agents store knowledge about its surroundings
in the form of sentences.
[Link] Page 47
IAA MODULE-01 AZ Documents
sentence(s) to the knowledge base. As stated earlier, a sentence is a proposition about the
world. New information is deduced from the knowledge base by
applying logical rules (either forward chaining or backward chaining).
[Link] Page 48
IAA MODULE-01 AZ Documents
Logical Level
At this level, the knowledge representation of the knowledge stored in the knowledge base is
understood. For this, sentences are encoded into different logics. Therefore,knowledge is
encoded into logical [Link] with the above example, agent deduces
(understands) logic to reach destination, that is, point B.
Implementation Level
This is the physical representation of logic and knowledge. At this level, the
agent performs actions according to the knowledge obtained from the logical and
knowledge level. For
example, the agent that wants to move from point A to B, implement the knowledge and logic
to reach the destination.
Example: In an automated air conditioner, the inbuilt knowledge stored in the system states
that ‘It would adjust its temperature according to the weather.’ Now, when to adjust and how
to adjust is [Link] actual working of adjusting the temperature is at the implementation
level of the knowledge- based agent.
Procedural Approach
[Link] Page 49
IAA MODULE-01 AZ Documents
In the procedural approach, the desired behaviour is directly encoded in the agent as a
program code. Therefore, in this approach, we are actually specifying the desired behaviour
of the system through coding in programming languages like LISP, Prolog. Practically, hybrid
approach is used that combines features of both declarative as well as procedural approaches.
In the hybrid approach, declarative knowledge is compiled into more efficient procedural
code.
Inheritable knowledge
Inheritable knowledge is one that stores data using a hierarchy of classes. We start
representing using generalized classes and move down to specialized classes in the hierarchy.
For example, consider Fig. 4.9 which shows such a relationship. Note that Zinya and Vidhi
both are instances of under-graduate and post-graduate students, respectively. Inheritable
knowledge shows the relation between instance and class, and is therefore known as instance
relation of IS-A relation. In this diagram, objects and values are represented in boxed nodes.
Inferential Knowledge
Inferential Knowledge Represents Knowledge in the Form of Formal Logic and Can
be Used to Derive More Facts Accurately.
For example,
[Link] Page 50
IAA MODULE-01 AZ Documents
[Link] Page 51
Thank You
We’re glad to be part of your engineering journey.
Keep exploring, keep innovating, and keep growing.
AZ Documents
Your Engineering Study Partner
[Link]
Uninformed search algorithms, also known as blind search algorithms, lack additional information about the goal beyond what is provided in problem definitions, and simply explore the nodes blindly until the solution is found. In contrast, informed search algorithms use heuristics to guide the search process more efficiently towards the goal . For example, uninformed algorithms like Depth First Search (DFS) and Breadth First Search (BFS) explore the nodes in a predefined manner without external guidance, whereas informed algorithms use measures like path cost and distance to optimize the search .
Depth First Search (DFS) is advantageous in terms of memory usage because it requires less memory as it backtracks once it hits the leaf nodes, and it is useful for solving problems requiring a solution to explore the depth of nodes. However, it can get stuck in infinite loops and might not find the shortest path to the goal, making it inefficient for certain problems . Breadth First Search (BFS), while optimal for finding the shortest path when step cost is uniform, can be memory-intensive as it stores all levels of nodes before proceeding further. It finds minimal solutions but requires more space and is less time-efficient when the solution is far away from the root .
Uber utilizes sophisticated machine learning algorithms to predict demand by analyzing patterns of past data, thereby optimizing resource utilization. This AI-driven approach allows Uber to anticipate ride demand and dispatch drivers efficiently before they're needed, leading to improved customer satisfaction and operational efficiency. This case exemplifies how AI can transform business operations by predicting future needs, enhancing connectivity, and enabling companies to seize new opportunities .
The current limitations of machine intelligence, such as its lack of emotional understanding and self-awareness, pose significant challenges to societal trust, especially in sensitive areas like healthcare and transportation. These sectors require not only accurate data processing but also nuanced decision-making involving ethics and empathy. The absence of these human-like skills in AI can hinder full reliance and integration into such critical sectors, as errors or misjudgments can have severe consequences. Ensuring transparency, building robustness in AI algorithms, and maintaining human oversight are essential to foster trust and mitigate the implications of these limitations .
IDDFS combines the space-efficiency of Depth First Search (DFS) with the optimal path-finding capability of Breadth First Search (BFS). It operates by performing a series of DFS operations with a gradually increasing depth limit. While maintaining the low memory requirements of DFS, it ensures path optimality similar to BFS by incrementally exploring deeper nodes until the goal is reached, allowing IDDFS to effectively operate in large search spaces where the depth is unknown .
Self-correction is a critical component in AI algorithms, allowing them to refine their decision-making processes over time. By continuously updating their algorithms based on new data and outcomes, AI systems can improve their predictions and problem-solving capabilities, ensuring more accurate results. This process involves re-evaluating patterns, correlations, and learning processes to eliminate errors and make informed adjustments to the algorithms, thereby enhancing performance and reliability in AI systems .
Augmented intelligence diverges from traditional AI by focusing on enhancing human decision-making rather than replacing it. It's more supportive and collaborates with humans, using cognitive computing to process natural language, understand context, and assist in complex tasks. Unlike traditional AI, which aims for autonomy, augmented intelligence seeks a partnership between humans and machines, leveraging AI's computational power to empower human capabilities rather than supplant them .
Knowledge representation is crucial for AI systems to replicate human decision-making as it involves structuring real-world information in a machine-readable and actionable format. It enables AI to reason with concepts like beliefs, intentions, and judgments, which are essential for intelligent behavior. This allows AI to simulate human cognitive processes in applications such as natural language processing and automated reasoning, aiding in solving complex tasks like diagnosing medical conditions or interacting in human-like ways .
Implementing theoretical AI models in practical applications is challenging primarily because current AI lacks self-awareness, a critical component of human intelligence. This limitation stems from the difficulties in endowing machines with conscience, emotions, and subjective experiences necessary for truly human-like interactions. Additionally, while AI excels in data processing and pattern recognition, it is limited by its inability to understand intricate human contexts fully. These limitations make it difficult for machines to behave exactly like humans in situational tasks requiring subjective judgment and emotional intelligence .
Human intelligence encompasses cognitive functions such as emotion recognition, communication, and decision-making based on conscience, which machines lack due to their lack of awareness and emotional contexts. Machine intelligence, on the other hand, excels in processing large datasets, detecting patterns, and performing specific tasks like computing and memorizing more efficiently than humans .