You are on page 1of 21

Unit 1

Artificial Intelligence Allows Machines to Work Efficiently and Solve Problems. See How
AI Can Learn and Analyse Vast Amounts of Data in the Blink of an Eye. As-a-service.
Edge to Core. Enterprise AI.

Artificial Intelligence (AI) is the advanced field of computer science dedicated


to automating behaviour commonly associated with human intelligence. Like
happens with any complex science, many concepts are broken down from it.

A. History of Artificial Intelligence


Artificial Intelligence is not a new word and not a new technology for researchers. This
technology is much older than you would imagine. Even there are the myths of Mechanical
men in Ancient Greek and Egyptian Myths. Following are some milestones in the history of
AI which defines the journey from the AI generation to till date development.
Maturation of Artificial Intelligence (1943-1952)
1. Year 1943: The first work which is now recognized as AI was done by Warren
McCulloch and Walter pits in 1943. They proposed a model of artificial neurons.
2. Year 1949: Donald Hebb demonstrated an updating rule for modifying the connection
strength between neurons. His rule is now called Hebbian learning.
3. Year 1950: The Alan Turing who was an English mathematician and pioneered
Machine learning in 1950. Alan Turing publishes "Computing Machinery and
Intelligence" in which he proposed a test. The test can check the machine's ability to
exhibit intelligent behavior equivalent to human intelligence, called a Turing test.

The birth of Artificial Intelligence (1952-1956)


1. Year 1955: An Allen Newell and Herbert A. Simon created the "first artificial intelligence
program"Which was named as "Logic Theorist". This program had proved 38 of 52
Mathematics theorems and find new and more elegant proofs for some theorems.
2. Year 1956: The word "Artificial Intelligence" first adopted by American Computer scientist
John McCarthy at the Dartmouth Conference. For the first time, AI coined as an academic
field.
3. At that time high-level computer languages such as FORTRAN, LISP, or COBOL were
invented. And the enthusiasm for AI was very high at that time.
The golden years-Early enthusiasm (1956-1974)
1. Year 1966: The researchers emphasized developing algorithms which can solve
mathematical problems. Joseph Weizenbaum created the first chatbot in 1966, which
was named as ELIZA.
2. Year 1972: The first intelligent humanoid robot was built in Japan which was named
as WABOT-1.

The first AI winter (1974-1980)


1. The duration between years 1974 to 1980 was the first AI winter duration. AI winter
refers to the time period where computer scientist dealt with a severe shortage of
funding from government for AI research.
2. During AI winters, an interest of publicity on artificial intelligence was decreased.

A boom of AI (1980-1987)
1. Year 1980: After AI winter duration, AI came back with "Expert System". Expert
systems were programmed that emulate the decision-making ability of a human
expert.
2. In the Year 1980, the first national conference of the American Association of
Artificial Intelligence was held at Stanford University.

The second AI winter (1987-1993)


1. The duration between the years 1987 to 1993 was the second AI Winter duration.
2. Again Investors and government stopped in funding for AI research as due to high
cost but not efficient result. The expert system such as XCON was very cost effective.

The emergence of intelligent agents (1993-2011)


1. Year 1997: In the year 1997, IBM Deep Blue beats world chess champion, Gary
Kasparov, and became the first computer to beat a world chess champion.
2. Year 2002: for the first time, AI entered the home in the form of Roomba, a vacuum
cleaner.
3. Year 2006: AI came in the Business world till the year 2006. Companies like
Facebook, Twitter, and Netflix also started using AI.

Deep learning, big data and artificial general intelligence (2011-


present)
1. Year 2011: In the year 2011, IBM's Watson won jeopardy, a quiz show, where it had
to solve the complex questions as well as riddles. Watson had proved that it could
understand natural language and can solve tricky questions quickly.
2. Year 2012: Google has launched an Android app feature "Google now", which was
able to provide information to the user as a prediction.
3. Year 2014: In the year 2014, Chatbot "Eugene Goostman" won a competition in the
infamous "Turing test."
4. Year 2018: The "Project Debater" from IBM debated on complex topics with two
master debaters and performed extremely well.
5. Google has demonstrated an AI program "Duplex" which was a virtual assistant, and
which had taken hairdresser appointment on call, and lady on other side didn't notice
that she was talking with the machine.

B. Scope of AI (AI Careers)


Fresher's should analyze their competencies and skills and choose a better AI role with the
potential for upward mobility. The future scope of Artificial Intelligence continues to grow
due to new job roles and advancements in the AI field. The various roles in an AI career are
as follows:

