Module 1
Syllabus
Textbook Artificial Intelligence(AI)
• AI is one of the newest fields in Science and Engineering.
• Stuart Russell and Peter Norvig. Artificial • Name itself was coined in 1956 by John McCarthy .
Intelligence: A Modern Approach, 3rd Edition. • AI currently encompasses a huge variety of subfields, ranging from the
Prentice Hall.
general (learning and perception) to the specific, such as
➢ Playing chess
➢ Proving mathematical theorems
➢ Writing poetry
➢ Driving a car on a crowded street
➢ Diagnosing diseases etc
• AI is relevant to any intellectual task; it is truly a universal field.
• Machine learning is a branch of artificial intelligence that enables
computer systems to learn from data and improve their performance
on specific tasks without being explicitly programmed.
ARTIFICIAL INTELLIGENCE What is AI
➢ Artificial intelligence allows machines to replicate the capabilities of the human mind. The definitions on the left measure success in terms
➢ From the development of self-driving cars to the development of smart assistants like Siri and of fidelity to human performance,
Alexa, AI is a growing part of everyday life.
the ones on the right measure against an ideal
performance measure, called rationality.
A system is rational if it does the “right thing,”
• Artificial intelligence is a wide-ranging branch of computer science concerned with building
given what it knows.
smart machines capable of performing tasks that typically require human intelligence.
Acting humanly: The Turing Test approach
• Programming a computer to pass a rigorously applied test provides plenty to work on.
• The computer would need to possess the following capabilities:
• proposed by Alan Turing (1950), was designed to provide a satisfactory 1. Natural Language Processing to enable it to communicate successfully in English
operational definition of intelligence. 2. Knowledge Representation to store what it knows or hears
3. Automated Reasoning to use the stored information to answer questions and to draw
new conclusions
4. Machine Learning to adapt to new circumstances and to detect and extrapolate
patterns
The so-called TOTAL TURING TEST- To pass the total Turing Test, the computer will
need:-
• A computer passes the test if a human interrogator, after posing some 5. Computer vision to perceive objects, and
written questions, cannot tell whether the written responses come from a 6. Robotics to manipulate objects and move about
person or from a computer These six disciplines compose most of AI.
• ELIZA program rephrases partner’s statements and questions
(psychotherapist)
• Modern variant: AOLiza
Thinking humanly: The cognitive modeling
approach
• 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.
• There are three ways to do this:
➢Introspection—trying to catch our own thoughts as they go by
➢psychological experiments—observing a person in action
➢brain imaging—observing the brain in action
Thinking rationally: The “laws of thought”
approach
• Once we have a sufficiently precise theory of the mind, it becomes • SYLLOGISM: an instance of a form of reasoning in which a
possible to express the theory as a computer program. conclusion is drawn from two given or assumed
• program’s input–output behavior should match corresponding human propositions, “Socrates is a man; all men are mortal;
behavior. therefore, Socrates is mortal.”
cognitive science brings together computer models from AI and • LOGIC: study of laws of thought to govern the operation
experimental techniques from psychology to construct precise and testable of the mind
theories of the human mind.
Acting rationally: The rational agent approach
➢ An agent is just something that acts ➢ Rational agent is one that acts so as to achieve the best outcome or,
➢ Rational behavior is doing the right thing when there is uncertainty, the best expected outcome
➢Right thing is expected to maximize goal achievement, given available
information
• computer agents
• operate autonomously,
• perceive their environment,
• persist over a prolonged time period,
• adapt to change, and
• create and pursue goals
REQUIREMENTS
NATURAL LANGUAGE PROCESSING
To enable it to communicate successfully
KNOWLEDGE REPRESENTATION
Knowledge representation to store what it knows or hears;
AUTOMATED REASONING
Automated reasoning to use the stored information to answer questions and to draw new conclusions
MACHINE LEARNING
machine learning to adapt to new circumstances and to detect and extrapolate patterns.
COMPUTER VISION
Computer vision to perceive objects
ROBOTICS
Robotics to manipulate objects and move about
How do we measure if Artificial Intelligence is Artificial Intelligence
acting like a human?
➢ Turing Test ➢ An intelligent entity created by humans.
➢ The Cognitive Modelling Approach ➢ Capable of performing tasks intelligently without being explicitly instructed.
➢ The Law of Thought Approach ➢ Capable of thinking and acting rationally and humanly.
➢ The Rational Agent Approach
Foundations of AI
A brief history of the disciplines that contributed
ideas, viewpoints, and techniques to AI is discussed
here.
Philosophy - the mind operates according to logical rules, dualism,
materialism(law of physics)
Mathematics - a level of mathematical formalization in three fundamental areas:
logic, computation, and probability
Economics - how people make choices that lead to preferred outcomes.
Decision theory combines probability theory with utility theory • Psychology - How do humans and animals think and act?
Game theory by Von Neumann and Morgenstern’s provides an Cognitive psychology
ambiguous prescription for selecting actions.
• Computer engineering
• Control theory and cybernetics – Control system is the a regulatory
Neuroscience -is the study of the nervous system, particularly the brain
mechanism trying to minimize “error”—the difference between current state
and goal state
Fields in AI
• Cybernetics - intelligence could be created by the use of homeostatic
devices containing appropriate feedback loops to achieve stable
adaptive behavior.
• Linguistics - How does language relate to thought?
Modern linguistics and AI, then, were “born” at about
the same time, and grew up together, intersecting in a
hybrid field called computational linguistics or natural
language processing
The History of AI
1. The gestation of artificial intelligence (1943–1955)
• 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.
• Year 1949: Donald Hebb demonstrated an updating rule for modifying the connection
strength between neurons. His rule is now called Hebbian learning.
• In 1950 two undergraduate students at Harvard, Marvin Minsky and Dean Edmonds,
built the first neural network computer.
• 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.
3. Early enthusiasm, great expectations (1956–1974)
2. The birth of artificial intelligence (1956)
• Newell and Simon’s early success was followed up with the General Problem Solver, or
GPS. This program was designed from the start to imitate human problem-solving
protocols.
• Year 1955: An Allen Newell and Herbert A. Simon created the "first artificial • GPS was probably the first program to embody the “thinking humanly” approach.
intelligence program“ which was named as "Logic Theorist". This program had • Year 1966: The researchers emphasized developing algorithms which can solve
proved 38 of 52 Mathematics theorems, and find new and more elegant proofs for mathematical problems. Joseph Weizenbaum created the first chatbot in 1966, which
some theorems. was named as ELIZA.
• Year 1956: The word "Artificial Intelligence" first adopted by American • Year 1972: The first intelligent humanoid robot was built in Japan which was named as
Computer scientist John McCarthy at the Dartmouth Conference. For the first WABOT-1.
time, AI coined as an academic field.
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.
4. The first AI winter (1974-1980) 7. The emergence of intelligent agents (1993-2011)
• AI winter refers to the time period where computer scientist dealt with a severe shortage • Year 1997: In the year 1997, IBM Deep Blue beats world chess champion, Gary
of funding from government for AI researches. Kasparov, and became the first computer to beat a world chess champion.
• During AI winters, an interest of publicity on artificial intelligence was decreased. • Year 2002: for the first time, AI entered the home in the
5. A boom of AI (1980-1987) form of Roomba, a vacuum cleaner.
• Year 2006: AI came in the Business world till the year 2006.
• Year 1980: AI come up with "Expert System". Expert systems were programmed that
emulate the decision-making ability of a human expert. Companies like Facebook, Twitter, and Netflix also started
• In the Year 1980, the first national conference of the American Association of Artificial using AI.
Intelligence was held at Stanford University.
6. The second AI winter (1987-1993)
Deep Blue
Roomba
8. Deep learning, big data and artificial general intelligence (2011-present)
• Year 2012: Google has launched an Android app feature "Google now", which
• Year 2011: In the year 2011, IBM's Watson won jeopardy, a quiz show, where it had to was able to provide information to the user as a prediction.
solve the complex questions as well as riddles. Watson had proved that it could understand • Year 2014: In the year 2014, Chatbot "Eugene Goostman" won a competition in
natural language and can solve tricky questions quickly. the infamous "Turing test."
• Year 2018: The "Project Debater" from IBM debated on complex topics with two
master debaters and also performed extremely well.
The future of Artificial Intelligence is inspiring and will come with high
intelligence.
Watson’s jeopardy show in Feb 2011
Applications of AI (The State of the Art)
Applications of AI
1. Robotic vehicles:
A driverless robotic car named STANLEY sped through the rough terrain of the
• Robotic vehicles Mojave dessert at 22 mph, finishing the 132-mile course first to win the 2005 DARPA
• Speech recognition Grand Challenge. STANLEY is a Volkswagen Touareg outfitted with cameras, radar,
and laser rangefinders to sense the environment and onboard software to command
• Autonomous planning and scheduling the steering, braking, and acceleration (Thrun, 2006).
• Game playing
• Spam fighting
• Robotics ,etc
2. Speech recognition:
A traveler calling United Airlines to book a flight can have the entire conversation guided
Intelligent Agents
by an automated speech recognition and dialog management system.
3. Autonomous planning and scheduling: • An agent is anything that can be viewed as perceiving its environment
A hundred million miles from Earth, NASA’s Remote Agent program became the first on-
through sensors and acting upon that environment through actuators.
board autonomous planning program to control the scheduling of operations for a
spacecraft.
4. Game playing:
IBM’s DEEP BLUE became the first computer program to defeat the world champion,
Garry Kasparov, in a chess match
5. Spam fighting:
Learning algorithms classify over a billion messages as spam, saving the deletion time of
recipients.
6. Robotics:
7. Machine Translation:
• A human agent has eyes, ears, and other organs for sensors and hands, legs,
vocal tract, and so on for actuators. • Mathematically speaking, we say that an agent’s behavior is described by
• A robotic agent might have cameras and infrared range finders for sensors and the agent function that maps any given percept sequence to an action.
various motors for actuators. • agent function for an artificial agent will be implemented by an agent
• A software agent receives keystrokes, file contents, and network packets as program.
sensory inputs and acts on the environment by displaying on the screen, writing • Agent function is an abstract mathematical description;
files, and sending network packets. • the agent program is a concrete implementation, running within some
• term percept(input) is used to refer the agent’s perceptual inputs at any given physical system.
instant. • agent program runs on the physical architecture to produce the agent
• percept sequence is agent’s complete history of everything the agent has ever function.
perceived. • So the agent comprises of
agent = architecture + program
• An agent’s choice of action at any given instant can depend on the entire percept
sequence observed to date but not on anything it hasn’t perceived.
The Vacuum Cleaner World
• Following are the main four rules for an AI agent:
•Rule 1: An AI agent must have the ability to perceive the environment.
•Rule 2: The observation must be used to make decisions.
•Rule 3: Decision should result in an action.
•Rule 4: The action taken by an AI agent must be a rational action.
• This particular world has just two locations: squares A and B.
To illustrate these ideas, we use a very simple example—the vacuum-cleaner
• vacuum agent perceives which square it is in and whether there is dirt in the square.
world.
(Percepts: location and contents, e.g., [A,Dirty])
• It can choose to move left, move right, suck up the dirt, or do nothing. (Actions: Left,
Right, Suck, NoOp)
• One very simple agent function is the following: if the current square is dirty, then suck;
otherwise, move to the other square.
• Agent’s function – Look up table
Good Behaviour: Concept of Rationality
• Rational agent is one that does the right thing.
• When an agent is plunked down in an environment, it generates a sequence of
actions according to the percepts it receives.
• sequence of actions causes the environment to go through a sequence of states.
• If the sequence is desirable, then the agent has performed well.
• This notion of desirability is captured by a performance measure that evaluates
any given sequence of environment states.
Example- Vacuum Cleaner Revisited
• measure performance by the amount of dirt cleaned up in a single eight-hour • Performance measures of a vacuum-cleaner agent: amount of dirt cleaned
shift. up, amount of time taken, amount of electricity consumed, level of noise
generated, etc.
• With a rational agent, of course, what you ask for is what you get.
• A rational agent can maximize this performance measure by cleaning up the dirt, • Performance measures of a self-driving car: time to reach destination
then dumping it all on the floor, then cleaning it up again, and so on. (minimize), safety, predictability of behavior for other agents, reliability,
• A more suitable performance measure would reward the agent for having a clean etc.
floor.
• For example, one point could be awarded for each clean square at each time step • Performance measure of game-playing agent: win/loss percentage
(perhaps with a penalty for electricity consumed and noise generated). (maximize), robustness, unpredictability (to “confuse” opponent), etc.
• As a general rule, it is better to design performance measures according to what
one actually wants in the environment, rather than according to how one
thinks the agent should behave.
Rationality Omniscience, learning, and autonomy
• What is rational at any given time depends on four things:
• An omniscient agent knows the actual outcome of its actions and can act
➢ Performance measuring success accordingly.
➢ Agents prior knowledge of environment • But omniscience is impossible in reality.
➢ Actions that agent can perform • Rationality is not the same as perfection.
➢ Agent’s percept sequence to date • Rationality maximizes expected performance, while perfection maximizes actual
• This leads to a definition of a rational agent. performance.
“For each possible percept sequence, a rational agent should select an action • To maximize the expected performance, information gathering is required.
that is expected to maximize its performance measure, given the evidence • Doing actions in order to modify future percepts is information gathering which
provided by the percept sequence and whatever built-in knowledge the agent is an important part of rationality.
has.”
The Nature of Environments
• To build rational agents, the knowledge about task environments is essential because
• Information gathering can be achieved by exploration and the rational agent it is on which rational agents are perceiving and acting.
must learn what it perceives. • So first step is to specify the task environment.
• A rational agent should be autonomous. That is agent should more rely on its Specifying the task environment
own percepts
• task environment includes the performance measure, the environment, and the agent’s
• So it would be reasonable to provide an AI agent with some initial actuators and sensors.
knowledge as well as an ability to learn.
• Acronymically PEAS(Performance, Environment, Actuators, Sensors)
• After sufficient experience gained from its environment, its behavior can
become effectively independent of its prior knowledge.
• This will allow a rational agent succeed in a vast variety of environments
• The PEAS description of an automated taxi driver can be taken.
Task Environment Types
• Fully observable (vs. partially observable)
• Single agent(vs. Multi agent)
• Deterministic (vs. stochastic)
• Episodic (vs. sequential)
• Static (vs. dynamic)
• Discrete (vs. continuous)
• Known (vs. unknown)
1. Fully observable vs. partially observable 2. Single agent vs. multiagent
➢If an agent’s sensors give it access to the complete state of the environment • If only one agent is involved in an environment, and operating by itself then such
at each point in time - fully observable. an environment is called single agent environment.
➢A task environment is effectively fully observable if the sensors detect all • However, if multiple agents are operating in an environment, then such an
aspects that are relevant to the choice of action; relevance, in turn, depends environment is called a multi-agent environment.
on the performance measure.
• chess is a competitive multiagent environment.
➢are convenient because the agent need not maintain any internal state to
keep track of the world. • In the taxi-driving environment avoiding collisions maximizes the performance
measure of all agents, so it is a partially cooperative multiagent environment.
➢ An environment might be partially observable because of noisy and
inaccurate sensors or because parts of the state are simply missing from the
sensor data
➢ If the agent has no sensors at all then the environment is unobservable
3. Deterministic vs. stochastic 4. Episodic vs. sequential
➢If the next state of the environment is completely determined by the current
state and the action executed by the agent, then we say the environment is
• Episodic task environment:
deterministic (eg:-vacuum world)
• the agent’s experience is divided into atomic episodes.
➢ an agent need not worry about uncertainty in a fully observable, deterministic • In each episode the agent receives a percept and then performs a single action.
environment
• Crucially, the next episode does not depend on the actions taken in previous
➢“Stochastic” generally implies that uncertainty about outcome is quantified in episodes.
terms of probabilities • Many classification tasks are episodic.
➢ a nondeterministic environment is one in which actions are characterized by • Sequential environments
their possible outcomes, but no probabilities are attached to them. • the current decision could affect all future decisions
➢If the environment is partially observable, however, then it could appear to be • Chess and taxi driving are sequential: in both cases, short-term actions can have
stochastic (eg:- Taxi driving ) long-term consequences.
• Episodic environments are much simpler than sequential environments because the
➢Environment is uncertain if it is not fully observable or not deterministic agent does not need to think ahead.
5. Static vs. dynamic 6. Discrete vs. continuous
➢ If the environment can change while an agent is deliberating, then we If the number of distinct percepts and actions is limited, the environment is
say the environment is dynamic for that agent; otherwise, it is static discrete, otherwise it is continuous.
➢A static environment does not change while the agent is thinking. • chess environment has a finite number of distinct states (excluding the clock).
➢ Dynamic environments, on the other hand, are continuously asking the • Chess also has a discrete set of percepts and actions.
agent what it wants to do; if it hasn’t decided yet, that counts as deciding • Taxi driving is a continuous-state and continuous-time problem: the speed and
to do nothing. (Eg:- Taxi driving) location of the taxi and of the other vehicles sweep through a range of
➢If the environment itself does not change with the passage of time but the continuous values and do so smoothly over time
agent’s performance score does, then we say the environment is semi- • Taxi-driving actions are also continuous (steering angles, etc.).
dynamic.
• Input from digital cameras is discrete, strictly speaking, but is typically treated as
Chess, when played with a clock, is semi-dynamic. representing continuously varying intensities and locations.
• Crossword puzzles are static
7. Known vs. unknown
• In a known environment, the outcomes for all actions are given.
• If the environment is unknown, the agent will have to learn how it works in order
to make good decisions
• a known environment can be partially observable
• for example, in solitaire card games, I know the rules but am still unable to
see the cards that have not yet been turned over.
An unknown environment can be fully observable
• In a new video game, the screen may show the entire game state but I still
don’t know what the buttons do until I try them.
Structure of Agent Agent programs
• Agent program: use current percept as input from the sensors and return an action to
• Job of AI is to
the actuators
➢design an agent program
• Agent function: takes the entire percept history
➢implements the agent function the mapping from percepts to actions.
• his program will run on some sort of computing device with physical sensors and
actuators called the architecture
• agent = architecture + program
• architecture
➢makes the percepts from the sensors available to the program
➢ runs the program
➢ feeds the program’s action choices to the actuators as they are generated • To build a rational agent in this way, we as designers must construct a table that
contains the appropriate action for every possible percept sequence.
• Let P be the set of possible percepts and let T be the lifetime of the agent (the total
number of percepts it will receive) Types of Agent Programs
• lookup table will contain entries.
• Even the lookup table for chess a tiny, well-behaved fragment of the real world would have
at least 10150 entries.
➢ Simple reflex agents
➢ Model-based reflex agents
➢ Goal-based agents
➢ Utility-based agents
1. Simple reflex agents
• Select actions on the basis of the current percept, ignoring the rest of
the percept history If tail-light of car in front is
red, then brake.
• Agents do not have memory of past world states or percepts.
So, actions depend solely on current percept.
Action becomes a “reflex.”
Uses condition-action rules.
• condition–action rule
if car-in-front-is-braking then initiate-braking
[Link]-based reflex agents
• Works by finding a rule whose condition matches the current
situation.
• Key difference (wrt simple reflex agents):
• INTERPRET-INPUT function generates an abstracted description of the
current state from the percept
• Agents have internal state, which is used to keep track of past states of the
• RULE-MATCH function returns the first rule in the set of rules that matches world.
the given state description.
• Infinite loops are often unavoidable for simple reflex agents operating in
partially observable environments • Agents have the ability to represent change in the World.
represents the
agent’s “best
guess”
• Internal state information as time goes by requires two kinds of
“Infers potentially knowledge to be encoded in the agent program
dangerous driver
in front.”
1. we need some information about how the world evolves
If “dangerous driver in front,” independently of the agent
then “keep distance.”
2. we need some information about how the agent’s own actions
affect the world
• knowledge about “how the world works is called a model of the
world.
• An agent that uses such a model is called a model-based agent.
Goal-based agents
• In addition to state information, have goal information that
describes desirable situations to be achieved.
• Search and planning are the subfields of AI devoted to finding action
sequences that achieve the agent’s goals
• Agents of this kind take future events into consideration.
• UPDATE-STATE, which is responsible for creating the new internal state • What sequence of actions can I take to achieve certain goals?
description.
• Choose actions so as to (eventually) achieve a (given or computed)
goal.
Utility-based agents
• Goals alone are not enough to generate high-quality behavior in most
environments
• Goals just provide a crude binary distinction between “happy” and “unhappy”
states
• Because “happy” does not sound very scientific, economists and computer
scientists use the term utility instead
• An agent’s utility function is essentially an internalization of the performance
measure.
• If the internal utility function and the external performance measure are in
agreement, then an agent that chooses actions to maximize its utility will be
rational according to the external performance measure.
Learning agents
Give PEAS description for:-
• A learning agent can be divided into four conceptual components • Personal AI Assistant
1. learning element, which is responsible for making improvements • Spam Email Filter
2. performance element, which is responsible for selecting external actions. • AI Tutor System for Education
The performance element is what we have previously considered to be
the entire agent: it takes in percepts and decides on actions. • AI System for Medical Diagnosis
3. Feedback from the critic : on how the agent is doing and determines how • Part-picking robot
the performance element should be modified to do better in the future • Refinery controller
4. problem generator. It is responsible for suggesting actions that will lead • Satellite image analysis system
to new and informative experiences
• Chess-playing Agent