AI & ML - Module-1
AI & ML - Module-1
Unit-1
Introduction to Artificial Intelligence: What is AI, Foundations of AI, History of AI.
AI & Organization of AI
According to John McCarthy- A I - The science and engineering of making intelligent machines or
intelligent Computer Programs.
AI is about teaching the machines to learn, to act, and think as humans would do.
“[The automation of] activities that we “The study of the computations that make it
associate with human thinking, activities such possible to perceive, reason, and act.”(Winston,
as decision-making, problem solving, 1992)
learning.”(Bellman,1978)
Acting Humanly Acting Rationally
“The art of creating machines that perform “Computational Intelligence is the study of the
functions that require intelligence when design of intelligent agents.”(Pooleet al., 1998)
performed by people.” (Kurzweil,1990)
“AI is concerned with intelligent behavior in
“The study of how to make computers do artifacts.”(Nilsson, 1998)
things at which, at the moment, people are
better.”(Rich and Knight, 1991)
If we are going to say that a given program thinks like a human, we must have some way of
determining how humans think. We need to get inside the actual workings of human minds.
The Turing Test, proposed by Alan Turing (1950), was designed to provide a satisfactory operational
definition of intelligence.
(A computer passes the test if a human interrogator, after posing some questions, cannot tell
whether the responses come from a person or from a computer.
This test is used to evaluate a computer acting like humanly)
Fig.Illustrating Turing test.
For current scenarios the computer would need to possess the following capabilities:
Note--Total Turing Test includes a video signal so that the interrogator can test the subject’s
perceptual abilities, as well as the opportunity for the interrogator to pass physical objects
―through the hatch.
Aristotle was one of the first to attempt to codify “right thinking” that is, irrefutable reasoning
processes.
His syllogisms provided patterns for argument structures that always yielded correct conclusions
when given correct premises.
Eg.
Socratesis a man
all men are mortal;
therefore, Socrates is mortal. – logic
In the “laws of thought approach” to AI, the emphasis was on correct inferences.
On the other hand, correct inference is not all of rationality; in some situations, there is no
provably correct thing to do, but something must still be done.
For example, recoiling from a hot stove is a reflex action that is usually more successful than a
slower action taken after careful deliberation.
Types of AI
Weak AI: Weak AI is also known as narrow AI. It is an AI system that is designed and trained for a
specific type of task.
Eg. IBM’s Watson, Siri and Alexa are weak AI. This categorization happens with the help of
unsupervised programming.
Strong AI: Strong AI is more like the human brain and is also known as artificial general
intelligence. It has cognitive abilities that help to perform unfamiliar tasks and commands. It can find
the solution to a problem and works beyond a preprogrammed algorithm.
Eg. Visual perception, speech recognition, decision making, and translations between
languages.
Super AI: Super AI is AI that to go beyond in excellence than human intelligence and ability. It’s
also known as artificial super intelligence (ASI) or super intelligence.
Eg. Advanced Robots
Foundation of AI
Aristotle (384–322 B.C.), was the first to formulate a precise set of laws governing the
rational part of the mind. He developed an informal system of syllogisms for proper
reasoning, which in principle allowed one to generate conclusions mechanically, given
initial premises.
Eg.
all dogs are animals
all animals have four legs
therefore all dogs have four legs
Rene Descartes (1596–1650) gave the first clear discussion of the distinction between mind
and matter and of the problems that arise.
The confirmation theory of Carnap and Carl Hempel (1905-1997) attempted to analyze the
acquisition of knowledge from experience.
Carnap's book The Logical Structure of the World (1928) defined an explicit computational
procedure for extracting knowledge from elementary experiences. It was probably the
first theory of mind as a computational process.
The final element in the philosophical picture of the mind is the connection between
knowledge and action. This question is vital to Al because intelligence requires action
as well as reasoning.
2. Mathematics
Formal science required a level of mathematical formalization in three fundamental areas: logic,
computation, and probability.
Logic:
George Boole (1815–1864), who worked out the details of propositional, or Boolean,logic.
Gottlob Frege (1848–1925) extended Boole’s logic to include objects and relations,
creating the first order logic that is used today.
First order logic – Contains predicates, quantifiers and variables
E.g. People only try to assassinate rulers they are not loyal to.
∀x: ∀y: person(x) ∧ ruler(y) ∧ tryassassinate(x, y)→¬loyalto(x, y)
Alfred Tarski (1902–1983) introduced a theory of reference that shows how to relate the
objects in a logic to objects in the real world.
Beside logic and computation, the third great contribution of mathematics to AI is the
Probability:
The Italian Gerolamo Cardanao (1501-1576) first framed the idea of probability, describing
it in terms of the possible outcomes of gambling events.
Thomas Bayes (1702-1761) proposed a rule for updating probabilities in the light of new
evidence. Baye’s rule underlies most modern approaches to uncertain reasoning in AI systems.
3. Economics
The science of economics got its start in 1776, when Scottish philosopher Adam Smith treat
it as a science, using the idea that economies can be thought of as consisting of individual
agents maximizing their own economic well being.
Decision theory, which combines probability theory with utility theory, provides a formal
and complete framework for decisions (economic or otherwise) made under uncertainty
that is, in cases where probabilistic descriptions appropriately capture the decision maker’s
environment.
Von Neumann and Morgenstern’s development of game theory included the surprising result
that, for some games, a rational agent should adopt policies that are randomized. Unlike
decision theory, game theory does not offer an unambiguous prescription for selecting
actions.
4. Neuroscience( Neuroscience is the study of the nervous system, particularly the brain)
Nicolas Rashevsky (1936, 1938) was the first to apply mathematical models to the study
of the nervous system.
The measurement of intact brain activity began in 1929 with the invention by Hans Berger
of the electroencephalograph (EEG).
The recent development of functional magnetic resonance imaging (fMRI) (Ogawa et al., 1990;
Cabeza and Nyberg, 2001) is giving neuroscientists unprecedentedly detailed images of brain
activity, enabling measurements that correspond in interesting ways to ongoing cognitive
processes.
5. Psychology:
- How do humans and animals think and act?
6. Computer engineering:
- How can we build an efficient computer?
Ktesibios of Alexandria (c. 250 B.C.) built the first self-controlling machine: a water clock
with a regulator that maintained a constant flow rate. This invention changed the definition
of what an artifact could do.
Modern control theory, especially the branch known as stochastic optimal control, has as
its goal the design of systems that maximize an objective function over time. This roughly
OBJECTIVE FUNCTION matches our view of Al: designing systems that behave
optimally.
Calculus and matrix algebra- the tools of control theory
The tools of logical inference and computation allowed AI researchers to consider
problems such as language, vision, and planning that fell completely outside the control
theorist’s purview.
8. Linguistics:
- How does language relate to thought?
History of AI
A boom of AI (1980-1987)
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.
In the Year 1980, the first national conference of the American Association of Artificial Intelligence was
held at Stanford University.
Problem Solving Agent-Refers to the intelligent agent that is designed to address and solve complex problems
or tasks in its environment
1. Goal Formulation
Goal formulation, based on the current situation and the agent’s performance measure, is the first step in
problem solving.
► A goal is a set of world states—exactly those states in whichthe goal is satisfied.
► The agent’s task is to find out how to act, now and in thefuture, so that it reaches a goal state.
2. Problem Formulation
Problem formulation is the process of deciding what actions should be taken to achieve the goal.
A problem can be defined formally by five components:
1. Initial state- that the agent starts in
2. Actions- a description of the possible actions available to the agent
3. Transition Models- a description of what each action does
4. The goal test, which determines whether a given state is a goal state.
5. A path cost function that assigns a numeric cost to each path.
Note
► The process of looking for a sequence of actions that reachesthe goal is called search.
► A search algorithm takes a problem as input and returns a
solution in the form of an action sequence.
► Once a solution is found, the actions it recommends can be carried out. This is called the execution
phase.
Travelling in Romania
Initial state: The initial state of agent in Romania might be described as in(Arad)
Actions: Given a particular state s, Actions(s) returns the set of actions that can be executed in s,
we say that each of these actions is applicable in s
e.g., from the state in(Arad), the applicable actions are go(Sibiu), go(Timisoara), go(Zerind)
Transition Model: Result(in(Arad), go(zerind))=in(zerind)
Goal test: {in(Bucharest)}
Path Cost: Finding distance in miles for all the paths between Arad to Bucharest
Toy problems
Vacuum world:
This can be formulated as a problem as follows:
• States: The state is determined by both the agent location and the dirt locations. The agent is
in one of two locations, each of which might or might not contain dirt. Thus, there are 2 × 22
= 8 possible world states. A larger environment with n locations has n ×2n states.
• Initial state: Any state can be designated as the initial state.
• Actions: In this simple environment, each state has just three actions: Left, Right, and
Suck. Larger environments might also include Up and Down.
• Transition model: The actions have their expected effects, except that moving Left in the
leftmost square, moving Right in the rightmost square, and Sucking in a clean square have no
effect. The complete state space is shown in Figure 3.3.
• Goal test: This checks whether all the squares are clean.
• Path cost: Each step costs 1, so the path cost is the number of steps in the path.
Compared with the real world, this toy problem has discrete locations, discrete dirt, reliable
cleaning, and it never gets any dirtier.
8-Puzzle Problem:
The 8-puzzle, an instance of which is shown in Figure 3.4, consists of a 3×3 board with eight
numbered tiles and a blank space. A tile adjacent to the blank space can slide into the space. The
object is to reach a specified goal state, such as the one shown on the right of the figure. The standard
formulation is as follows:
• States: A state description specifies the location of each of the eight tiles and the blank
in one of the nine squares.
• Initial state: Any state can be designated as the initial state. Note that any given goal can be
reached from exactly half of the possible initial states
• Actions: The simplest formulation defines the actions as movements of the blank space Left,
Right, Up, or Down. Different subsets of these are possible depending on where the blank is.
• Transition model: Given a state and action, this returns the resulting state; for example, if we
apply Left to the start state in Figure 3.4, the resulting state has the 5 and the blank switched.
• Goal test: This checks whether the state matches the goal configuration shown in Figure 3.4.
(Other goal configurations are possible.)
• Path cost: Each step costs 1, so the path cost is the number of steps in the path.
The 8-puzzle belongs to the family SLIDING-BLOCK of sliding-block puzzles, which are often
used as test problems for new search algorithms in AI. This family is known to be NP-complete, so
one does not expect to find methods significantly better in the worst case than the search algorithms
described in this chapter and the next.
8-Queens Problem:
The goal of the 8-queens problem is to place eight queens on a chessboard such that no queen
attacks any other. (A queen attacks any piece in the same row, column or diagonal.) Figure 3.5 shows
an attempted solution that fails: the queen in the rightmost column is attacked by the queen at the top
left.
Although efficient special-purpose algorithms exist for this problem and for the whole n-queens
family, it remains a useful test problem for search algorithms. There are two main kinds of
formulation. An incremental formulation involves operators that augment the state description,
starting with an empty state; for the 8-queens problem, this means that each action adds a queen to
the state. A complete-state formulation starts with all 8 queens on the board and moves them
around. In either case, the path cost is of no interest because only the final state counts. The first
incremental formulation one might try is the following:
• States: Any arrangement of 0 to 8 queens on the board is a state.
• Initial state: No queens on the board.
• Actions: Add a queen to any empty square.
• Transition model: Returns the board with a queen added to the specified square.
• Goal test: 8 queens are on the board, none attacked.
In this formulation, we have 64×63×… ×57 ≈ 1.8×1014 possible sequences to investigate.
A better formulation would prohibit placing a queen in any square that is already attacked:
States: All possible arrangements of n queens (0 ≤ n ≤ 8), one per column in the leftmost n
columns, with no queen attacking another.
Actions: Add a queen to any square in the leftmost empty column such that it is not attacked
by any other queen.
Real-world problems
Airline travel problems
o States: Each state obviously includes a location (e.g., an airport) and the current time.
Furthermore, because the cost of an action (a flight segment) may depend on previous
segments, their fare bases, and their status as domestic or international, the state must
record extra information about these ―historical‖ aspects.
o Initial state: This is specified by the user’s query.
o Actions: Take any flight from the current location, in any seat class, leaving after the
current time, leaving enough time for within-airport transfer if needed.
o Transition model: The state resulting from taking a flight will have the flight’s
o destination as the current location and the flight’s arrival time as the current time.
o Goal test: Are we at the final destination specified by the user?
o Path cost: This depends on monetary cost, waiting time, flight time, customs and
immigration procedures, seat quality, time of day, type of airplane, frequent-flyer mileage
awards, and so on.
Commercial travel advice systems use a problem formulation of this kind, with many additional
complications to handle the byzantine fare structures that airlines impose. Any seasoned traveler
knows, however, that not all air travel goes according to plan. A really good system should include
contingency plans—such as backup reservations on alternate flights— to the extent that these are
justified by the cost and likelihood of failure of the original plan.
VLSI layout
A VLSI layout problem requires positioning millions of components and connections on a
chip to minimize area, minimize circuit delays, minimize stray capacitances, and maximize
manufacturing yield. The layout problem comes after the logical design phase and is usually split into
two parts: cell layout and channel routing. In cell layout, the primitive components of the circuit are
grouped into cells, each of which performs some recognized function. Each cell has a fixed footprint
(size and shape) and requires a certain number of connections to each of the other cells. The aim is to
place the cells on the chip so that they do not overlap and so that there is room for the connecting
wires to be placed between the cells. Channel routing finds a specific route for each wire through the
gaps between the cells. These search problems are extremely complex, but definitely worth solving.
Robot Navigation
Robot navigation is a generalization of the route-finding problem described earlier. Rather
than following a discrete set of routes, a robot can move in a continuous space with (in principle) an
infinite set of possible actions and states. For a circular robot moving on a flat surface, the space is
essentially two-dimensional. When the robot has arms and legs or wheels that must also be controlled,
the search space becomes many-dimensional. Advanced techniques are required just to make the
search space finite. In addition to the complexity of the problem, real robots must also deal with errors
in their sensor readings and motor controls.
Automatic Assembly Sequencing
Automatic assembly sequencing of complex objects by a robot was first demonstrated
AUTOMATIC by FREDDY (Michie, 1972). Progress since then has been slow but sure, to the point
where the assembly of intricate objects such as electric motors is economically feasible. In assembly
problems, the aim is to find an order in which to assemble the parts of some object. If the wrong order
is chosen, there will be no way to add some part later in the sequence without undoing some of the
work already done. Checking a step in the sequence for feasibility is a difficult geometrical search
problem closely related to robot navigation. Thus, the generation of legal actions is the expensive part
of assembly sequencing. Any practical algorithm must avoid exploring all but a tiny fraction of the
state space. Another important assembly problem is protein design, in which the goal is to find a
sequence of amino acids that will fold into a three-dimensional protein with the right properties to
cure some disease.
• A solution is an action sequence and search algorithms considers various possible action sequences.
• The possible action sequences starting at the initial state form a search tree with the
initial state atthe root;
• The branches are actions and the nodes correspond to states in the state space of the problem.
• Expanding the current state is application of each legal action to the current state and
generation of anew set of states.
• The current state is the parent node, newly generated states are child nodes
• Leaf node is a node with no children in the tree.
• The set of all leaf nodes available for expansion at any given point is called the frontier.
• Search algorithms all share this basic structure; they vary primarily according to how
they choosewhich state to expand next: search strategy.
The process of expanding nodes on the frontier continues until either a solution is found or there are no
more states to expand. The general TREE-SEARCH algorithm is shown informally in Figure 3.7. Search
algorithms all share this basic structure; they vary primarily according to how they choose which state to
expand next—the so-called search strategy.
The eagle-eyed reader will notice one peculiar thing about the search tree shown in Figure
3.6: it includes the path from Arad to Sibiu and back to Arad again! We say that In(Arad) is a repeated
state in the search tree, generated in this case by a loopy path. Loopy paths are a special case of the
more general concept of redundant paths, which exist whenever there is more than one way to get
from one state to another.
Search algorithms require a data structure to keep track of the search tree that is being constructed.
Each node n of the tree contains four components:
n.STATE: the state in the state space to which the node corresponds
n.PARENT: the node in the search tree that generated this node
n.ACTION: the action that was applied to the parent to generate the node
n.PATH-COST: the cost of the path from the initial state to the node
Note:
• Explored set (also known as closed list) remembers every expanded node.
• The frontier needs to be stored in such a way that search algorithm can easily choose next
node toexpand according to its preferred strategy.
• The appropriate data structure for this is a queue.
• Queues are characterized by the order in which they store the inserted nodes.
• First-in, first-out or FIFO queue, which pops the oldest element of the queue; (QUEUE)
• Last-in, first-out or LIFO queue (also known as STACK), which pops the newest element
• PRIORITY QUEUE, which pops the element of the queue with the highest priority
according to some
ordering function.
• The explored set can be implemented with a hash table to allow efficient checking for repeated states.
• The typical measure for time and space complexity is the size of the state space graph, |V | + |E|,
where V is the set of vertices (nodes) of the graph and E is the set of edges (links).
• This is appropriate when the graph is an explicit data structure.
• In AI, graph is often represented implicitly by the initial state, actions, and transition model and is
frequently infinite. For these reasons, complexity is expressed in terms of three quantities:
• b - maximum branching factor of the search tree
• d - depth of the least-cost solution
• m - maximum depth of the state space (may be ∞)
• Breadth-first Search
• Depth-first Search
Breadth-First Search:
• Breadth-first search is a simple strategy in which the root node is expanded first, then all the
successors of the root node are expanded next, then their successors, and so on.
• All nodes are expanded at a given depth in search tree before any nodes at next level are
expanded.
2 3 d d
Time? 1 + b + b + b + : : : + b = O(b ), i.e., exponential in depth d
d
Space? O(b )-(keeps every node in memory)
Time and memory requirements for breadth-first search assuming branching factor b = 10; 1 million
nodes/second; 1000 bytes/node.
The memory requirements are a bigger problem for breadth-first search than is the execution time.
Depth-First Search:
Depth-first search always expands deepest unexpanded node in frontier of search tree.
• As nodes are expanded, they are dropped from frontier, so then search
“backs up” to nextdeepest node that still has unexplored successors.
Depth-first search uses a LIFO queue (STACK)
• A LIFO queue means that the most recently generated node is chosen for expansion.
• This must be the deepest unexpanded node because it is one deeper than its parent.
m
Time? O(b )-where m is the maximum depth of search tree
terrible if m is much larger than d (depth of shallowest solution)
but if solutions are dense, may be much faster than breadth-first
Space? O(bm)
Optimal? No