Artificial intelligence is defined as the study of rational agents. A rational agent could be
anything that makes decisions, as a person, firm, machine, or software.
Examples of Agent:
1. A software agent has Keystrokes, file contents, received network packages which
act as sensors and displays on the screen, files, sent network packets acting as
actuators.
2. A Human-agent has eyes, ears, and other organs which act as sensors, and hands,
legs, mouth, and other body parts acting as actuators.
3. A Robotic agent has Cameras and infrared range finders which act as sensors and
various motors acting as actuators.

C. Types of Agents
Agents can be grouped into five classes based on their degree of perceived intelligence and
capability :
• Simple Reflex Agents
• Model-Based Reflex Agents
• Goal-Based Agents
• Utility-Based Agents
• Learning Agent

Simple reflex agents


Simple reflex agents ignore the rest of the percept history and act only on the basis of
the current percept. Percept history is the history of all that an agent has perceived to date.
The agent function is based on the condition-action rule.
A model-based agent can handle partially observable environments using a model about
the world. The agent must keep track of the internal state which is adjusted by each percept
and that depends on the percept history.

Goal-based agents
These kinds of agents take decisions based on how far they are currently from
their goal (description of desirable situations).

Utility-based agents
The agents which are developed having their end uses as building blocks are called
utility-based agents

Learning Agent:
A learning agent in AI is the type of agent that can learn from its past experiences, or it has
learning capabilities. It starts to act with basic knowledge and then can act and adapt
automatically through learning.
Following are the main four rules for an AI agent:
1. Rule 1: An AI agent must have the ability to perceive the environment.
2. Rule 2: The observation must be used to make decisions.
3. Rule 3: Decision should result in an action.
4. Rule 4: The action taken by an AI agent must be a rational action.

D. Structure of an AI Agent
1. Agent = Architecture + Agent program

Architecture: Architecture is machinery that an AI agent executes on.

Agent Function: Agent function is used to map a percept to an action.

PEAS Representation
PEAS is a type of model on which an AI agent works upon.
o P: Performance measure
o E: Environment
o A: Actuators
o S: Sensors

E. Agent Environment in AI
An environment is everything in the world which surrounds the agent, but it is not a part of
an agent itself. An environment can be described as a situation in which an agent is present.

Features of Environment
As per Russell and Norvig, an environment can have various features from the point of view
of an agent:
1. Fully observable vs Partially Observable
2. Static vs Dynamic
3. Discrete vs Continuous
4. Deterministic vs Stochastic
5. Single-agent vs multi-agent
6. Episodic vs sequential
7. Known vs Unknown
8. Accessible vs Inaccessible
Fully observable vs Partially Observable:
1. If an agent sensor can sense or access the complete state of an environment at each
point of time then it is a fully observable environment, else it is partially observable.
2. An agent with no sensors in all environments then such an environment is called
as unobservable.

Deterministic vs Stochastic:
1. If an agent's current state and selected action can completely determine the next state
of the environment, then such environment is called a deterministic environment.
2. A stochastic environment is random in nature and cannot be determined completely
by an agent.

Episodic vs Sequential:
1. In an episodic environment, there is a series of one-shot actions, and only the current
percept is required for the action.
2. However, in Sequential environment, an agent requires memory of past actions to
determine the next best actions.

Single-agent vs Multi-agent
1. If only one agent is involved in an environment and operating by itself then such
an environment is called single agent environment.
2. However, if multiple agents are operating in an environment, then such an
environment is called a multi-agent environment.

Static vs Dynamic:
1. If the environment can change itself while an agent is deliberating then such
environment is called a dynamic environment else it is called a static environment.

Discrete vs Continuous:
1. If in an environment there are a finite number of percepts and actions that can be
performed within it, then such an environment is called a discrete environment else it
is called continuous environment.

Known vs Unknown
1. Known and unknown are not actually a feature of an environment, but it is an agent's
state of knowledge to perform an action.

Accessible vs Inaccessible
1. If an agent can obtain complete and accurate information about the state's
environment, then such an environment is called an Accessible environment else it is
called inaccessible.

F. Problem formulation
It is one of the core steps of problem-solving which decides what action should be taken
to achieve the formulated goal. In AI this core part is dependent upon software agent which
consisted of the following components to formulate the associated problem.
Components to formulate the associated problem:
1. Initial State: This state requires an initial state for the problem which starts the AI
agent towards a specified goal. In this state new methods also initialize problem
domain solving by a specific class.
2. Action: This stage of problem formulation works with function with a specific
class taken from the initial state and all possible actions done in this stage.
3. Transition: This stage of problem formulation integrates the actual action done by
the previous action stage and collects the final stage to forward it to their next
stage.
4. Goal test: This stage determines that the specified goal achieved by the integrated
transition model or not, whenever the goal achieves stop the action and forward
into the next stage to determines the cost to achieve the goal.
5. Path costing: This component of problem-solving numerical assigned what will be
the cost to achieve the goal. It requires all hardware software and human working
cost.

Examples of Problem Formulation

Water Jug Problem


1. Problem Statement
a. Problem Definition: You have to measure 4 liter (L) water by using three buckets 8L,
5L and 3L.
b. Problem Limitation: You can only use these (8L, 5L and 3L) buckets
2. Problem Solution: Measure exactly 4L water
3. Solution Space: There are multiple ways doing this.
4. Operators: Possible actions are fill water in any bucket and remove water from any bucket.
G. Tree vs Graph data structure
Before knowing about the tree and graph data structure, we should know the linear and non-
linear data structures. Linear data structure is a structure in which all the elements are stored
sequentially and have only single level. In contrast, a non-linear data structure is a structure
that follows a hierarchy, i.e., elements are arranged in multiple levels.

Let's understand the structure that forms the hierarchy.

I. Tree
A tree is a non-linear data structure that represents the hierarchy. A tree is a collection of
nodes that are linked together to form a hierarchy.

Let's look at some terminologies used in a tree data structure.


o Root node: The topmost node in a tree data structure is known as a root node. A root node is
a node that does not have any parent.
o Parent of a node: The immediate predecessor of a node is known as a parent of a node. Here
predecessor means the previous node of that particular node.
o Child of a node: The immediate successor of a node is known as a child of a node.
o Leaf node: The leaf node is a node that does not have any child node. It is also known as an
external node.
o Non-leaf node: The non-leaf node is a node that has atleast one child node. It is also known
as an internal node.
o Path: It is a sequence of the consecutive edges from a source node to the destination node.
Here edge is a link between two nodes.
o Ancestor: The predecessor nodes that occur in the path from the root to that node is known
as an ancestor.
o Descendant: The successor nodes that exist in the path from that node to the leaf node.
o Sibling: All the children that have the same parent node are known as siblings.
o Degree: The number of children of a particular node is known as a degree.
o Depth of node: The length of the path from the root to that node is known as a depth of a
node.
o Height of a node: The number of edges that occur in the longest path from that node to the
leaf node is known as the height of a node.
o Level of node: The number of edges that exist from the root node to the given node is known
as a level of a node.

II. Tree representation in the memory


Each node will contain three parts, data part, address of the left subtree, and address of the
right subtree. If any node does not have the child, then both link parts will have NULL values.

III. Graph
A graph is like a tree data structure is a collection of objects or entities known as nodes that
are connected to each other through a set of edges. A tree follows some rule that determines
the relationship between the nodes, whereas graph does not follow any rule that defines the
relationship among the nodes. A graph contains a set of edges and nodes, and edges can
connect the nodes in any possible way.
Mathematically, it can be defined as an ordered pair of a set of vertices, and a set of nodes
where vertices are represented by 'V' and edges are represented by 'E'.

G= (V , E)

Basis for comparison Tree Graph


Definition Tree is a non-linear data A Graph is also a non-linear
structure in which elements data structure.
are arranged in multiple
levels.
Structure It is a collection of edges and It is a collection of vertices
nodes. For example, node is and edges. For example,
represented by N and edge is vertices are represented by
represented as E, so it can be V, and edge is represented as
written as: 'E', so it can be written as:
T = {N,E} T = {V, E}
Root node In tree data structure, there is In graph data structure, there
a unique node known as a is no unique node.
parent node. It represents the
topmost node in the tree data
structure.
Loop formation It does not create any loop or In graph, loop or cycle can
cycle. be formed.
Model type It is a hierarchical model It is a network model. For
because nodes are arranged example, facebook is a
in multiple level, and that social network that uses the
creates a hierarchy. For graph data structure.
example, any organization
will have a hierarchical
model.
Edges If there are n nodes then The number of edges
there would be n-1 number depends on the graph.
of edges.
Type of edge Tree data structure will In graph data structure, all
always have directed edges.
the edges can either be
directed edges, undirected
edges, or both.
Applications It is used for inserting, It is mainly used for finding
deleting or searching any the shortest path in the
element in tree. network.
Types of graphs:
Directed graph: The graph with the directed edges known as a directed graph.

1. A directed graph is a finite set of vertices together with a finite set of edges. Both sets
might be empty, which is called the empty graph.
2. Each edge is associated with two vertices, called its source and target vertices.
3. We say that the edge connects its source to its target.
4. The order of the two connected vertices is important.

Undirected graph: The graph with the undirected edges known as a undirected graph.

1. An undirected graph is a set of nodes and a set of links between the nodes.
2. Each node is called a vertex, each link is called an edge, and each edge connects two
vertices.
3. The order of the two connected vertices is unimportant.
4. An undirected graph is a finite set of vertices together with a finite set of edges. Both
sets might be empty, which is called the empty graph.
Artificial Intelligence
dictionary.com definition says capacity for Learning, reasoning, understanding and similar
forms of mental activity.

We can say that in these four definitions one dimension is human life versus rational. So
first column is the human-like box, and other is the rational column.

It is the study of building agents that act rationally. Most of the time, these agents perform
some kind of search algorithm in the background in order to achieve their tasks.
State space representation
Its structure corresponds to the structure of problem solving in two important ways:
1. It allows for a formal definition of a problem as per the need to convert some given
situation into some desired situation using a set of permissible operations.
2. It permits the problem to be solved with the help of known techniques and control
strategies to move through the problem space until goal state is found.

S={S, A, Action(S), Result(S,A), Cost(S,A)}

S= Total states( Start, intermediate, Goal)


A= Set of all Possible action.

A search problem consists of:


a. A State Space. Set of all possible states where you can be.
b. A Start State. The state from where the search begins.
c. A Goal Test. A function that looks at the current state returns whether or not
it is the goal state.
2. The Solution to a search problem is a sequence of actions, called the plan that
transforms the start state to the goal state.
3. This plan is achieved through search algorithms.

The following uninformed search algorithms are discussed in this section.


1. Depth First Search
2. Breadth First Search
3. Uniform Cost Search

Depth First Search


Depth-first search (DFS) is an algorithm for traversing or searching tree or graph data
structures. The algorithm starts at the root node (selecting some arbitrary node as the root
node in the case of a graph) and explores as far as possible along each branch before
backtracking. It uses last in- first-out strategy and hence it is implemented using a stack.

Path: S -> A -> B -> C -> G

Breadth First Search


Breadth-first search (BFS) is an algorithm for traversing or searching tree or graph data
structures. It starts at the tree root (or some arbitrary node of a graph, sometimes referred to
as a ‘search key’), and explores all of the neighbor nodes at the present depth prior to moving
on to the nodes at the next depth level. It is implemented using a queue.
Example:
Question. Which solution would BFS find to move from node S to node G if run on the
graph below?
Path: S -> D -> G

Uniform Cost Search


UCS is different from BFS and DFS because here the costs come into play. In other words,
traversing via different edges might not have the same cost. The goal is to find a path where
the cumulative sum of costs is the least.
Cost of a node is defined as:
cost(node) = cumulative cost of all nodes from root
cost(root) = 0
Example:
Question. Which solution would UCS find to move from node S to node G if run on the
graph below?
Best first search algorithm
o Step 1: Place the starting node into the OPEN list.
o Step 2: If the OPEN list is empty, Stop and return failure.
o Step 3: Remove the node n, from the OPEN list which has the lowest value of h(n), and places
it in the CLOSED list.
o Step 4: Expand the node n, and generate the successors of node n.
o Step 5: Check each successor of node n and find whether any node is a goal node or not. If
any successor node is goal node, then return success and terminate the search, else proceed to
Step 6.
o Step 6: For each successor node, algorithm checks for evaluation function f(n), and then check
if the node has been in either OPEN or CLOSED list. If the node has not been in both list,
then add it to the OPEN list.
o Step 7: Return to Step 2.
Informed Search Algorithms:
Here, the algorithms have information on the goal state, which helps in more efficient
searching. This information is obtained by something called a heuristic.
In this section, we will discuss the following search algorithms.
1. Greedy Search
2. A* Tree Search
3. A* Graph Search
Search Heuristics: In an informed search, a heuristic is a function that estimates how close
a state is to the goal state. For example – Manhattan distance, Euclidean distance, etc.
(Lesser the distance, closer the goal.

Greedy Search:
In greedy search, we expand the node closest to the goal node. The “closeness” is estimated
by a heuristic h(x).
Question. Find the path from S to G using greedy search. The heuristic values h of each
node below the name of the node.

Solution. Starting from S, we can traverse to A(h=9) or D(h=5). We choose D, as it has the
lower heuristic cost. Now from D, we can move to B(h=4) or E(h=3). We choose E with a
lower heuristic cost. Finally, from E, we go to G(h=0). This entire traversal is shown in the
search tree below, in blue.

Path: S -> D -> E -> G


A* Tree Search:
A* Tree Search, or simply known as A* Search, combines the strengths of uniform-cost
search and greedy search. In this search, the heuristic is the summation of the cost in UCS,
denoted by g(x), and the cost in the greedy search, denoted by h(x). The summed cost is
denoted by f(x).
Heuristic: The following points should be noted wrt heuristics in A*
search.
• Here, h(x) is called the forward cost and is an estimate of the distance of the
current node from the goal node.
• And g(x) is called the backward cost and is the cumulative cost of a node from
the root node.
• Example:
• Question. Find the path to reach from S to G using A* search.

Path: S -> D -> B -> E -> G


Cost: 7

You might also like